mirror of
https://github.com/upscayl/upscayl.git
synced 2024-11-13 18:30:54 +01:00
localStorage problems initial fixes
This commit is contained in:
parent
30d69c8a63
commit
9ebc802718
@ -80,44 +80,44 @@ app.on("ready", async () => {
|
|||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
// // SAVE LAST IMAGE PATH TO LOCAL STORAGE
|
// SAVE LAST IMAGE PATH TO LOCAL STORAGE
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript('localStorage.getItem("lastImagePath");', true)
|
.executeJavaScript('localStorage.getItem("lastImagePath");', true)
|
||||||
// .then((lastImagePath: string | null) => {
|
.then((lastImagePath: string | null) => {
|
||||||
// if (lastImagePath && lastImagePath.length > 0) {
|
if (lastImagePath && lastImagePath.length > 0) {
|
||||||
// imagePath = lastImagePath;
|
imagePath = lastImagePath;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// // SAVE LAST FOLDER PATH TO LOCAL STORAGE
|
// SAVE LAST FOLDER PATH TO LOCAL STORAGE
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript('localStorage.getItem("lastFolderPath");', true)
|
.executeJavaScript('localStorage.getItem("lastFolderPath");', true)
|
||||||
// .then((lastFolderPath: string | null) => {
|
.then((lastFolderPath: string | null) => {
|
||||||
// if (lastFolderPath && lastFolderPath.length > 0) {
|
if (lastFolderPath && lastFolderPath.length > 0) {
|
||||||
// folderPath = lastFolderPath;
|
folderPath = lastFolderPath;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
// SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript(
|
.executeJavaScript(
|
||||||
// 'localStorage.getItem("lastCustomModelsFolderPath");',
|
'localStorage.getItem("lastCustomModelsFolderPath");',
|
||||||
// true
|
true
|
||||||
// )
|
)
|
||||||
// .then((lastCustomModelsFolderPath: string | null) => {
|
.then((lastCustomModelsFolderPath: string | null) => {
|
||||||
// if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) {
|
if (lastCustomModelsFolderPath && lastCustomModelsFolderPath.length > 0) {
|
||||||
// customModelsFolderPath = lastCustomModelsFolderPath;
|
customModelsFolderPath = lastCustomModelsFolderPath;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|
||||||
// // SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
// SAVE LAST CUSTOM MODELS FOLDER PATH TO LOCAL STORAGE
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true)
|
.executeJavaScript('localStorage.getItem("lastOutputFolderPath");', true)
|
||||||
// .then((lastOutputFolderPath: string | null) => {
|
.then((lastOutputFolderPath: string | null) => {
|
||||||
// if (lastOutputFolderPath && lastOutputFolderPath.length > 0) {
|
if (lastOutputFolderPath && lastOutputFolderPath.length > 0) {
|
||||||
// outputFolderPath = lastOutputFolderPath;
|
outputFolderPath = lastOutputFolderPath;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Quit the app once all windows are closed
|
// Quit the app once all windows are closed
|
||||||
@ -161,14 +161,14 @@ ipcMain.handle(commands.SELECT_FILE, async () => {
|
|||||||
logit("Selected File Path: ", filePaths[0]);
|
logit("Selected File Path: ", filePaths[0]);
|
||||||
|
|
||||||
imagePath = filePaths[0];
|
imagePath = filePaths[0];
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript(
|
.executeJavaScript(
|
||||||
// `localStorage.setItem("lastImagePath", "${imagePath}");`,
|
`localStorage.setItem("lastImagePath", "${imagePath}");`,
|
||||||
// true
|
true
|
||||||
// )
|
)
|
||||||
// .then(() => {
|
.then(() => {
|
||||||
// logit(`Saved Last Image Path (${imagePath}) to Local Storage`);
|
logit(`Saved Last Image Path (${imagePath}) to Local Storage`);
|
||||||
// });
|
});
|
||||||
|
|
||||||
let isValid = false;
|
let isValid = false;
|
||||||
// READ SELECTED FILES
|
// READ SELECTED FILES
|
||||||
@ -215,14 +215,14 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => {
|
|||||||
} else {
|
} else {
|
||||||
logit("Selected Folder Path: ", folderPaths[0]);
|
logit("Selected Folder Path: ", folderPaths[0]);
|
||||||
folderPath = folderPaths[0];
|
folderPath = folderPaths[0];
|
||||||
// mainWindow.webContents
|
mainWindow.webContents
|
||||||
// .executeJavaScript(
|
.executeJavaScript(
|
||||||
// `localStorage.setItem("lastImagePath", "${folderPath}");`,
|
`localStorage.setItem("lastFolderPath", "${folderPath}");`,
|
||||||
// true
|
true
|
||||||
// )
|
)
|
||||||
// .then(() => {
|
.then(() => {
|
||||||
// logit(`Saved Last Image Path (${folderPath}) to Local Storage`);
|
logit(`Saved Last Folder Path (${folderPath}) to Local Storage`);
|
||||||
// });
|
});
|
||||||
return folderPaths[0];
|
return folderPaths[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -442,7 +442,7 @@ ipcMain.on(commands.UPSCAYL, async (event, payload) => {
|
|||||||
const gpuId = payload.gpuId as string;
|
const gpuId = payload.gpuId as string;
|
||||||
const saveImageAs = payload.saveImageAs as string;
|
const saveImageAs = payload.saveImageAs as string;
|
||||||
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "") as string;
|
let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "") as string;
|
||||||
let outputDir = payload.outputPath as string;
|
let outputDir = folderPath || payload.outputPath as string;
|
||||||
|
|
||||||
const isDefaultModel = defaultModels.includes(model);
|
const isDefaultModel = defaultModels.includes(model);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user