From 348950ab51e1cea4acc229b990444e2d6b26d3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=BB=E6=81=90=E9=BE=99?= Date: Mon, 1 Dec 2025 20:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=A7=A6=E5=8F=91open-siyuan-url-plugin=20#15892=20(#?= =?UTF-8?q?16465)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/util/compatibility.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts index f4eb968bc..85591494a 100644 --- a/app/src/protyle/util/compatibility.ts +++ b/app/src/protyle/util/compatibility.ts @@ -53,6 +53,33 @@ export const openByMobile = (uri: string) => { if (!uri) { return; } + //https://github.com/siyuan-note/siyuan/issues/15892 + if (uri.startsWith("siyuan://")) { + let urlObj: URL; + try { + urlObj = new URL(uri); + if (urlObj.protocol !== "siyuan:") { + return; + } + } catch (error) { + return; + } + if (urlObj && urlObj.hostname === "plugins") { + const pluginNameType = urlObj.pathname.split("/")[1]; + if (!pluginNameType) { + return; + } + window.siyuan.ws.app.plugins.find((plugin) => { + if (pluginNameType.startsWith(plugin.name)) { + // siyuan://plugins/plugin-name/foo?bar=baz + plugin.eventBus.emit("open-siyuan-url-plugin", { + url: uri + }); + } + }); + return; + } + } if (isInIOS()) { if (uri.startsWith("assets/")) { // iOS 16.7 之前的版本,uri 需要 encodeURIComponent