An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessaac8748d1617e
diff --git a/app/src/config/account.ts b/app/src/config/account.tsindex 79e6a2a5c7..7f8fc1ed44 100644--- a/app/src/config/account.ts+++ b/app/src/config/account.ts@@ -203,7 +203,7 @@ ${window.siyuan.languages.account8}`;account.bindEvent(element);showMessage(window.siyuan.languages.refreshUser, 3000);account.onSetaccount();- processSync()+ processSync();});});element.querySelector("#logout").addEventListener("click", () => {@@ -213,7 +213,7 @@ ${window.siyuan.languages.account8}`;element.innerHTML = account.genHTML();account.bindEvent(element);account.onSetaccount();- processSync()+ processSync();});});});@@ -224,7 +224,7 @@ ${window.siyuan.languages.account8}`;element.innerHTML = account.genHTML();account.bindEvent(element);account.onSetaccount();- processSync()+ processSync();});});});@@ -372,7 +372,7 @@ ${window.siyuan.languages.account8}`;},_afterLogin(userResponse: IWebSocketData, element: Element) {window.siyuan.user = userResponse.data;- processSync()+ processSync();if (element.classList.contains("account") && !needSubscribe("")) {const dialogElement = hasClosestByClassName(element, "b3-dialog--open");if (dialogElement) {diff --git a/app/src/config/repos.ts b/app/src/config/repos.tsindex 7a665b472e..39c3a5f24a 100644--- a/app/src/config/repos.ts+++ b/app/src/config/repos.ts@@ -328,7 +328,7 @@ export const repos = {showMessage(window.siyuan.languages._kernel[123]);return;}- fetchPost("/api/sync/setSyncEnable", {enabled: switchElement.checked}, (response) => {+ fetchPost("/api/sync/setSyncEnable", {enabled: switchElement.checked}, () => {window.siyuan.config.sync.enabled = switchElement.checked;processSync();});diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.tsindex f13edec39e..7368236ade 100644--- a/app/src/dialog/processSystem.ts+++ b/app/src/dialog/processSystem.ts@@ -263,7 +263,7 @@ export const progressBackgroundTask = (tasks:{action:string}[]) => {backgroundTaskElement.setAttribute("data-tasks", JSON.stringify(tasks));backgroundTaskElement.innerHTML = tasks[0].action + "<div><div></div></div>";}-}+};export const bootSync = () => {fetchPost("/api/sync/getBootSync", {}, response => {@@ -335,31 +335,31 @@ export const downloadProgress = (data: { id: string, percent: number }) => {};export const processSync = (data?: IWebSocketData) => {- const iconElement = document.querySelector(isMobile()?"#menuSyncNow" : "#barSync")+ const iconElement = document.querySelector(isMobile()?"#menuSyncNow" : "#barSync");if (!iconElement) {return;}- const useElement = iconElement.querySelector("use")+ const useElement = iconElement.querySelector("use");if (!data) {if (!window.siyuan.config.sync.enabled || (0 === window.siyuan.config.sync.provider && needSubscribe(""))) {iconElement.classList.add("toolbar__item--active");iconElement.setAttribute("aria-label", window.siyuan.languages["_kernel"]["53"]);- useElement.setAttribute("xlink:href", "#iconCloudOff")+ useElement.setAttribute("xlink:href", "#iconCloudOff");} else {iconElement.classList.remove("toolbar__item--active");- useElement.setAttribute("xlink:href", "#iconCloudSucc")+ useElement.setAttribute("xlink:href", "#iconCloudSucc");}return;}if (data.code === 0) { // syncingiconElement.classList.add("toolbar__item--active");- useElement.setAttribute("xlink:href", "#iconCloudSync")+ useElement.setAttribute("xlink:href", "#iconCloudSync");} else if (data.code === 2) { // erroriconElement.classList.remove("toolbar__item--active");- useElement.setAttribute("xlink:href", "#iconCloudError")+ useElement.setAttribute("xlink:href", "#iconCloudError");} else if (data.code === 1) { // successiconElement.classList.remove("toolbar__item--active");- useElement.setAttribute("xlink:href", "#iconCloudSucc")+ useElement.setAttribute("xlink:href", "#iconCloudSucc");}iconElement.setAttribute("aria-label", data.msg);-}+};diff --git a/app/src/layout/status.ts b/app/src/layout/status.tsindex 5daba39645..ad11b2add9 100644--- a/app/src/layout/status.ts+++ b/app/src/layout/status.ts@@ -83,7 +83,7 @@ export const initStatus = () => {iconHTML: Constants.ZWSP,label: item.action}).element);- })+ });const rect = target.getBoundingClientRect();window.siyuan.menus.menu.popup({x: rect.right, y: rect.top}, true);event.stopPropagation();diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.tsindex a80e637780..0542caf6c8 100644--- a/app/src/menus/navigation.ts+++ b/app/src/menus/navigation.ts@@ -388,13 +388,13 @@ const genImportMenu = (notebookId: string, pathString: string) => {formData.append("notebook", notebookId);formData.append("toPath", pathString);fetchPost("/api/import/importSY", formData, () => {- let files+ let files;/// #if MOBILE- files = window.siyuan.mobile.files+ files = window.siyuan.mobile.files;/// #elsefiles = (getDockByType("file").data["file"] as Files);/// #endif- const liElement = files.element.querySelector(`[data-path="${pathString}"]`)+ const liElement = files.element.querySelector(`[data-path="${pathString}"]`);const toggleElement = liElement.querySelector(".b3-list-item__arrow--open");if (toggleElement) {toggleElement.classList.remove("b3-list-item__arrow--open");diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex 462796ba78..52f1abb02a 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -88,7 +88,7 @@ window.openFileByURL = (openURL) => {if (openURL && /^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(openURL)) {openMobileFileById(openURL.substr(16, 22),getSearch("focus", openURL) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);- return true+ return true;}- return false-}+ return false;+};diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.tsindex dfcf989f8f..1a0046d990 100644--- a/app/src/mobile/util/initFramework.ts+++ b/app/src/mobile/util/initFramework.ts@@ -132,7 +132,7 @@ export const initFramework = () => {mountHelp();}const transactionTipElement = document.getElementById("transactionTip");- transactionTipElement.innerHTML = `${window.siyuan.languages.waitSync} <button class="b3-button">${window.siyuan.languages.syncNow}</button>`+ transactionTipElement.innerHTML = `${window.siyuan.languages.waitSync} <button class="b3-button">${window.siyuan.languages.syncNow}</button>`;transactionTipElement.querySelector(".b3-button").addEventListener(getEventName(), () => {syncGuide();});@@ -162,7 +162,7 @@ export const initFramework = () => {});}});- return+ return;}setEmpty();};diff --git a/app/src/mobile/util/menu.ts b/app/src/mobile/util/menu.tsindex 134c1ac89f..5b7f35f1a6 100644--- a/app/src/mobile/util/menu.ts+++ b/app/src/mobile/util/menu.ts@@ -62,7 +62,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =window.siyuan.user = null;closePanel();document.getElementById("menuAccount").innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;- processSync()+ processSync();});});modelMainElement.querySelector("#deactivateUser").addEventListener(getEventName(), () => {@@ -71,7 +71,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =window.siyuan.user = null;closePanel();document.getElementById("menuAccount").innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;- processSync()+ processSync();});});});@@ -94,7 +94,7 @@ const showAccountInfo = (modelElement: HTMLElement, modelMainElement: Element) =} else {menuAccountElement.innerHTML = `<svg class="b3-list-item__graphic"><use xlink:href="#iconAccount"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.login}</span>`;}- processSync()+ processSync();});});};@@ -174,7 +174,7 @@ ${accountHTML}<svg class="b3-list-item__graphic"><use xlink:href="#iconQuit"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.safeQuit}</span></div>`;// 只能用 click,否则无法上下滚动 https://github.com/siyuan-note/siyuan/issues/6628- processSync()+ processSync();menuElement.addEventListener("click", (event) => {let target = event.target as HTMLElement;while (target && !target.isEqualNode(menuElement)) {@@ -669,7 +669,7 @@ ${accountHTML}closePanel();document.getElementById("menuAccount").innerHTML = `<img class="b3-list-item__graphic" src="${window.siyuan.user.userAvatarURL}"/><span class="b3-list-item__text">${window.siyuan.user.userName}</span>`;- processSync()+ processSync();});});});@@ -686,7 +686,7 @@ ${accountHTML}closePanel();document.getElementById("menuAccount").innerHTML = `<img class="b3-list-item__graphic" src="${window.siyuan.user.userAvatarURL}"/><span class="b3-list-item__text">${window.siyuan.user.userName}</span>`;- processSync()+ processSync();});});});diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.tsindex 04b748c547..114df050bb 100644--- a/app/src/mobile/util/onMessage.ts+++ b/app/src/mobile/util/onMessage.ts@@ -11,7 +11,7 @@ export const onMessage = (data: IWebSocketData) => {case"syncing":processSync(data);if (data.code !== 0) {- document.getElementById("transactionTip").classList.add("fn__none")+ document.getElementById("transactionTip").classList.add("fn__none");}break;case "create":diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.tsindex 6c8f5370e6..15f86e9f7d 100644--- a/app/src/protyle/export/util.ts+++ b/app/src/protyle/export/util.ts@@ -76,11 +76,11 @@ export const exportImage = (id: string) => {}, Constants.TIMEOUT_TRANSITION);});const previewElement = exportDialog.element.querySelector("#preview") as HTMLElement;- const foldElement = (exportDialog.element.querySelector("#keepFold") as HTMLInputElement)+ const foldElement = (exportDialog.element.querySelector("#keepFold") as HTMLInputElement);foldElement.addEventListener("change", () => {btnsElement[0].setAttribute("disabled", "disabled");btnsElement[1].setAttribute("disabled", "disabled");- btnsElement[1].parentElement.insertAdjacentHTML("afterend", `<div class="fn__loading"><img height="128px" width="128px" src="stage/loading-pure.svg"></div>`)+ btnsElement[1].parentElement.insertAdjacentHTML("afterend", "<div class=\"fn__loading\"><img height=\"128px\" width=\"128px\" src=\"stage/loading-pure.svg\"></div>");window.siyuan.storage[Constants.LOCAL_EXPORTIMG].keepFold = foldElement.checked;fetchPost("/api/export/exportPreviewHTML", {id,@@ -88,7 +88,7 @@ export const exportImage = (id: string) => {image: true,}, (response) => {refreshPreview(response);- })+ });});const refreshPreview = (response: IWebSocketData) => {previewElement.innerHTML = response.data.content;diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 0ed73e9787..afc81b16cb 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -77,7 +77,7 @@ const promiseTransaction = () => {/// #if MOBILEif ((0 !== window.siyuan.config.sync.provider || (0 === window.siyuan.config.sync.provider && !needSubscribe(""))) &&window.siyuan.config.repo.key && window.siyuan.config.sync.enabled) {- document.getElementById("transactionTip").classList.remove("fn__none")+ document.getElementById("transactionTip").classList.remove("fn__none");}/// #endifif (response.data[0].doOperations[0].action === "setAttrs") {diff --git a/app/src/sync/syncGuide.ts b/app/src/sync/syncGuide.tsindex d57dfa2b4c..bb20ffd8a2 100644--- a/app/src/sync/syncGuide.ts+++ b/app/src/sync/syncGuide.ts@@ -176,7 +176,7 @@ const setSync = (key?: string, dialog?: Dialog) => {});btnElement.addEventListener("click", () => {dialog.destroy();- fetchPost("/api/sync/setSyncEnable", {enabled: true}, (response) => {+ fetchPost("/api/sync/setSyncEnable", {enabled: true}, () => {window.siyuan.config.sync.enabled = true;processSync();confirmDialog(window.siyuan.languages.syncConfGuide4, window.siyuan.languages.syncConfGuide5, () => {diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 49a31957e2..2cfced36bb 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -18,7 +18,7 @@ import {addGA, initAssets, setInlineStyle, setMode} from "./assets";import {renderSnippet} from "../config/util/snippets";import {openFileById} from "../editor/util";import {focusByRange} from "../protyle/util/selection";-import {exitSiYuan, processSync, progressLoading} from "../dialog/processSystem";+import {exitSiYuan, processSync} from "../dialog/processSystem";import {openSetting} from "../config";import {getSearch} from "./functions";import {initStatus} from "../layout/status";