A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)
1// SiYuan - Refactor your thinking
2// Copyright (c) 2020-present, b3log.org
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU Affero General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU Affero General Public License for more details.
13//
14// You should have received a copy of the GNU Affero General Public License
15// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17package conf
18
19import (
20 "github.com/siyuan-note/siyuan/kernel/util"
21)
22
23type System struct {
24 ID string `json:"id"`
25 Name string `json:"name"`
26 KernelVersion string `json:"kernelVersion"`
27 OS string `json:"os"`
28 OSPlatform string `json:"osPlatform"`
29 Container string `json:"container"` // docker, android, ios, harmony, std
30 IsMicrosoftStore bool `json:"isMicrosoftStore"`
31 IsInsider bool `json:"isInsider"`
32
33 HomeDir string `json:"homeDir"`
34 WorkspaceDir string `json:"workspaceDir"`
35 AppDir string `json:"appDir"`
36 ConfDir string `json:"confDir"`
37 DataDir string `json:"dataDir"`
38
39 NetworkServe bool `json:"networkServe"` // 是否开启网络伺服
40 NetworkServeTLS bool `json:"networkServeTLS"` // 是否开启 HTTPS 网络伺服
41 NetworkProxy *NetworkProxy `json:"networkProxy"`
42
43 DownloadInstallPkg bool `json:"downloadInstallPkg"`
44 AutoLaunch2 int `json:"autoLaunch2"` // 0:不自动启动,1:自动启动,2:自动启动+隐藏主窗口
45 LockScreenMode int `json:"lockScreenMode"` // 0:手动,1:手动+跟随系统 https://github.com/siyuan-note/siyuan/issues/9087
46
47 DisabledFeatures []string `json:"disabledFeatures"`
48}
49
50func NewSystem() *System {
51 return &System{
52 ID: util.GetDeviceID(),
53 Name: util.GetDeviceName(),
54 KernelVersion: util.Ver,
55 NetworkProxy: &NetworkProxy{},
56 DownloadInstallPkg: true,
57 }
58}
59
60type NetworkProxy struct {
61 Scheme string `json:"scheme"`
62 Host string `json:"host"`
63 Port string `json:"port"`
64}
65
66func (np *NetworkProxy) String() string {
67 if "" == np.Scheme {
68 return ""
69 }
70 return np.Scheme + "://" + np.Host + ":" + np.Port
71}