An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 记录操作系统平台
Liang Ding235d940cadd5
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 56d4b58a93..f8e5760fd1 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -424,6 +424,7 @@ declare interface IConfig {container: "std" | "android" | "docker" | "ios"isMicrosoftStore: booleanos: "windows" | "linux" | "darwin"+ osPlatform: stringhomeDir: stringxanadu: booleanudanax: booleandiff --git a/app/src/util/assets.ts b/app/src/util/assets.tsindex 584db3afd7..39ee16c86b 100644--- a/app/src/util/assets.ts+++ b/app/src/util/assets.ts@@ -23,10 +23,10 @@ const loadThirdIcon = (iconURL: string, data: IAppearance) => {export const loadAssets = (data: IAppearance) => {const htmlElement = document.getElementsByTagName("html")[0];- htmlElement.setAttribute("lang",window.siyuan.config.appearance.lang);- htmlElement.setAttribute("data-theme-mode",getThemeMode());- htmlElement.setAttribute("data-light-theme",window.siyuan.config.appearance.themeLight);- htmlElement.setAttribute("data-dark-theme",window.siyuan.config.appearance.themeDark);+ htmlElement.setAttribute("lang", window.siyuan.config.appearance.lang);+ htmlElement.setAttribute("data-theme-mode", getThemeMode());+ htmlElement.setAttribute("data-light-theme", window.siyuan.config.appearance.themeLight);+ htmlElement.setAttribute("data-dark-theme", window.siyuan.config.appearance.themeDark);const OSTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";if (window.siyuan.config.appearance.modeOS && ((window.siyuan.config.appearance.mode === 1 && OSTheme === "light") ||@@ -172,6 +172,7 @@ export const addGA = () => {version: Constants.SIYUAN_VERSION,container: window.siyuan.config.system.container,os: window.siyuan.config.system.os,+ osPlatform: window.siyuan.config.system.osPlatform,isLoggedIn: false,subscriptionStatus: -1,subscriptionPlan: -1,diff --git a/kernel/conf/system.go b/kernel/conf/system.goindex f560c9b096..b3bdffc373 100644--- a/kernel/conf/system.go+++ b/kernel/conf/system.go@@ -24,6 +24,7 @@ type System struct {ID string `json:"id"`KernelVersion string `json:"kernelVersion"`OS string `json:"os"`+ OSPlatform string `json:"osPlatform"`Container string `json:"container"` // docker, android, ios, stdIsMicrosoftStore bool `json:"isMicrosoftStore"`IsInsider bool `json:"isInsider"`diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex e8e9b9522f..195cb6f6e2 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -236,6 +236,7 @@ func InitConf() {logging.LogInfof("using Microsoft Store edition")}Conf.System.OS = runtime.GOOS+ Conf.System.OSPlatform = util.GetOSPlatform()Conf.Newbie = util.IsNewbieif "" != Conf.UserData {diff --git a/kernel/util/os.go b/kernel/util/os.gonew file mode 100644index 0000000000..cacdfff481--- /dev/null+++ b/kernel/util/os.go@@ -0,0 +1,33 @@+// SiYuan - Build Your Eternal Digital Garden+// 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/>.++//go:build !ios && !android++package util++import (+ "github.com/shirou/gopsutil/v3/host"+ "github.com/siyuan-note/logging"+)++func GetOSPlatform() (ret string) {+ ret, _, _, err := host.PlatformInformation()+ if nil != err {+ logging.LogWarnf("get os platform failed: %s", err)+ return+ }+ return+}diff --git a/kernel/util/os_mobile.go b/kernel/util/os_mobile.gonew file mode 100644index 0000000000..73bff4e413--- /dev/null+++ b/kernel/util/os_mobile.go@@ -0,0 +1,29 @@+// SiYuan - Build Your Eternal Digital Garden+// 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/>.++//go:build ios || android++package util++func GetOSPlatform() (ret string) {+ if ContainerIOS == Container {+ return "iOS"+ }+ if ContainerAndroid == Container {+ return "Android"+ }+ return+}diff --git a/kernel/util/runtime.go b/kernel/util/runtime.goindex e38c1c5533..1fbadcd124 100644--- a/kernel/util/runtime.go+++ b/kernel/util/runtime.go@@ -49,6 +49,7 @@ func logBootInfo() {logging.LogInfof("kernel is booting:\n"+" * ver [%s]\n"+" * arch [%s]\n"++ " * os [%s] "+" * pid [%d]\n"+" * runtime mode [%s]\n"+" * working directory [%s]\n"+@@ -56,7 +57,7 @@ func logBootInfo() {" * container [%s]\n"+" * database [ver=%s]\n"+" * workspace directory [%s]",- Ver, runtime.GOARCH, os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir)+ Ver, runtime.GOARCH, GetOSPlatform(), os.Getpid(), Mode, WorkingDir, ReadOnly, Container, DatabaseVer, WorkspaceDir)}func IsMutexLocked(m *sync.Mutex) bool {