auto updater: code style
This commit is contained in:
@@ -19,8 +19,7 @@ module.exports = {
|
|||||||
APP_VERSION: APP_VERSION,
|
APP_VERSION: APP_VERSION,
|
||||||
APP_WINDOW_TITLE: APP_NAME + ' (BETA)',
|
APP_WINDOW_TITLE: APP_NAME + ' (BETA)',
|
||||||
|
|
||||||
AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update' +
|
AUTO_UPDATE_URL: 'https://webtorrent.io/desktop/update',
|
||||||
'?version=' + APP_VERSION + '&platform=' + process.platform,
|
|
||||||
|
|
||||||
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
CRASH_REPORT_URL: 'https://webtorrent.io/desktop/crash-report',
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ var config = require('../config')
|
|||||||
var log = require('./log')
|
var log = require('./log')
|
||||||
var windows = require('./windows')
|
var windows = require('./windows')
|
||||||
|
|
||||||
|
var AUTO_UPDATE_URL = config.AUTO_UPDATE_URL +
|
||||||
|
'?version=' + config.APP_VERSION +
|
||||||
|
'&platform=' + process.platform
|
||||||
|
|
||||||
function init () {
|
function init () {
|
||||||
if (process.platform === 'linux') {
|
if (process.platform === 'linux') {
|
||||||
initLinux()
|
initLinux()
|
||||||
@@ -20,7 +24,7 @@ function init () {
|
|||||||
// The Electron auto-updater does not support Linux yet, so manually check for updates and
|
// The Electron auto-updater does not support Linux yet, so manually check for updates and
|
||||||
// `show the user a modal notification.
|
// `show the user a modal notification.
|
||||||
function initLinux () {
|
function initLinux () {
|
||||||
get.concat(config.AUTO_UPDATE_URL, onResponse)
|
get.concat(AUTO_UPDATE_URL, onResponse)
|
||||||
|
|
||||||
function onResponse (err, res, data) {
|
function onResponse (err, res, data) {
|
||||||
if (err) return log(`Update error: ${err.message}`)
|
if (err) return log(`Update error: ${err.message}`)
|
||||||
@@ -67,6 +71,6 @@ function initDarwinWin32 () {
|
|||||||
(e, notes, name, date, url) => log(`Update downloaded: ${name}: ${url}`)
|
(e, notes, name, date, url) => log(`Update downloaded: ${name}: ${url}`)
|
||||||
)
|
)
|
||||||
|
|
||||||
electron.autoUpdater.setFeedURL(config.AUTO_UPDATE_URL)
|
electron.autoUpdater.setFeedURL(AUTO_UPDATE_URL)
|
||||||
electron.autoUpdater.checkForUpdates()
|
electron.autoUpdater.checkForUpdates()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user