From 3b109f761283d1aac5f4ff26462bd4f77ff83155 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Jan 2017 13:16:08 +0000 Subject: [PATCH 1/2] Include current version in update check explicitly Hopefully fix https://github.com/vector-im/riot-web/issues/2847 --- electron/src/electron-main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 675640a52..3f7c0f07f 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -112,7 +112,15 @@ function startAutoUpdate(update_base_url) { // 204 No Content. On windows it takes a base path and looks for // files under that path. if (process.platform == 'darwin') { - electron.autoUpdater.setFeedURL(update_base_url + 'macos/'); + // include the current version in the URL we hit. Electron doesn't add + // it anywhere (apart from the User-Agent) so it's up to us. We could + // (and previously did) just use the User-Agent, but this doesn't + // rely on NSURLConnection setting the User-Agent to what we expect, + // and also acts as a convenient cache-buster between versions. + electron.autoUpdater.setFeedURL( + update_base_url + + 'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion()) + ); } else if (process.platform == 'win32') { electron.autoUpdater.setFeedURL(update_base_url + 'win32/' + process.arch + '/'); } else { From cf92e7f64bfc480dd860ce52d8c986c9d8c708df Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 17 Jan 2017 14:04:42 +0000 Subject: [PATCH 2/2] Clarify comment --- electron/src/electron-main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/electron/src/electron-main.js b/electron/src/electron-main.js index 3f7c0f07f..a03a8755b 100644 --- a/electron/src/electron-main.js +++ b/electron/src/electron-main.js @@ -116,7 +116,8 @@ function startAutoUpdate(update_base_url) { // it anywhere (apart from the User-Agent) so it's up to us. We could // (and previously did) just use the User-Agent, but this doesn't // rely on NSURLConnection setting the User-Agent to what we expect, - // and also acts as a convenient cache-buster between versions. + // and also acts as a convenient cache-buster to ensure that when the + // app updates it always gets a fresh value to avoid update-looping. electron.autoUpdater.setFeedURL( update_base_url + 'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion())