diff --git a/package.json b/package.json index 1a77f15b3..6b59e302f 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "@sentry/electron": "^4.3.0", "auto-launch": "^5.0.5", "counterpart": "^0.18.6", + "electron-clear-data": "^1.0.5", "electron-store": "^8.0.2", "electron-window-state": "^5.0.3", "minimist": "^1.2.6", diff --git a/src/ipc.ts b/src/ipc.ts index 6eaf83dc2..762e7aa84 100644 --- a/src/ipc.ts +++ b/src/ipc.ts @@ -15,6 +15,7 @@ limitations under the License. */ import { app, autoUpdater, desktopCapturer, ipcMain, powerSaveBlocker } from "electron"; +import { relaunchApp } from "electron-clear-data"; import IpcMainEvent = Electron.IpcMainEvent; import { recordSSOSession } from "./protocol"; @@ -186,6 +187,13 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) { })); break; + case "clearStorage": + global.store.clear(); + global.mainWindow.webContents.session.flushStorageData(); + await global.mainWindow.webContents.session.clearStorageData(); + relaunchApp(); + break; + default: global.mainWindow.webContents.send("ipcReply", { id: payload.id, diff --git a/yarn.lock b/yarn.lock index e5d57991e..4a9388219 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4438,6 +4438,11 @@ electron-builder@^23.6.0: simple-update-notifier "^1.0.7" yargs "^17.5.1" +electron-clear-data@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/electron-clear-data/-/electron-clear-data-1.0.5.tgz#bc636f6850f57b1e8ed3fe2e57ca877e30d31bc9" + integrity sha512-vynYILZ2F+S5qnc81bnTOfh8uCVlxP6j42T7h/ELaDL+vxmlT1QNgte8KNuXb+s9ed+Qx4IIRbMRUcbAJa/8rA== + electron-devtools-installer@^3.1.1: version "3.2.0" resolved "https://registry.yarnpkg.com/electron-devtools-installer/-/electron-devtools-installer-3.2.0.tgz#acc48d24eb7033fe5af284a19667e73b78d406d0"