|
|
@@ -24,8 +24,8 @@ const createWindow = () => {
|
|
|
|
|
|
app.on('ready', () => {
|
|
|
const filter = {urls: ['file:///C:/api/*', 'file:///api/*']};
|
|
|
- const url = 'http://127.0.0.1:8014'
|
|
|
- //const url = 'http://192.168.0.125:8014'
|
|
|
+ //const url = 'http://127.0.0.1:8014'
|
|
|
+ const url = 'http://192.168.0.125:8014'
|
|
|
session.defaultSession.webRequest.onBeforeRequest(filter, (details, callback) => {
|
|
|
const val = details.url
|
|
|
let newUrl = val.replace('file:///api', url);
|
|
|
@@ -51,8 +51,22 @@ app.whenReady().then(() => {
|
|
|
});
|
|
|
})
|
|
|
|
|
|
-app.on('window-all-closed', () => {
|
|
|
- if (process.platform !== 'darwin') {
|
|
|
- app.quit()
|
|
|
+const clearDataAndExit = async () => {
|
|
|
+ try {
|
|
|
+ await session.defaultSession.clearCache();
|
|
|
+ await session.defaultSession.clearStorageData();
|
|
|
+ } catch (err) {
|
|
|
+ console.error('清除失败:', err);
|
|
|
+ } finally {
|
|
|
+ app.exit();
|
|
|
}
|
|
|
+};
|
|
|
+
|
|
|
+app.on('will-quit', (event) => {
|
|
|
+ event.preventDefault()
|
|
|
+ clearDataAndExit().then()
|
|
|
})
|
|
|
+
|
|
|
+app.on('window-all-closed', () => {
|
|
|
+ if (process.platform !== 'darwin') app.quit();
|
|
|
+});
|