An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: fix https://github.com/siyuan-note/siyuan/issues/6601
Vanessa2b0b28b2868c
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex 61de41ed95..7e3b054d0b 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -53,16 +53,11 @@ class App {document.title = window.siyuan.languages.siyuanNote;bootSync();loadAssets(confResponse.data.conf.appearance);+ initMessage();initAssets();fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {window.siyuan.emojis = emojiResponse.data as IEmoji[];initFramework();- if (window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) {- window.webkit.messageHandlers.changeStatusBar.postMessage(getComputedStyle(document.body).getPropertyValue("--b3-theme-background") + " " + window.siyuan.config.appearance.mode);- } else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {- window.JSAndroid.changeStatusBarColor(getComputedStyle(document.body).getPropertyValue("--b3-theme-background"), window.siyuan.config.appearance.mode);- }- initMessage();});addGA();});diff --git a/app/src/util/assets.ts b/app/src/util/assets.tsindex a7574aed32..02bfb9f146 100644--- a/app/src/util/assets.ts+++ b/app/src/util/assets.ts@@ -120,9 +120,9 @@ export const initAssets = () => {loadingElement.remove();}, 160);}- watchTheme({init: true, theme: window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"});+ watchTheme({init: true, OSTheme: window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"});window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", event => {- watchTheme({init: false, theme: event.matches ? "dark" : "light"});+ watchTheme({init: false, OSTheme: event.matches ? "dark" : "light"});});};@@ -246,15 +246,33 @@ export const setMode = (modeElementValue: number) => {/// #endif};--export const watchTheme = (data: { init: boolean, theme: string }) => {+const watchTheme = (data: { init: boolean, OSTheme: string }) => {+ if ((window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) ||+ (window.siyuan.config.system.container === "android" && window.JSAndroid)) {+ setTimeout(() => {+ const backgroundColor = getComputedStyle(document.body).getPropertyValue("--b3-theme-background")+ let mode = window.siyuan.config.appearance.mode;+ if (window.siyuan.config.appearance.modeOS) {+ if (data.OSTheme === "dark") {+ mode = 1;+ } else {+ mode = 0;+ }+ }+ if (window.siyuan.config.system.container === "ios" && window.webkit?.messageHandlers) {+ window.webkit.messageHandlers.changeStatusBar.postMessage(backgroundColor + " " + mode);+ } else if (window.siyuan.config.system.container === "android" && window.JSAndroid) {+ window.JSAndroid.changeStatusBarColor(backgroundColor, mode);+ }+ }, Constants.TIMEOUT_BLOCKLOAD); // 移动端需要加载完才可以获取到颜色+ }if (data.init) {if (window.siyuan.config.appearance.modeOS && (- (window.siyuan.config.appearance.mode === 1 && data.theme === "light") ||- (window.siyuan.config.appearance.mode === 0 && data.theme === "dark")+ (window.siyuan.config.appearance.mode === 1 && data.OSTheme === "light") ||+ (window.siyuan.config.appearance.mode === 0 && data.OSTheme === "dark"))) {fetchPost("/api/system/setAppearanceMode", {- mode: data.theme === "light" ? 0 : 1+ mode: data.OSTheme === "light" ? 0 : 1}, response => {window.siyuan.config.appearance = response.data.appearance;loadAssets(response.data.appearance);@@ -267,12 +285,12 @@ export const watchTheme = (data: { init: boolean, theme: string }) => {if (!window.siyuan.config.appearance.modeOS) {return;}- if ((window.siyuan.config.appearance.mode === 0 && data.theme === "light") ||- (window.siyuan.config.appearance.mode === 1 && data.theme === "dark")) {+ if ((window.siyuan.config.appearance.mode === 0 && data.OSTheme === "light") ||+ (window.siyuan.config.appearance.mode === 1 && data.OSTheme === "dark")) {return;}fetchPost("/api/system/setAppearanceMode", {- mode: data.theme === "light" ? 0 : 1+ mode: data.OSTheme === "light" ? 0 : 1}, response => {if (window.siyuan.config.appearance.themeJS) {/// #if !MOBILEdiff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 4c6da18157..a71eb55995 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -15,14 +15,14 @@ import {globalShortcut} from "./globalShortcut";import {fetchPost} from "./fetch";import {mountHelp, newDailyNote} from "./mount";import {MenuItem} from "../menus/Menu";-import {addGA, initAssets, loadAssets, setInlineStyle, setMode, watchTheme} from "./assets";+import {addGA, initAssets, setInlineStyle, setMode} from "./assets";import {renderSnippet} from "../config/util/snippets";import {getOpenNotebookCount} from "./pathName";import {openFileById} from "../editor/util";import {focusByRange} from "../protyle/util/selection";import {exitSiYuan} from "../dialog/processSystem";import {openSetting} from "../config";-import {getSearch, isBrowser} from "./functions";+import {getSearch} from "./functions";import {openHistory} from "./history";import {initStatus} from "../layout/status";import {syncGuide} from "../sync/syncGuide";