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: https://github.com/siyuan-note/siyuan/issues/6404
Vanessad2e6198e212a
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.tsindex f699761222..1be6b89f33 100644--- a/app/src/protyle/util/compatibility.ts+++ b/app/src/protyle/util/compatibility.ts@@ -143,6 +143,18 @@ export const setLocalStorage = () => {localStorage.clear();}});++ // 复写 localStorage+ window.__localStorage__setItem = localStorage.setItem+ window.__localStorage__removeItem = localStorage.removeItem+ localStorage.setItem = function (key, value) {+ window.__localStorage__setItem.call(this, key, value)+ fetchPost("/api/storage/setLocalStorageVal", {key, value});+ }+ localStorage.removeItem = function (key) {+ window.__localStorage__removeItem.call(this, key)+ fetchPost("/api/storage/removeLocalStorageVal", {key});+ }};export const exportLocalStorage = (cb: () => void) => {diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex bff54ace41..d24f629fa5 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -26,6 +26,8 @@ type TBazaarType = "templates" | "icons" | "widgets" | "themes"declare module "blueimp-md5"interface Window {+ __localStorage__removeItem: (key: string) => void+ __localStorage__setItem: (key: string, value: string) => voiddataLayer: any[]siyuan: ISiyuanwebkit: anydiff --git a/app/src/util/fetch.ts b/app/src/util/fetch.tsindex 74d6068e4a..2ef1500ceb 100644--- a/app/src/util/fetch.ts+++ b/app/src/util/fetch.ts@@ -42,7 +42,7 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat}/// #if !BROWSERif (url === "/api/system/exit" || url === "/api/system/setWorkspaceDir" || (- url === "/api/system/setUILayout" && data.exit // 内核中断,点关闭处理+ ["/api/system/setUILayout", "/api/storage/setLocalStorage"].includes(url) && data.exit // 内核中断,点关闭处理)) {ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSETRAY);ipcRenderer.send(Constants.SIYUAN_QUIT);