From ef31d27ba26921bd5ed058c506b6cc5a664666ad Mon Sep 17 00:00:00 2001 From: Totemancer Date: Wed, 9 Oct 2024 17:25:55 +0200 Subject: [PATCH 1/2] autoUpdater Improvements Added dynamic version to the feedURL to prevent unnecessary auto updates. --- apps/desktop/src/electron/autoUpdate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/electron/autoUpdate.ts b/apps/desktop/src/electron/autoUpdate.ts index 990dd690e..0e7da35f2 100644 --- a/apps/desktop/src/electron/autoUpdate.ts +++ b/apps/desktop/src/electron/autoUpdate.ts @@ -1,4 +1,4 @@ -import { autoUpdater, BrowserWindow, webContents } from 'electron'; +import { app, autoUpdater, BrowserWindow, webContents } from 'electron'; export default class AppUpdate { constructor() { @@ -25,7 +25,8 @@ export default class AppUpdate { notify('Tonkeeper Pro is up to date', `Version 123`); //${releaseName}`); }); - const feedURL = 'https://update.electronjs.org/tonkeeper/tonkeeper-web/darwin-arm64/3.17.2'; + const appVersion = app.getVersion(); // Get the app version dynamically + const feedURL = `https://update.electronjs.org/tonkeeper/tonkeeper-web/darwin-arm64/${appVersion}`; autoUpdater.setFeedURL({ url: feedURL }); } From c0a79bb44154cd743a68f76048f0702c3fc3ac87 Mon Sep 17 00:00:00 2001 From: Totemancer Date: Wed, 9 Oct 2024 17:34:56 +0200 Subject: [PATCH 2/2] Update autoUpdate with arch, platform --- apps/desktop/src/electron/autoUpdate.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/electron/autoUpdate.ts b/apps/desktop/src/electron/autoUpdate.ts index 0e7da35f2..ece9f464d 100644 --- a/apps/desktop/src/electron/autoUpdate.ts +++ b/apps/desktop/src/electron/autoUpdate.ts @@ -14,6 +14,11 @@ export default class AppUpdate { ); } ); + + const appVersion = app.getVersion(); // Get the app version dynamically + const platform = process.platform; // Get the platform dynamically (e.g., 'darwin', 'win32') + const arch = process.arch; // Get the architecture dynamically (e.g., 'arm64', 'x64') + autoUpdater.addListener('error', function (error) { console.log(error); }); @@ -22,11 +27,11 @@ export default class AppUpdate { }); autoUpdater.addListener('update-not-available', function (event: any) { - notify('Tonkeeper Pro is up to date', `Version 123`); //${releaseName}`); + notify('Tonkeeper Pro is up to date', `Version ${releaseName}`); }); - const appVersion = app.getVersion(); // Get the app version dynamically - const feedURL = `https://update.electronjs.org/tonkeeper/tonkeeper-web/darwin-arm64/${appVersion}`; + // Build the feed URL + const feedURL = `https://update.electronjs.org/tonkeeper/tonkeeper-web/${platform}-${arch}/${appVersion}`; autoUpdater.setFeedURL({ url: feedURL }); }