Skip to content

Commit 6257019

Browse files
authored
Merge pull request element-hq#2967 from vector-im/dbkr/include_version_in_update_check
Include current version in update check explicitly
2 parents ebc2ad5 + cf92e7f commit 6257019

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎electron/src/electron-main.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,16 @@ function startAutoUpdate(update_base_url) {
112112
// 204 No Content. On windows it takes a base path and looks for
113113
// files under that path.
114114
if (process.platform == 'darwin') {
115-
electron.autoUpdater.setFeedURL(update_base_url + 'macos/');
115+
// include the current version in the URL we hit. Electron doesn't add
116+
// it anywhere (apart from the User-Agent) so it's up to us. We could
117+
// (and previously did) just use the User-Agent, but this doesn't
118+
// rely on NSURLConnection setting the User-Agent to what we expect,
119+
// and also acts as a convenient cache-buster to ensure that when the
120+
// app updates it always gets a fresh value to avoid update-looping.
121+
electron.autoUpdater.setFeedURL(
122+
update_base_url +
123+
'macos/?localVersion=' + encodeURIComponent(electron.app.getVersion())
124+
);
116125
} else if (process.platform == 'win32') {
117126
electron.autoUpdater.setFeedURL(update_base_url + 'win32/' + process.arch + '/');
118127
} else {

0 commit comments

Comments
 (0)