diff --git a/electron/main.ts b/electron/main.ts index a0bf6ece3..9b8d42a92 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -39,7 +39,7 @@ const createMainWindow = () => { ipcMain.handle( "invokePluginFunc", - async (event, modulePath, method, ...args) => { + async (_event, modulePath, method, ...args) => { const module = join(app.getPath("userData"), "plugins", modulePath); return await import(/* webpackIgnore: true */ module) .then((plugin) => { @@ -70,24 +70,6 @@ const createMainWindow = () => { if (isDev) mainWindow.webContents.openDevTools(); }; -const migratePlugins = () => { - return new Promise((resolve) => { - if (store.get("migrated_version") !== app.getVersion()) { - console.log("start migration:", store.get("migrated_version")); - const userDataPath = app.getPath("userData"); - const fullPath = join(userDataPath, "plugins"); - - rmdir(fullPath, { recursive: true }, function (err) { - if (err) console.log(err); - store.set("migrated_version", app.getVersion()); - console.log("migrate plugins done"); - resolve(undefined); - }); - } else { - resolve(undefined); - } - }); -}; app .whenReady() @@ -218,6 +200,25 @@ app.on("window-all-closed", () => { } }); +function migratePlugins() { + return new Promise((resolve) => { + if (store.get("migrated_version") !== app.getVersion()) { + console.log("start migration:", store.get("migrated_version")); + const userDataPath = app.getPath("userData"); + const fullPath = join(userDataPath, "plugins"); + + rmdir(fullPath, { recursive: true }, function (err) { + if (err) console.log(err); + store.set("migrated_version", app.getVersion()); + console.log("migrate plugins done"); + resolve(undefined); + }); + } else { + resolve(undefined); + } + }); +}; + function setupPlugins() { init({ // Function to check from the main process that user wants to install a plugin