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
Vanessac79048ad7318
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex d726e9a641..741ce4f9d0 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -441,7 +441,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB}}if (window.siyuan.mobileEditor) {- window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({+ localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id,action: id === protyle.block.rootID ? [Constants.CB_GET_HL, Constants.CB_GET_CONTEXT] : [Constants.CB_GET_ALL]}));diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.tsindex 11c9d85807..af5e077c78 100644--- a/app/src/mobile/editor.ts+++ b/app/src/mobile/editor.ts@@ -14,7 +14,7 @@ import {hideElements} from "../protyle/ui/hideElements";import {pushBack} from "./util/MobileBackFoward";export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) => {- window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, action}));+ localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id, action}));if (window.siyuan.mobileEditor) {hideElements(["toolbar", "hint", "util"], window.siyuan.mobileEditor.protyle);if (window.siyuan.mobileEditor.protyle.contentElement.classList.contains("fn__none")) {diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.tsindex 3daf984357..0224abe95a 100644--- a/app/src/mobile/util/MobileBackFoward.ts+++ b/app/src/mobile/util/MobileBackFoward.ts@@ -12,7 +12,7 @@ const forwardStack: IBackStack[] = [];const focusStack = (backStack: IBackStack) => {const protyle = window.siyuan.mobileEditor.protyle;- window.localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({+ localStorage.setItem(Constants.LOCAL_DOCINFO, JSON.stringify({id: backStack.id,action: backStack.callback,}));diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex 2321383160..5c39e9e5aa 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -127,7 +127,7 @@ export const initFramework = () => {});initEditorName();if (getOpenNotebookCount() > 0) {- const localDoc = JSON.parse(window.localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');+ const localDoc = JSON.parse(localStorage.getItem(Constants.LOCAL_DOCINFO) || '{"id": ""}');fetchPost("/api/block/checkBlockExist", {id: localDoc.id}, existResponse => {if (existResponse.data) {openMobileFileById(localDoc.id, localDoc.action);diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.tsindex 1be6b89f33..c1eeede797 100644--- a/app/src/protyle/util/compatibility.ts+++ b/app/src/protyle/util/compatibility.ts@@ -135,21 +135,20 @@ export const hotKey2Electron = (key: string) => {export const setLocalStorage = () => {fetchPost("/api/storage/getLocalStorage", undefined, (response) => {+ localStorage.clear();if (response.data) {Object.keys(response.data).forEach(item => {- window.localStorage.setItem(item, response.data[item]);+ localStorage.setItem(item, response.data[item]);});- } else {- localStorage.clear();}});// 复写 localStoragewindow.__localStorage__setItem = localStorage.setItemwindow.__localStorage__removeItem = localStorage.removeItem- localStorage.setItem = function (key, value) {- window.__localStorage__setItem.call(this, key, value)- fetchPost("/api/storage/setLocalStorageVal", {key, value});+ localStorage.setItem = function (key, val) {+ window.__localStorage__setItem.call(this, key, val)+ fetchPost("/api/storage/setLocalStorageVal", {key, val});}localStorage.removeItem = function (key) {window.__localStorage__removeItem.call(this, key)@@ -158,7 +157,7 @@ export const setLocalStorage = () => {};export const exportLocalStorage = (cb: () => void) => {- fetchPost("/api/storage/setLocalStorage", {val: window.localStorage}, () => {+ fetchPost("/api/storage/setLocalStorage", {val: localStorage}, () => {cb();});};diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex e1b44fdaa0..fe96b8f966 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -119,7 +119,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>replaceInnerHTML += "\n```";}const languageIndex = replaceInnerHTML.indexOf("```") + 3;- replaceInnerHTML = replaceInnerHTML.substring(0, languageIndex) + (window.localStorage["local-codelang"] || "") + replaceInnerHTML.substring(languageIndex);+ replaceInnerHTML = replaceInnerHTML.substring(0, languageIndex) + (localStorage["local-codelang"] || "") + replaceInnerHTML.substring(languageIndex);editableElement.innerHTML = replaceInnerHTML;}diff --git a/app/src/util/history.ts b/app/src/util/history.tsindex c577e217cf..cdb8364613 100644--- a/app/src/util/history.ts+++ b/app/src/util/history.ts@@ -23,7 +23,7 @@ const renderDoc = (element: HTMLElement, currentPage: number) => {const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;const typeElement = element.querySelector('.b3-select[data-type="typeselect"]') as HTMLSelectElement;const notebookElement = element.querySelector('.b3-select[data-type="notebookselect"]') as HTMLSelectElement;- window.localStorage.setItem(Constants.LOCAL_HISTORYNOTEID, notebookElement.value);+ localStorage.setItem(Constants.LOCAL_HISTORYNOTEID, notebookElement.value);const docElement = element.querySelector('.history__text[data-type="docPanel"]');const assetElement = element.querySelector('.history__text[data-type="assetPanel"]');const mdElement = element.querySelector('.history__text[data-type="mdPanel"]') as HTMLTextAreaElement;diff --git a/app/src/util/mount.ts b/app/src/util/mount.tsindex 2f815b0e36..b19134382f 100644--- a/app/src/util/mount.ts+++ b/app/src/util/mount.ts@@ -25,7 +25,7 @@ export const newDailyNote = () => {});return;}- const localNotebookId = window.localStorage.getItem(Constants.LOCAL_DAILYNOTEID);+ const localNotebookId = localStorage.getItem(Constants.LOCAL_DAILYNOTEID);if (localNotebookId && getNotebookName(localNotebookId) && !isMobile()) {fetchPost("/api/filetree/createDailyNote", {notebook:localNotebookId,@@ -56,7 +56,7 @@ export const newDailyNote = () => {});btnsElement[1].addEventListener("click", () => {const notebook = selectElement.value;- window.localStorage.setItem(Constants.LOCAL_DAILYNOTEID, notebook);+ localStorage.setItem(Constants.LOCAL_DAILYNOTEID, notebook);fetchPost("/api/filetree/createDailyNote", {notebook,app: Constants.SIYUAN_APPID,diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 9fe3a35996..8ead248ec2 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -271,7 +271,7 @@ const initBar = () => {notebook: item.id,app: Constants.SIYUAN_APPID,});- window.localStorage.setItem(Constants.LOCAL_DAILYNOTEID, item.id);+ localStorage.setItem(Constants.LOCAL_DAILYNOTEID, item.id);}}).element);}