mirror of
https://github.com/upscayl/upscayl.git
synced 2025-01-20 01:32:49 +01:00
Fix overwrite
This commit is contained in:
parent
ae78378c42
commit
9e7c9c20d8
@ -28,11 +28,12 @@ const imageUpscayl = async (event, payload) => {
|
||||
console.log("No main window");
|
||||
return;
|
||||
}
|
||||
|
||||
setOverwrite(payload.overwrite);
|
||||
console.log({
|
||||
overwrite: payload.overwrite,
|
||||
});
|
||||
|
||||
setOverwrite(payload.overwrite);
|
||||
const model = payload.model as string;
|
||||
const gpuId = payload.gpuId as string;
|
||||
const saveImageAs = payload.saveImageAs as string;
|
||||
@ -71,17 +72,6 @@ const imageUpscayl = async (event, payload) => {
|
||||
"." +
|
||||
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
|
||||
if (fs.existsSync(outFile) && !overwrite) {
|
||||
// If already upscayled, just output that file
|
||||
|
@ -12,7 +12,7 @@ const ToggleOverwrite = ({ overwrite, setOverwrite }: ToggleOverwriteProps) => {
|
||||
} else {
|
||||
const currentlySavedOverwrite = localStorage.getItem("overwrite");
|
||||
if (currentlySavedOverwrite) {
|
||||
setOverwrite(JSON.parse(currentlySavedOverwrite));
|
||||
setOverwrite(currentlySavedOverwrite === "true");
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
@ -207,6 +207,16 @@ const Home = () => {
|
||||
const rememberOutputFolder = localStorage.getItem("rememberOutputFolder");
|
||||
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") {
|
||||
setOutputPath(lastOutputFolderPath);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user