Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

✨移动端支持触发open-siyuan-url-plugin #15892 (#16465)

养恐龙348950ab51e1
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index f4eb968bc7..85591494a1 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