Update auto-updater config for release
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"publish": [{
|
"publish": [{
|
||||||
"provider": "generic",
|
"provider": "generic",
|
||||||
"url": "http://desktopupdate.mattermost.com/"
|
"url": "https://releases.mattermost.com/desktop/"
|
||||||
}],
|
}],
|
||||||
"appId": "com.mattermost.desktop",
|
"appId": "com.mattermost.desktop",
|
||||||
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
|
"artifactName": "${name}-${version}-${os}-${arch}.${ext}",
|
||||||
|
@@ -662,7 +662,7 @@ app.on('ready', () => {
|
|||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ipcMain.emit('check-for-updates');
|
ipcMain.emit('check-for-updates');
|
||||||
}, autoUpdater.INTERVAL_48_HOURS_IN_MS);
|
}, autoUpdater.UPDATER_INTERVAL_IN_MS);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,8 @@ import logger from 'electron-log';
|
|||||||
import {autoUpdater, CancellationToken} from 'electron-updater';
|
import {autoUpdater, CancellationToken} from 'electron-updater';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
|
||||||
const INTERVAL_48_HOURS_IN_MS = 5 * 60 * 1000; // 5 min.
|
// eslint-disable-next-line no-magic-numbers
|
||||||
|
const UPDATER_INTERVAL_IN_MS = 48 * 60 * 60 * 1000; // 48 hours
|
||||||
|
|
||||||
autoUpdater.logger = logger;
|
autoUpdater.logger = logger;
|
||||||
autoUpdater.logger.transports.file.level = 'info';
|
autoUpdater.logger.transports.file.level = 'info';
|
||||||
@@ -70,7 +71,7 @@ function isUpdateApplicable(now, skippedVersion, updateInfo) {
|
|||||||
const releaseTime = new Date(updateInfo.releaseDate).getTime();
|
const releaseTime = new Date(updateInfo.releaseDate).getTime();
|
||||||
|
|
||||||
// 48 hours after a new version is added to releases.mattermost.com, user receives a “New update is available” dialog
|
// 48 hours after a new version is added to releases.mattermost.com, user receives a “New update is available” dialog
|
||||||
if (now.getTime() - releaseTime < INTERVAL_48_HOURS_IN_MS) {
|
if (now.getTime() - releaseTime < UPDATER_INTERVAL_IN_MS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ function initialize(appState, mainWindow, notifyOnly = false) {
|
|||||||
appState.updateCheckedDate = new Date();
|
appState.updateCheckedDate = new Date();
|
||||||
setTimeout(() => { // eslint-disable-line max-nested-callbacks
|
setTimeout(() => { // eslint-disable-line max-nested-callbacks
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
}, INTERVAL_48_HOURS_IN_MS);
|
}, UPDATER_INTERVAL_IN_MS);
|
||||||
updaterModal.close();
|
updaterModal.close();
|
||||||
}).on('click-install', () => {
|
}).on('click-install', () => {
|
||||||
updaterModal.webContents.send('start-download');
|
updaterModal.webContents.send('start-download');
|
||||||
@@ -145,13 +146,13 @@ function initialize(appState, mainWindow, notifyOnly = false) {
|
|||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
autoUpdater.checkForUpdates();
|
autoUpdater.checkForUpdates();
|
||||||
}, INTERVAL_48_HOURS_IN_MS);
|
}, UPDATER_INTERVAL_IN_MS);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldCheckForUpdatesOnStart(updateCheckedDate) {
|
function shouldCheckForUpdatesOnStart(updateCheckedDate) {
|
||||||
if (updateCheckedDate) {
|
if (updateCheckedDate) {
|
||||||
if (Date.now() - updateCheckedDate.getTime() < INTERVAL_48_HOURS_IN_MS) {
|
if (Date.now() - updateCheckedDate.getTime() < UPDATER_INTERVAL_IN_MS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,7 +188,7 @@ function loadConfig(file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
INTERVAL_48_HOURS_IN_MS,
|
UPDATER_INTERVAL_IN_MS,
|
||||||
checkForUpdates,
|
checkForUpdates,
|
||||||
shouldCheckForUpdatesOnStart,
|
shouldCheckForUpdatesOnStart,
|
||||||
initialize,
|
initialize,
|
||||||
|
Reference in New Issue
Block a user