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/7500

Vanessa9ca1f2792da2
diff --git a/app/src/window/onWindowsMsg.ts b/app/src/window/onWindowsMsg.ts
new file mode 100644
index 0000000000..28d940bc83
--- /dev/null
+++ b/app/src/window/onWindowsMsg.ts
@@ -0,0 +1,29 @@
+import {exportLayout, getInstanceById} from "../layout/util";
+import {Tab} from "../layout/Tab";
+import {fetchPost} from "../util/fetch";
+import {isWindow} from "../util/functions";
+
+const closeTab = (ipcData:IWebSocketData) => {
+ const tab = getInstanceById(ipcData.data);
+ if (tab && tab instanceof Tab) {
+ tab.parent.removeTab(ipcData.data);
+ }
+}
+export const onWindowsMsg = (ipcData:IWebSocketData) => {
+ switch (ipcData.cmd) {
+ case "closetab":
+ closeTab(ipcData)
+ break;
+ case "lockscreen":
+ if (isWindow()) {
+ window.location.href = `/check-auth?url=${window.location.href}`;
+ } else {
+ exportLayout(false, () => {
+ fetchPost("/api/system/logoutAuth", {}, () => {
+ window.location.href = `/check-auth?url=${window.location.href}`;
+ });
+ });
+ }
+ break;
+ }
+}