mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
♻️ 内核退出
This commit is contained in:
parent
91786010d3
commit
73263ca128
6 changed files with 11 additions and 8 deletions
|
|
@ -310,7 +310,7 @@ export const about = {
|
||||||
fetchPost("/api/system/setNetworkServe", {networkServe: networkServeElement.checked}, () => {
|
fetchPost("/api/system/setNetworkServe", {networkServe: networkServeElement.checked}, () => {
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
exitSiYuan();
|
exitSiYuan();
|
||||||
});
|
}, false, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const googleAnalyticsElement = about.element.querySelector("#googleAnalytics") as HTMLInputElement;
|
const googleAnalyticsElement = about.element.querySelector("#googleAnalytics") as HTMLInputElement;
|
||||||
|
|
@ -324,7 +324,7 @@ export const about = {
|
||||||
fetchPost("/api/system/setUploadErrLog", {uploadErrLog: uploadErrLogElement.checked}, () => {
|
fetchPost("/api/system/setUploadErrLog", {uploadErrLog: uploadErrLogElement.checked}, () => {
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
exitSiYuan();
|
exitSiYuan();
|
||||||
});
|
}, false, true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const downloadInstallPkgElement = about.element.querySelector("#downloadInstallPkg") as HTMLInputElement;
|
const downloadInstallPkgElement = about.element.querySelector("#downloadInstallPkg") as HTMLInputElement;
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ export const transactionError = (data: { code: number, data: string }) => {
|
||||||
/// #else
|
/// #else
|
||||||
exportLayout(false, () => {
|
exportLayout(false, () => {
|
||||||
exitSiYuan();
|
exitSiYuan();
|
||||||
});
|
}, false, true);
|
||||||
/// #endif
|
/// #endif
|
||||||
});
|
});
|
||||||
btnsElement[1].addEventListener("click", () => {
|
btnsElement[1].addEventListener("click", () => {
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export const resetLayout = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const exportLayout = (reload: boolean, cb?: () => void, onlyData = false) => {
|
export const exportLayout = (reload: boolean, cb?: () => void, onlyData = false, errorExit = false) => {
|
||||||
const useElement = document.querySelector("#barDock use");
|
const useElement = document.querySelector("#barDock use");
|
||||||
if (!useElement) {
|
if (!useElement) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -161,7 +161,10 @@ export const exportLayout = (reload: boolean, cb?: () => void, onlyData = false)
|
||||||
if (onlyData) {
|
if (onlyData) {
|
||||||
return layoutJSON;
|
return layoutJSON;
|
||||||
}
|
}
|
||||||
fetchPost("/api/system/setUILayout", {layout: layoutJSON}, () => {
|
fetchPost("/api/system/setUILayout", {
|
||||||
|
layout: layoutJSON,
|
||||||
|
errorExit // 后台不接受该参数,用于请求发生错误时退出程序
|
||||||
|
}, () => {
|
||||||
if (reload) {
|
if (reload) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else if (cb) {
|
} else if (cb) {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
|
||||||
}
|
}
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
if (url === "/api/system/exit" || url === "/api/system/setWorkspaceDir" || (
|
if (url === "/api/system/exit" || url === "/api/system/setWorkspaceDir" || (
|
||||||
["/api/system/setUILayout"].includes(url) && data.exit // 内核中断,点关闭处理
|
["/api/system/setUILayout"].includes(url) && data.errorExit // 内核中断,点关闭处理
|
||||||
)) {
|
)) {
|
||||||
ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);
|
ipcRenderer.send(Constants.SIYUAN_QUIT, getCurrentWindow().id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ const winOnClose = (currentWindow: Electron.BrowserWindow, close = false) => {
|
||||||
} else {
|
} else {
|
||||||
exitSiYuan();
|
exitSiYuan();
|
||||||
}
|
}
|
||||||
});
|
}, false, true);
|
||||||
/// #endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export const onWindowsMsg = (ipcData: IWebSocketData) => {
|
||||||
fetchPost("/api/system/logoutAuth", {}, () => {
|
fetchPost("/api/system/logoutAuth", {}, () => {
|
||||||
window.location.href = `/check-auth?url=${window.location.href}`;
|
window.location.href = `/check-auth?url=${window.location.href}`;
|
||||||
});
|
});
|
||||||
});
|
}, false, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue