Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/13780

Vanessa5143121ac4fa
diff --git a/app/src/assets/scss/base.scss b/app/src/assets/scss/base.scss
index 49c9380c6c..e85c292c72 100644
--- a/app/src/assets/scss/base.scss
+++ b/app/src/assets/scss/base.scss
@@ -106,7 +106,7 @@ html {
&--browser {
padding-left: env(titlebar-area-x, 0);
padding-right: calc(100% - env(titlebar-area-width, 100%) - env(titlebar-area-x, 0));
- height: env(titlebar-area-height, 32px);
+ height: calc(env(titlebar-area-height, 31px) + 1px);
}
#windowControls {
diff --git a/app/src/index.ts b/app/src/index.ts
index 454f56bac7..4bb8a25191 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -37,9 +37,7 @@ export class App {
public appId: string;
constructor() {
- /// #if BROWSER
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
- /// #endif
addBaseURL();
this.appId = Constants.SIYUAN_APPID;
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 0eb78b588d..d9205b869b 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -34,9 +34,7 @@ class App {
public appId: string;
constructor() {
- if (!window.webkit?.messageHandlers && !window.JSAndroid && !window.JSHarmony) {
- registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
- }
+ registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
addBaseURL();
this.appId = Constants.SIYUAN_APPID;
window.siyuan = {
diff --git a/app/src/util/assets.ts b/app/src/util/assets.ts
index 04b449767a..b4b43deebc 100644
--- a/app/src/util/assets.ts
+++ b/app/src/util/assets.ts
@@ -78,6 +78,13 @@ export const loadAssets = (data: Config.IAppearance) => {
}
});
/// #endif
+
+ /// #if BROWSER
+ if (!window.webkit?.messageHandlers && !window.JSAndroid && !window.JSHarmony &&
+ ("serviceWorker" in window.navigator) && ("caches" in window) && ("fetch" in window) && navigator.serviceWorker) {
+ document.head.insertAdjacentHTML("afterbegin", `<meta name="theme-color" content="${getComputedStyle(document.body).getPropertyValue("--b3-toolbar-background").trim()}">`)
+ }
+ /// #endif
setCodeTheme();
const themeScriptElement = document.getElementById("themeScript");
diff --git a/app/src/util/serviceWorker.ts b/app/src/util/serviceWorker.ts
index d7e3916bd1..805a97cbe7 100644
--- a/app/src/util/serviceWorker.ts
+++ b/app/src/util/serviceWorker.ts
@@ -7,8 +7,9 @@ export const registerServiceWorker = (
updateViaCache: "all",
},
) => {
-
- if (!("serviceWorker" in window.navigator)
+ /// #if BROWSER
+ if (window.webkit?.messageHandlers || window.JSAndroid || window.JSHarmony ||
+ !("serviceWorker" in window.navigator)
|| !("caches" in window)
|| !("fetch" in window)
|| navigator.serviceWorker == null
@@ -22,6 +23,7 @@ export const registerServiceWorker = (
.then(registration => {
registration.update();
}).catch(e => {
- console.debug(`Registration failed with ${e}`);
- });
+ console.debug(`Registration failed with ${e}`);
+ });
+ /// #endif
};