revert to detecting the OS client side for update url

This commit is contained in:
jobevers 2017-02-20 13:28:59 -06:00
parent 86351d1736
commit 0005280cb6

View file

@ -25,7 +25,6 @@ import {Link} from './component/link.js';
const {remote, ipcRenderer} = require('electron'); const {remote, ipcRenderer} = require('electron');
const {download} = remote.require('electron-dl'); const {download} = remote.require('electron-dl');
const UPDATE_URL = 'https://lbry.io/get/latest';
var App = React.createClass({ var App = React.createClass({
_error_key_labels: { _error_key_labels: {
@ -51,6 +50,7 @@ var App = React.createClass({
pageArgs: typeof val !== 'undefined' ? val : null, pageArgs: typeof val !== 'undefined' ? val : null,
errorInfo: null, errorInfo: null,
modal: null, modal: null,
updateUrl: null,
isOldOSX: null, isOldOSX: null,
downloadProgress: null, downloadProgress: null,
}; };
@ -68,15 +68,28 @@ var App = React.createClass({
lbry.getVersionInfo((versionInfo) => { lbry.getVersionInfo((versionInfo) => {
var isOldOSX = false; var isOldOSX = false;
if (versionInfo.os_system == 'Darwin') { if (versionInfo.os_system == 'Darwin') {
var updateUrl = 'https://lbry.io/get/lbry.dmg';
var maj, min, patch; var maj, min, patch;
[maj, min, patch] = versionInfo.lbrynet_version.split('.'); [maj, min, patch] = versionInfo.lbrynet_version.split('.');
if (maj == 0 && min <= 2 && patch <= 2) { if (maj == 0 && min <= 2 && patch <= 2) {
isOldOSX = true; 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({ this.setState({
modal: 'upgrade', modal: 'upgrade',
isOldOSX: isOldOSX, isOldOSX: isOldOSX,
updateUrl: updateUrl,
}) })
}); });
}); });
@ -104,7 +117,7 @@ var App = React.createClass({
let options = { let options = {
onProgress: (p) => this.setState({downloadProgress: Math.round(p * 100)}), 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')); .then(dl => ipcRenderer.send('shutdown'));
this.setState({modal: 'downloading'}); this.setState({modal: 'downloading'});
}, },