mirror of
https://github.com/upscayl/upscayl.git
synced 2024-12-01 02:27:16 +01:00
Fix auto-updater and comments
This commit is contained in:
parent
80f6de55c3
commit
2cb905d262
25
electron/commands/auto-update.ts
Normal file
25
electron/commands/auto-update.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { MessageBoxOptions, dialog } from "electron";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
import logit from "../utils/logit";
|
||||
|
||||
const autoUpdate = (event) => {
|
||||
autoUpdater.autoInstallOnAppQuit = false;
|
||||
const dialogOpts: MessageBoxOptions = {
|
||||
type: "info",
|
||||
buttons: ["Install update", "No Thanks"],
|
||||
title: "New Upscayl Update",
|
||||
message: event.releaseName as string,
|
||||
detail:
|
||||
"A new version has been downloaded. Restart the application to apply the updates.",
|
||||
};
|
||||
logit("✅ Update Downloaded");
|
||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||
if (returnValue.response === 0) {
|
||||
autoUpdater.quitAndInstall();
|
||||
} else {
|
||||
logit("🚫 Update Installation Cancelled");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export default autoUpdate;
|
@ -1,14 +1,7 @@
|
||||
import prepareNext from "electron-next";
|
||||
import { autoUpdater } from "electron-updater";
|
||||
import log from "electron-log";
|
||||
import {
|
||||
app,
|
||||
ipcMain,
|
||||
dialog,
|
||||
MessageBoxOptions,
|
||||
protocol,
|
||||
net,
|
||||
} from "electron";
|
||||
import { app, ipcMain, protocol, net } from "electron";
|
||||
import COMMAND from "./constants/commands";
|
||||
import logit from "./utils/logit";
|
||||
import openFolder from "./commands/open-folder";
|
||||
@ -23,6 +16,7 @@ import electronIsDev from "electron-is-dev";
|
||||
import { execPath, modelsPath } from "./utils/get-resource-paths";
|
||||
import batchUpscayl from "./commands/batch-upscayl";
|
||||
import doubleUpscayl from "./commands/double-upscayl";
|
||||
import autoUpdate from "./commands/auto-update";
|
||||
|
||||
// INITIALIZATION
|
||||
log.initialize({ preload: true });
|
||||
@ -70,25 +64,4 @@ ipcMain.on(COMMAND.FOLDER_UPSCAYL, batchUpscayl);
|
||||
|
||||
ipcMain.on(COMMAND.DOUBLE_UPSCAYL, doubleUpscayl);
|
||||
|
||||
//------------------------Auto-Update Code-----------------------------//
|
||||
autoUpdater.autoInstallOnAppQuit = false;
|
||||
|
||||
autoUpdater.on("update-downloaded", (event) => {
|
||||
autoUpdater.autoInstallOnAppQuit = false;
|
||||
const dialogOpts: MessageBoxOptions = {
|
||||
type: "info",
|
||||
buttons: ["Install update", "No Thanks"],
|
||||
title: "New Upscayl Update",
|
||||
message: event.releaseName as string,
|
||||
detail:
|
||||
"A new version has been downloaded. Restart the application to apply the updates.",
|
||||
};
|
||||
logit("✅ Update Downloaded");
|
||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||
if (returnValue.response === 0) {
|
||||
autoUpdater.quitAndInstall();
|
||||
} else {
|
||||
logit("🚫 Update Installation Cancelled");
|
||||
}
|
||||
});
|
||||
});
|
||||
autoUpdater.on("update-downloaded", autoUpdate);
|
||||
|
@ -1,14 +1,14 @@
|
||||
/*
|
||||
appRootDir is the resources directory inside the unpacked electron app temp directory.
|
||||
resources contains app.asar file, that contains the main and renderer files.
|
||||
We're putting resources/{os}/bin from project inside resources/bin of electron. Same for the models directory as well.
|
||||
*/
|
||||
|
||||
import { join, dirname, resolve } from "path";
|
||||
import { getPlatform } from "./get-device-specs";
|
||||
import isDev from "electron-is-dev";
|
||||
import { app } from "electron";
|
||||
|
||||
/**
|
||||
* appRootDir is the resources directory inside the unpacked electron app temp directory.
|
||||
* resources contains app.asar file, that contains the main and renderer files.
|
||||
* We're putting resources/{os}/bin from project inside resources/bin of electron.
|
||||
* Same for the models directory as well.
|
||||
*/
|
||||
const appRootDir = app.getAppPath();
|
||||
|
||||
const binariesPath = isDev
|
||||
|
Loading…
Reference in New Issue
Block a user