1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-20 09:42:48 +01:00

Fix overwrite

This commit is contained in:
Nayam Amarshe 2023-09-10 23:29:35 +05:30
parent ae78378c42
commit 9e7c9c20d8
3 changed files with 13 additions and 13 deletions

View File

@ -28,11 +28,12 @@ const imageUpscayl = async (event, payload) => {
console.log("No main window"); console.log("No main window");
return; return;
} }
setOverwrite(payload.overwrite);
console.log({ console.log({
overwrite: payload.overwrite, overwrite: payload.overwrite,
}); });
setOverwrite(payload.overwrite);
const model = payload.model as string; const model = payload.model as string;
const gpuId = payload.gpuId as string; const gpuId = payload.gpuId as string;
const saveImageAs = payload.saveImageAs as string; const saveImageAs = payload.saveImageAs as string;
@ -71,17 +72,6 @@ const imageUpscayl = async (event, payload) => {
"." + "." +
saveImageAs; saveImageAs;
// GET OVERWRITE SETTINGS FROM LOCAL STORAGE
mainWindow.webContents
.executeJavaScript('localStorage.getItem("overwrite");', true)
.then((lastSavedOverwrite: boolean | null) => {
if (lastSavedOverwrite !== null) {
console.log("Overwrite: ", lastSavedOverwrite);
setOverwrite(lastSavedOverwrite);
console.log("NEW OVERWRITE: ", overwrite);
}
});
// UPSCALE // UPSCALE
if (fs.existsSync(outFile) && !overwrite) { if (fs.existsSync(outFile) && !overwrite) {
// If already upscayled, just output that file // If already upscayled, just output that file

View File

@ -12,7 +12,7 @@ const ToggleOverwrite = ({ overwrite, setOverwrite }: ToggleOverwriteProps) => {
} else { } else {
const currentlySavedOverwrite = localStorage.getItem("overwrite"); const currentlySavedOverwrite = localStorage.getItem("overwrite");
if (currentlySavedOverwrite) { if (currentlySavedOverwrite) {
setOverwrite(JSON.parse(currentlySavedOverwrite)); setOverwrite(currentlySavedOverwrite === "true");
} }
} }
}, []); }, []);

View File

@ -207,6 +207,16 @@ const Home = () => {
const rememberOutputFolder = localStorage.getItem("rememberOutputFolder"); const rememberOutputFolder = localStorage.getItem("rememberOutputFolder");
const lastOutputFolderPath = localStorage.getItem("lastOutputFolderPath"); const lastOutputFolderPath = localStorage.getItem("lastOutputFolderPath");
// GET OVERWRITE
if (!localStorage.getItem("overwrite")) {
localStorage.setItem("overwrite", JSON.stringify(overwrite));
} else {
const currentlySavedOverwrite = localStorage.getItem("overwrite");
if (currentlySavedOverwrite) {
setOverwrite(currentlySavedOverwrite === "true");
}
}
if (rememberOutputFolder === "true") { if (rememberOutputFolder === "true") {
setOutputPath(lastOutputFolderPath); setOutputPath(lastOutputFolderPath);
} else { } else {