1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-28 01:10:52 +01:00

Remove execute javascript. TODO: Replace with alternative

This commit is contained in:
Feenix 2023-04-21 00:16:04 +05:30
parent c94ca01a42
commit 30d69c8a63

View File

@ -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];
}
});