Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/8441

Vanessa6994eda9c352
diff --git a/app/src/layout/Model.ts b/app/src/layout/Model.ts
index 0d29f8c74f..02499228d7 100644
--- a/app/src/layout/Model.ts
+++ b/app/src/layout/Model.ts
@@ -39,7 +39,6 @@ export class Model {
const websocketURL = `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
const ws = new WebSocket(`${websocketURL}?app=${Constants.SIYUAN_APPID}&id=${options.id}${options.type ? "&type=" + options.type : ""}`);
ws.onopen = () => {
- alert("onopen")
if (options.callback) {
options.callback.call(this);
}
@@ -62,7 +61,6 @@ export class Model {
}
};
ws.onclose = (ev) => {
- alert(ev.reason)
if (0 <= ev.reason.indexOf("unauthenticated")) {
return;
}
@@ -79,7 +77,6 @@ export class Model {
}
};
ws.onerror = (err: Event & { target: { url: string, readyState: number } }) => {
- alert("onerror")
if (err.target.url.endsWith("&type=main") && err.target.readyState === 3) {
kernelError();
}
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 13db8ce653..694be439c3 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -102,6 +102,13 @@ class App {
const siyuanApp = new App();
+// https://github.com/siyuan-note/siyuan/issues/8441
+window.reconnectWebSocket = () => {
+ window.siyuan.ws.ws.send("ping");
+ window.siyuan.mobile.files.ws.send("ping");
+ window.siyuan.mobile.editor.protyle.ws.ws.send("ping");
+ window.siyuan.mobile.popEditor.protyle.ws.ws.send("ping");
+};
window.goBack = goBack;
window.showKeyboardToolbar = (height) => {
document.getElementById("keyboardToolbar").setAttribute("data-keyboardheight", (height ? height : window.innerHeight / 2 - 42).toString());
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 27a2bd9a66..da11603400 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -51,6 +51,8 @@ interface Window {
goBack(): void
+ reconnectWebSocket(): void
+
showKeyboardToolbar(height: number): void
hideKeyboardToolbar(): void