diff --git a/main/auto-updater.js b/main/auto-updater.js index f762e2ab..d701c09c 100644 --- a/main/auto-updater.js +++ b/main/auto-updater.js @@ -45,8 +45,6 @@ function checkForUpdates () { if (res.statusCode !== 200) return var obj = JSON.parse(data) - // TODO: version should be included in the response object, we shouldn'v have to parse obj.name - var version = obj.name.slice(obj.name.lastIndexOf('v') + 1) - windows.main.send('dispatch', 'updateAvailable', version) + windows.main.send('dispatch', 'updateAvailable', obj.version) }) } diff --git a/renderer/index.js b/renderer/index.js index 8c9f653e..4f11476e 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -309,7 +309,7 @@ function dispatch (action, ...args) { } // Shows a modal saying that we have an update -function updateAvailable(version) { +function updateAvailable (version) { if (state.saved.skippedVersions && state.saved.skippedVersions.includes(version)) { console.log('new version skipped by user: v' + version) return diff --git a/renderer/views/update-available-modal.js b/renderer/views/update-available-modal.js index e381836b..150de2cd 100644 --- a/renderer/views/update-available-modal.js +++ b/renderer/views/update-available-modal.js @@ -12,25 +12,21 @@ function UpdateAvailableModal (state) { return hx`

A new version of WebTorrent is available: v${state.modal.version}

-

We have an auto-updater for Windows and Mac, but not yet for Linux, so you'll have to download it manually. Sorry.

+

We have an auto-updater for Windows and Mac. We don't have one for Linux yet, so you'll have to download the new version manually.

` -} -function handleKeyPress (e) { - if (e.which === 13) handleOK() /* hit Enter to submit */ -} + function handleOK () { + electron.shell.openExternal('https://github.com/feross/webtorrent-desktop/releases') + dispatch('exitModal') + } -function handleOK () { - electron.shell.openExternal('https://github.com/feross/webtorrent-desktop/releases') - dispatch('exitModal') -} - -function handleCancel () { - dispatch('skipVersion', state.modal.version) - dispatch('exitModal') + function handleCancel () { + dispatch('skipVersion', state.modal.version) + dispatch('exitModal') + } }