From 30d69c8a6364174aa6862dccdd2f487f88cab306 Mon Sep 17 00:00:00 2001 From: Feenix <25067102+NayamAmarshe@users.noreply.github.com> Date: Fri, 21 Apr 2023 00:16:04 +0530 Subject: [PATCH] Remove execute javascript. TODO: Replace with alternative --- electron/index.ts | 102 +++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/electron/index.ts b/electron/index.ts index 19e4500..c9a0d53 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -80,44 +80,44 @@ app.on("ready", async () => { autoUpdater.checkForUpdates(); } - // SAVE LAST IMAGE PATH TO LOCAL STORAGE - mainWindow.webContents - .executeJavaScript('localStorage.getItem("lastImagePath");', true) - .then((lastImagePath: string | null) => { - if (lastImagePath && lastImagePath.length > 0) { - imagePath = lastImagePath; - } - }); + // // SAVE LAST IMAGE PATH TO LOCAL STORAGE + // mainWindow.webContents + // .executeJavaScript('localStorage.getItem("lastImagePath");', true) + // .then((lastImagePath: string | null) => { + // if (lastImagePath && lastImagePath.length > 0) { + // imagePath = lastImagePath; + // } + // }); - // SAVE LAST FOLDER PATH TO LOCAL STORAGE - mainWindow.webContents - .executeJavaScript('localStorage.getItem("lastFolderPath");', true) - .then((lastFolderPath: string | null) => { - if (lastFolderPath && lastFolderPath.length > 0) { - folderPath = lastFolderPath; - } - }); + // // SAVE LAST FOLDER PATH TO LOCAL STORAGE + // mainWindow.webContents + // .executeJavaScript('localStorage.getItem("lastFolderPath");', true) + // .then((lastFolderPath: string | null) => { + // if (lastFolderPath && lastFolderPath.length > 0) { + // folderPath = lastFolderPath; + // } + // }); - // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE - mainWindow.webContents - .executeJavaScript( - 'localStorage.getItem("lastCustomModelsFolderPath");', - true - ) - .then((lastCustomModelsFolderPath: string | null) => { - if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) { - customModelsFolderPath = lastCustomModelsFolderPath; - } - }); + // // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE + // mainWindow.webContents + // .executeJavaScript( + // 'localStorage.getItem("lastCustomModelsFolderPath");', + // true + // ) + // .then((lastCustomModelsFolderPath: string | null) => { + // if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) { + // customModelsFolderPath = lastCustomModelsFolderPath; + // } + // }); - // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE - mainWindow.webContents - .executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true) - .then((lastOutputFolderPath: string | null) => { - if (lastOutputFolderPath && lastOutputFolderPath.length > 0) { - outputFolderPath = lastOutputFolderPath; - } - }); + // // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE + // mainWindow.webContents + // .executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true) + // .then((lastOutputFolderPath: string | null) => { + // if (lastOutputFolderPath && lastOutputFolderPath.length > 0) { + // outputFolderPath = lastOutputFolderPath; + // } + // }); }); // Quit the app once all windows are closed @@ -161,14 +161,14 @@ ipcMain.handle(commands.SELECT_FILE, async () => { logit("Selected File Path: ", filePaths[0]); imagePath = filePaths[0]; - mainWindow.webContents - .executeJavaScript( - `localStorage.setItem("lastImagePath", "${imagePath}");`, - true - ) - .then(() => { - logit(`Saved Last Image Path (${imagePath}) to Local Storage`); - }); + // mainWindow.webContents + // .executeJavaScript( + // `localStorage.setItem("lastImagePath", "${imagePath}");`, + // true + // ) + // .then(() => { + // logit(`Saved Last Image Path (${imagePath}) to Local Storage`); + // }); let isValid = false; // READ SELECTED FILES @@ -215,14 +215,14 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => { } else { logit("Selected Folder Path: ", folderPaths[0]); folderPath = folderPaths[0]; - mainWindow.webContents - .executeJavaScript( - `localStorage.setItem("lastImagePath", "${folderPath}");`, - true - ) - .then(() => { - logit(`Saved Last Image Path (${folderPath}) to Local Storage`); - }); + // mainWindow.webContents + // .executeJavaScript( + // `localStorage.setItem("lastImagePath", "${folderPath}");`, + // true + // ) + // .then(() => { + // logit(`Saved Last Image Path (${folderPath}) to Local Storage`); + // }); return folderPaths[0]; } });