mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-24 17:26:10 +01:00
This commit is contained in:
parent
558c2d3dc2
commit
9ca1f2792d
1 changed files with 29 additions and 0 deletions
29
app/src/window/onWindowsMsg.ts
Normal file
29
app/src/window/onWindowsMsg.ts
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue