diff --git a/electron.json b/electron.json index bc9def5..c2f017c 100644 --- a/electron.json +++ b/electron.json @@ -7,12 +7,6 @@ "buildResources": "assets/resources", "output": "dist" }, - "extraFiles": [ - { - "from": "assets/scripts", - "to": "." - } - ], "files": [ "!**/.*", "!{electron.json,webpack.config.js,tsconfig.json}", @@ -43,7 +37,7 @@ ] }, "appImage": { - "artifactName": "${productName}-${version}-${env.ELECTRON_BUILDER_ARCHITECTURE}.${ext}" + "artifactName": "${productName}-${version}-${arch}.${ext}" }, "rpm": { "depends": ["util-linux"] diff --git a/electron/main.js b/electron/main.js index bc43148..88178f9 100644 --- a/electron/main.js +++ b/electron/main.js @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path'); -const { app, BrowserWindow, nativeImage, ipcMain } = require('electron'); +const { app, ipcMain, BrowserWindow, nativeImage, session } = require('electron'); const meow = require('meow'); const { squirrel } = require('./squirrel'); const { createWindow } = require('./window'); @@ -78,9 +78,13 @@ if (squirrel(cli.flags, app.quit)) { } }); - ipcMain.handle('close', () => mainWindow?.close()); - ipcMain.handle('clear-cache', () => { - mainWindow?.webContents.session.clearStorageData({ + ipcMain.handle('relaunch', () => { + app.relaunch(); + app.quit(); + }); + ipcMain.handle('clear-cache', async () => { + await session.defaultSession.clearCache(); + await session.defaultSession.clearStorageData({ storages: ['appcache', 'serviceworkers', 'cachestorage'] }); }); diff --git a/electron/preload.js b/electron/preload.js index c44971d..bdbe116 100644 --- a/electron/preload.js +++ b/electron/preload.js @@ -3,6 +3,6 @@ const { contextBridge, ipcRenderer } = require('electron'); contextBridge.exposeInMainWorld('electron', { version: process.versions.electron, - close: () => ipcRenderer.invoke('close'), + relaunch: () => ipcRenderer.invoke('relaunch'), clearCache: () => ipcRenderer.invoke('clear-cache'), }); diff --git a/electron/window.js b/electron/window.js index 0a531c0..94de6d9 100644 --- a/electron/window.js +++ b/electron/window.js @@ -3,7 +3,7 @@ const path = require('path'); const { BrowserWindow } = require('electron'); const WindowState = require('electron-window-state'); -const minBounds = { w: 1152, h: 690 }; +const minBounds = { w: 1152, h: 720 }; const createWindow = (title, devTools) => { const windowState = WindowState({ diff --git a/src/global.d.ts b/src/global.d.ts index 826950c..ac7a2cd 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1,7 +1,7 @@ declare interface Window { electron?: { version: string; - close: () => void; + relaunch: () => void; clearCache: () => void; }; } diff --git a/src/tracker/controls.ts b/src/tracker/controls.ts index 3f7a24e..5e42b5f 100644 --- a/src/tracker/controls.ts +++ b/src/tracker/controls.ts @@ -210,9 +210,9 @@ Tracker.prototype.onCmdAppUpdate = function() { document.body.className = 'loading'; this.destroying = true; + window.electron?.clearCache(); setTimeout(() => { - window.electron?.clearCache(); - window.electron?.close(); + window.electron?.relaunch(); }, 1024); } }