diff --git a/app/electron/main.js b/app/electron/main.js index 1822fc773..26b3b204f 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 af20f6adf..5aa796a28 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 ffa8a172c..48f110b40 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); });