mirror of
https://github.com/upscayl/upscayl.git
synced 2025-01-20 09:42:48 +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");
|
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
|
||||||
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user