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

Vanessaa8a2fe852901
diff --git a/app/electron/main.js b/app/electron/main.js
index 1822fc7731..26b3b204f7 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -792,9 +792,7 @@ app.whenReady().then(() => {
ipcMain.on('siyuan-lock-screen', () => {
workspaces.forEach(item => {
- const currentURL = new URL(item.browserWindow.getURL())
- const server = getServer(currentURL.port)
- fetch(server + '/api/system/logoutAuth', {method: 'POST'})
+ item.browserWindow.webContents.send('siyuan-lock-screen')
})
})
diff --git a/app/src/dialog/processSystem.ts b/app/src/dialog/processSystem.ts
index af20f6adfe..5aa796a286 100644
--- a/app/src/dialog/processSystem.ts
+++ b/app/src/dialog/processSystem.ts
@@ -14,9 +14,7 @@ import {getWorkspaceName} from "../menus/workspace";
export const lockScreen = () => {
/// #if BROWSER
- fetchPost("/api/system/logoutAuth", {}, () => {
- window.location.href = "/";
- });
+ fetchPost("/api/system/logoutAuth", {});
/// #else
ipcRenderer.send(Constants.SIYUAN_LOCK_SCREEN);
/// #endif
diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.ts
index ffa8a172c4..48f110b407 100644
--- a/app/src/util/onGetConfig.ts
+++ b/app/src/util/onGetConfig.ts
@@ -347,6 +347,9 @@ const initWindow = () => {
}
});
});
+ ipcRenderer.on(Constants.SIYUAN_LOCK_SCREEN, () => {
+ fetchPost("/api/system/logoutAuth", {});
+ });
ipcRenderer.on(Constants.SIYUAN_SAVE_CLOSE, (event, close) => {
winOnClose(currentWindow, close);
});