Skip to content

Commit 772e05b

Browse files
committed
0.9.57 auto update
1 parent 26efc0e commit 772e05b

File tree

4 files changed

+322
-132
lines changed

4 files changed

+322
-132
lines changed

builder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extraResources:
2626

2727
publish:
2828
provider: github
29-
publishAutoUpdate: false
29+
publishAutoUpdate: true
3030

3131
linux:
3232
executableName: emulsion

main.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ import { PLATFORMS, getPlatformInfo } from './src/js/platforms.js';
1212
import axios from 'axios';
1313
import os from 'os';
1414

15+
// Auto-updater
16+
import { autoUpdater } from 'electron-updater';
17+
import log from 'electron-log';
18+
19+
// Enable logging
20+
autoUpdater.logger = log;
21+
autoUpdater.logger.transports.file.level = 'info';
22+
1523

1624

1725
let childProcesses = new Map();
@@ -900,6 +908,35 @@ ipcMain.handle('get-versions', async () => {
900908
});
901909

902910
app.whenReady().then(() => {
911+
// Check for updates on startup
912+
autoUpdater.checkForUpdatesAndNotify();
913+
914+
autoUpdater.on('checking-for-update', () => {
915+
log.info('Checking for update...');
916+
});
917+
918+
autoUpdater.on('update-available', (info) => {
919+
log.info('Update available.', info);
920+
});
921+
922+
autoUpdater.on('update-not-available', (info) => {
923+
log.info('Update not available.', info);
924+
});
925+
926+
autoUpdater.on('error', (err) => {
927+
log.error('Error in auto-updater.', err);
928+
});
929+
930+
autoUpdater.on('download-progress', (progressObj) => {
931+
let log_message = "Download speed: " + progressObj.bytesPerSecond;
932+
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
933+
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
934+
log.info(log_message);
935+
});
936+
937+
autoUpdater.on('update-downloaded', (info) => {
938+
log.info('Update downloaded', info);
939+
});
903940

904941
session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
905942
callback({

0 commit comments

Comments
 (0)