2023-06-24 20:39:55 +08:00
|
|
|
|
// SiYuan - Refactor your thinking
|
2022-05-26 15:18:53 +08:00
|
|
|
|
// Copyright (c) 2020-present, b3log.org
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
|
|
package conf
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"github.com/siyuan-note/siyuan/kernel/util"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type System struct {
|
2022-09-08 10:29:27 +08:00
|
|
|
|
ID string `json:"id"`
|
2023-04-24 12:07:39 +08:00
|
|
|
|
Name string `json:"name"`
|
2022-09-08 10:29:27 +08:00
|
|
|
|
KernelVersion string `json:"kernelVersion"`
|
|
|
|
|
|
OS string `json:"os"`
|
2023-02-10 21:39:24 +08:00
|
|
|
|
OSPlatform string `json:"osPlatform"`
|
2022-09-08 10:29:27 +08:00
|
|
|
|
Container string `json:"container"` // docker, android, ios, std
|
|
|
|
|
|
IsMicrosoftStore bool `json:"isMicrosoftStore"`
|
|
|
|
|
|
IsInsider bool `json:"isInsider"`
|
2022-05-26 15:18:53 +08:00
|
|
|
|
|
|
|
|
|
|
HomeDir string `json:"homeDir"`
|
|
|
|
|
|
WorkspaceDir string `json:"workspaceDir"`
|
|
|
|
|
|
AppDir string `json:"appDir"`
|
|
|
|
|
|
ConfDir string `json:"confDir"`
|
|
|
|
|
|
DataDir string `json:"dataDir"`
|
|
|
|
|
|
|
2022-10-25 11:45:17 +08:00
|
|
|
|
NetworkServe bool `json:"networkServe"` // 是否开启网络伺服
|
2022-05-26 15:18:53 +08:00
|
|
|
|
NetworkProxy *NetworkProxy `json:"networkProxy"`
|
|
|
|
|
|
|
2025-06-20 10:20:42 +08:00
|
|
|
|
DownloadInstallPkg bool `json:"downloadInstallPkg"`
|
|
|
|
|
|
AutoLaunch2 int `json:"autoLaunch2"` // 0:不自动启动,1:自动启动,2:自动启动+隐藏主窗口
|
|
|
|
|
|
LockScreenMode int `json:"lockScreenMode"` // 0:手动,1:手动+跟随系统 https://github.com/siyuan-note/siyuan/issues/9087
|
2024-11-07 16:51:59 +08:00
|
|
|
|
|
|
|
|
|
|
DisabledFeatures []string `json:"disabledFeatures"`
|
2024-12-28 23:35:23 +08:00
|
|
|
|
|
|
|
|
|
|
MicrosoftDefenderExcluded bool `json:"microsoftDefenderExcluded"` // 是否已加入 Microsoft Defender 排除项 https://github.com/siyuan-note/siyuan/issues/13650
|
2022-05-26 15:18:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewSystem() *System {
|
|
|
|
|
|
return &System{
|
2025-06-20 10:20:42 +08:00
|
|
|
|
ID: util.GetDeviceID(),
|
|
|
|
|
|
Name: util.GetDeviceName(),
|
|
|
|
|
|
KernelVersion: util.Ver,
|
|
|
|
|
|
NetworkProxy: &NetworkProxy{},
|
|
|
|
|
|
DownloadInstallPkg: true,
|
2022-05-26 15:18:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type NetworkProxy struct {
|
|
|
|
|
|
Scheme string `json:"scheme"`
|
|
|
|
|
|
Host string `json:"host"`
|
|
|
|
|
|
Port string `json:"port"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (np *NetworkProxy) String() string {
|
|
|
|
|
|
if "" == np.Scheme {
|
|
|
|
|
|
return ""
|
|
|
|
|
|
}
|
|
|
|
|
|
return np.Scheme + "://" + np.Host + ":" + np.Port
|
|
|
|
|
|
}
|