An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:recycle: https://github.com/siyuan-note/siyuan/pull/9256
Vanessa449d2dbf87d8
diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 7b910bcc24..37b8dde94e 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -15,7 +15,7 @@ import {renderSnippet} from "../config/util/snippets";import {openFile, openFileById} from "../editor/util";import {focusByRange} from "../protyle/util/selection";import {exitSiYuan} from "../dialog/processSystem";-import {getSearch, isWindow, trimPrefix} from "../util/functions";+import {isWindow} from "../util/functions";import {initStatus} from "../layout/status";import {showMessage} from "../dialog/message";import {replaceLocalPath} from "../editor/rename";@@ -247,27 +247,27 @@ export const initWindow = async (app: App) => {});if (!isWindow()) {ipcRenderer.on(Constants.SIYUAN_OPEN_URL, (event, url) => {+ let urlObj: URL;try {- var urlObj = new URL(url);+ urlObj = new URL(url);if (urlObj.protocol !== "siyuan:") {return;}} catch (error) {return;}- if (urlObj.pathname.startsWith("//plugins/")) {- const pluginPathname = trimPrefix(urlObj.pathname, "//plugins/");- if (!pluginPathname) {+ if (urlObj && urlObj.pathname.startsWith("//plugins/")) {+ const pluginNameType = urlObj.pathname.replace("//plugins/", "");+ if (!pluginNameType) {return;}- const pluginId = pluginPathname.split("/")[0];- app.plugins.forEach(plugin => {- if (pluginPathname.startsWith(plugin.name)) {+ app.plugins.find(plugin => {+ if (pluginNameType.startsWith(plugin.name)) {// siyuan://plugins/plugin-name/foo?bar=bazplugin.eventBus.emit("open-siyuan-url-plugin", {url});// https://github.com/siyuan-note/siyuan/pull/9256- if (pluginId !== plugin.name) {+ if (pluginNameType.split("/")[0] !== plugin.name) {// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}let data = urlObj.searchParams.get("data");try {@@ -281,15 +281,16 @@ export const initWindow = async (app: App) => {title: urlObj.searchParams.get("title"),icon: urlObj.searchParams.get("icon"),data,- id: pluginPathname+ id: pluginNameType},});}+ return true;}});return;}- if (isSYProtocol(url)) {+ if (urlObj && isSYProtocol(url)) {const id = getIdFromSYProtocol(url);const focus = urlObj.searchParams.get("focus") === "1";fetchPost("/api/block/checkBlockExist", {id}, existResponse => {diff --git a/app/src/util/functions.ts b/app/src/util/functions.tsindex c3031732b9..0812607f86 100644--- a/app/src/util/functions.ts+++ b/app/src/util/functions.ts@@ -90,11 +90,3 @@ export const objEquals = (a: any, b: any): boolean => {if (keys.length !== Object.keys(b).length) return false;return keys.every(k => objEquals(a[k], b[k]));};--export const trimPrefix = (str: string, prefix: string) => {- return str.startsWith(prefix) ? str.slice(prefix.length) : str;-}--export const trimSuffix = (str: string, suffix: string) => {- return str.endsWith(suffix) ? str.slice(0, -suffix.length) : str;-}