Skip to content

Commit a6c9965

Browse files
committed
Re-enable auto update
1 parent d9aa7b8 commit a6c9965

File tree

5 files changed

+51
-4
lines changed

5 files changed

+51
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212

1313
strategy:
14+
fail-fast: false
1415
matrix:
1516
os: [ubuntu-latest, macos-latest, windows-latest]
1617

main/index.js

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const audio = require('./windows/audio')
1313
const player = require('./windows/player')
1414
const AudioLibrary = require('./lib/audio-library')
1515
const log = require('electron-log')
16+
const autoUpdater = require('electron-updater').autoUpdater
1617

1718
// handle uncaught exceptions before calling any functions
1819
process.on('uncaughtException', (err) => {
@@ -88,6 +89,43 @@ app.on('ready', function appReady () {
8889
ipcMain.on('recall', recall)
8990
ipcMain.on('sync-state', syncState)
9091

92+
// register autoUpdater
93+
if (!process.env.DEV_SERVER) {
94+
setTimeout(() => {
95+
log.info('autoUpdater: Auto update initalized...')
96+
autoUpdater.checkForUpdatesAndNotify()
97+
}, 1000 * 3)
98+
}
99+
100+
autoUpdater.on('error', (err) => {
101+
broadcast('au:error', err)
102+
console.error(err)
103+
})
104+
105+
autoUpdater.on('checking-for-update', () => {
106+
log.info('autoUpdater: Checking for update...')
107+
broadcast('au:checking-for-update')
108+
})
109+
110+
autoUpdater.on('update-available', (info) => {
111+
log.info('autoUpdater: Update available!')
112+
broadcast('au:update-available', info)
113+
})
114+
115+
autoUpdater.on('update-not-available', (info) => {
116+
log.info('autoUpdater: No update available')
117+
broadcast('au:update-not-available', info)
118+
})
119+
120+
autoUpdater.on('download-progress', (progress) => {
121+
broadcast('au:progress', progress)
122+
})
123+
124+
autoUpdater.on('update-downloaded', (info) => {
125+
log.info('autoUpdater: Update downloaded')
126+
broadcast('au:update-downloaded', info)
127+
})
128+
91129
// ACTIONS
92130
// NOTE: I really don't like having all of these actions stuck in this scope.
93131
// Would be nice to move this to a separate file eventually. -ungoldman
@@ -156,9 +194,9 @@ app.on('ready', function appReady () {
156194
broadcast('paused')
157195
}
158196

159-
function playPause () {
160-
state.playing ? pause() : play()
161-
}
197+
// function playPause () {
198+
// state.playing ? pause() : play()
199+
// }
162200

163201
function prev () {
164202
broadcast('new-track', al.prev())

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"electron-default-menu": "^1.0.1",
8585
"electron-log": "^5.0.0-beta.16",
8686
"electron-store": "^8.1.0",
87+
"electron-updater": "^6.1.7",
8788
"electron-window-state": "^5.0.2",
8889
"entypo": "^2.1.0",
8990
"existy": "^1.0.1",
@@ -128,6 +129,13 @@
128129
"xvfb-maybe": "^0.2.1",
129130
"yo-yoify": "^4.3.0"
130131
},
132+
"overrides": {
133+
"electron-builder": {
134+
"read-config-file": {
135+
"config-file-ts": "0.2.4"
136+
}
137+
}
138+
},
131139
"engines": {
132140
"node": ">=19.0.0",
133141
"npm": ">=9.0.0"

renderer/audio/audio-player.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-env browser */
12
const Nanobus = require('nanobus')
23
const window = require('global/window')
34
const get = require('lodash.get')

renderer/audio/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const path = require('path')
77
const mainState = remote.require('./index.js')
88
const needle = 'file://' + path.resolve(__dirname, 'needle.mp3')
99
let startupNode = document.querySelector('#needle')
10-
const fileUrlFromPath = require('../shared/file-url')
1110

1211
needleSound(startupNode, needle, mainState.volume, mainState.muted)
1312

0 commit comments

Comments
 (0)