diff --git a/launcher/public/animation/launcher-update/update-loading-modal.gif b/launcher/public/animation/launcher-update/update-loading-modal.gif new file mode 100644 index 000000000..9f21adb06 Binary files /dev/null and b/launcher/public/animation/launcher-update/update-loading-modal.gif differ diff --git a/launcher/public/output.css b/launcher/public/output.css index 6ad9d34d7..187d9c36d 100755 --- a/launcher/public/output.css +++ b/launcher/public/output.css @@ -1091,6 +1091,10 @@ video { grid-column-start: 14; } +.col-start-16{ + grid-column-start: 16; +} + .col-start-17{ grid-column-start: 17; } @@ -1539,6 +1543,10 @@ video { margin-top: 1rem; } +.mt-40{ + margin-top: 10rem; +} + .mt-5{ margin-top: 1.25rem; } @@ -1612,6 +1620,10 @@ video { height: 33.333333%; } +.h-1\/6{ + height: 16.666667%; +} + .h-10{ height: 2.5rem; } @@ -1656,6 +1668,10 @@ video { height: 75%; } +.h-3\/6{ + height: 50%; +} + .h-32{ height: 8rem; } @@ -2106,6 +2122,10 @@ video { width: 66.666667%; } +.w-2\/4{ + width: 50%; +} + .w-20{ width: 5rem; } @@ -3865,6 +3885,11 @@ video { background-color: rgb(96 152 121 / var(--tw-bg-opacity)); } +.bg-\[\#70E763\]{ + --tw-bg-opacity: 1; + background-color: rgb(112 231 99 / var(--tw-bg-opacity)); +} + .bg-\[\#A0A0A0\]{ --tw-bg-opacity: 1; background-color: rgb(160 160 160 / var(--tw-bg-opacity)); @@ -3875,6 +3900,11 @@ video { background-color: rgb(209 187 158 / var(--tw-bg-opacity)); } +.bg-\[\#EB5353\]{ + --tw-bg-opacity: 1; + background-color: rgb(235 83 83 / var(--tw-bg-opacity)); +} + .bg-\[\#F7C566\]{ --tw-bg-opacity: 1; background-color: rgb(247 197 102 / var(--tw-bg-opacity)); diff --git a/launcher/src/StereumUpdater.js b/launcher/src/StereumUpdater.js index 0c28a60e0..0acb3fe0f 100644 --- a/launcher/src/StereumUpdater.js +++ b/launcher/src/StereumUpdater.js @@ -7,6 +7,7 @@ export class StereumUpdater { this.updateWindow = null; this.logger = logger; this.createWindow = createWindow; + this.newVersion = null; } checkForUpdates() { @@ -14,15 +15,21 @@ export class StereumUpdater { this.updater.checkForUpdates(); } + getNewLauncherVersion() { + return this.newVersion; + } + initUpdater() { this.updater.logger = this.logger; this.updater.logger.transports.file.level = "debug"; + this.updater.autoDownload = false; this.updater.on("checking-for-update", () => { this.logger.info("Stereum is checking for updates."); }); - this.updater.on("update-available", async () => { + this.updater.on("update-available", async (data) => { + this.newVersion = data.version; this.updateWindow = await this.createWindow("update"); if (this.updateWindow) this.updateWindow.webContents.send("UpdateEvents", { message: "Update available.", type: "available" }); this.logger.info("Update available."); @@ -48,6 +55,7 @@ export class StereumUpdater { app.showExitPrompt = false; if (this.updateWindow) this.updateWindow.webContents.send("UpdateEvents", { message: "Update downloaded. " + data.version, type: "downloaded" }); + this.newVersion = null; this.updater.quitAndInstall(); this.logger.info("Update downloaded.", data); }); @@ -63,6 +71,18 @@ export class StereumUpdater { }); } + async downloadUpdate() { + this.updater.downloadUpdate(); + this.logger.info("Downloading update..."); + } + + async ignoreUpdate(win) { + app.showExitPrompt = false; + await win.close(); + this.createWindow(); + this.logger.info("Update ignored."); + } + async runDebug() { async function Sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/launcher/src/background.js b/launcher/src/background.js index f57b0f88e..4ba2278df 100755 --- a/launcher/src/background.js +++ b/launcher/src/background.js @@ -752,6 +752,18 @@ ipcMain.handle("fetchCsmAlerts", async () => { return await monitoring.fetchCsmAlerts(); }); +ipcMain.handle("ignoreUpdate", async (event) => { + return await stereumUpdater.ignoreUpdate(event.sender); +}); + +ipcMain.handle("updateLauncher", async () => { + return stereumUpdater.downloadUpdate(); +}); + +ipcMain.handle("getNewLauncherVersion", async () => { + return stereumUpdater.getNewLauncherVersion(); +}); + // Scheme must be registered before the app is ready protocol.registerSchemesAsPrivileged([{ scheme: "app", privileges: { secure: true, standard: true } }]); diff --git a/launcher/src/components/UI/server-management/components/modals/UpdateModal.vue b/launcher/src/components/UI/server-management/components/modals/UpdateModal.vue new file mode 100644 index 000000000..34b84ba3a --- /dev/null +++ b/launcher/src/components/UI/server-management/components/modals/UpdateModal.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/launcher/src/languages/en.json b/launcher/src/languages/en.json index 508ef5865..c3ffbd090 100755 --- a/launcher/src/languages/en.json +++ b/launcher/src/languages/en.json @@ -1058,5 +1058,12 @@ }, "otpModal": { "newPass": "Type in your new Password" + }, + "updateModal": { + "updateTitle": "Update {version} available", + "updateQ": "Do you want to update now?", + "acc": "accept", + "deny": "deny", + "updateTo": "Updating Stereum Launcher to {version}" } } diff --git a/launcher/src/pages/UpdateHandler.vue b/launcher/src/pages/UpdateHandler.vue index 03dafe881..2a8b41ca5 100644 --- a/launcher/src/pages/UpdateHandler.vue +++ b/launcher/src/pages/UpdateHandler.vue @@ -1,64 +1,71 @@ - - diff --git a/launcher/src/store/ControlService.js b/launcher/src/store/ControlService.js index 60cfc7a80..cc59f2a25 100755 --- a/launcher/src/store/ControlService.js +++ b/launcher/src/store/ControlService.js @@ -686,6 +686,18 @@ class ControlService extends EventEmitter { async fetchCsmAlerts() { return this.promiseIpc.send("fetchCsmAlerts"); } + + async ignoreUpdate() { + return this.promiseIpc.send("ignoreUpdate"); + } + + async updateLauncher() { + return this.promiseIpc.send("updateLauncher"); + } + + async getNewLauncherVersion() { + return this.promiseIpc.send("getNewLauncherVersion"); + } } if (!instance) { instance = new ControlService(window.electron); diff --git a/launcher/src/store/servers.js b/launcher/src/store/servers.js index 8dae56420..698641308 100644 --- a/launcher/src/store/servers.js +++ b/launcher/src/store/servers.js @@ -35,6 +35,7 @@ export const useServers = defineStore("servers", { isRemoveModalActive: false, isRemoveProcessing: false, selectedAvatar: null, + updateHandlerModal: true, avatars: [ { id: 1, img: "/avatar/server_selection_1.png" },