From 0005280cb6cad0b05290daffc840ea2db6b38650 Mon Sep 17 00:00:00 2001 From: jobevers Date: Mon, 20 Feb 2017 13:28:59 -0600 Subject: [PATCH] revert to detecting the OS client side for update url --- js/app.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index 9b7348149..fdf8b1028 100644 --- a/js/app.js +++ b/js/app.js @@ -25,7 +25,6 @@ import {Link} from './component/link.js'; const {remote, ipcRenderer} = require('electron'); const {download} = remote.require('electron-dl'); -const UPDATE_URL = 'https://lbry.io/get/latest'; var App = React.createClass({ _error_key_labels: { @@ -51,6 +50,7 @@ var App = React.createClass({ pageArgs: typeof val !== 'undefined' ? val : null, errorInfo: null, modal: null, + updateUrl: null, isOldOSX: null, downloadProgress: null, }; @@ -68,15 +68,28 @@ var App = React.createClass({ lbry.getVersionInfo((versionInfo) => { var isOldOSX = false; if (versionInfo.os_system == 'Darwin') { + var updateUrl = 'https://lbry.io/get/lbry.dmg'; + var maj, min, patch; [maj, min, patch] = versionInfo.lbrynet_version.split('.'); if (maj == 0 && min <= 2 && patch <= 2) { isOldOSX = true; } + } else if (versionInfo.os_system == 'Linux') { + var updateUrl = 'https://lbry.io/get/lbry.deb'; + } else if (versionInfo.os_system == 'Windows') { + // A little weird, but for electron, the installer is + // actually an exe. Maybe a better url would + // be something like /get/windows ? + var updateUrl = 'https://lbry.io/get/lbry.msi'; + } else { + var updateUrl = 'https://lbry.io/get'; } + this.setState({ modal: 'upgrade', isOldOSX: isOldOSX, + updateUrl: updateUrl, }) }); }); @@ -104,7 +117,7 @@ var App = React.createClass({ let options = { onProgress: (p) => this.setState({downloadProgress: Math.round(p * 100)}), } - download(remote.getCurrentWindow(), UPDATE_URL, options) + download(remote.getCurrentWindow(), this.state.updateUrl, options) .then(dl => ipcRenderer.send('shutdown')); this.setState({modal: 'downloading'}); },