fix version info on help

This commit is contained in:
Jeremy Kauffman 2017-05-25 14:29:28 -04:00
parent a899d623d0
commit aee0603dc9
5 changed files with 26 additions and 20 deletions

View file

@ -68,6 +68,7 @@ function checkForNewVersion(callback) {
'User-Agent': `LBRY/${localVersion}`,
}
};
const req = https.get(Object.assign(opts, url.parse(LATEST_RELEASE_API_URL)), (res) => {
res.on('data', (data) => {
result += data;
@ -76,7 +77,6 @@ function checkForNewVersion(callback) {
const tagName = JSON.parse(result).tag_name;
const [_, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
if (!remoteVersion) {
console.log('Malformed remote version string:', tagName);
if (win) {
win.webContents.send('version-info-received', null);
}

View file

@ -186,7 +186,7 @@ export function doCheckUpgradeAvailable() {
return function(dispatch, getState) {
const state = getState()
lbry.getVersionInfo().then(({remoteVersion, upgradeAvailable}) => {
lbry.getAppVersionInfo().then(({remoteVersion, upgradeAvailable}) => {
if (upgradeAvailable) {
dispatch({
type: types.UPDATE_VERSION,

View file

@ -360,7 +360,7 @@ lbry.showMenuIfNeeded = function() {
sessionStorage.setItem('menuShown', chosenMenu);
};
lbry.getVersionInfo = function() {
lbry.getAppVersionInfo = function() {
return new Promise((resolve, reject) => {
ipcRenderer.once('version-info-received', (event, versionInfo) => { resolve(versionInfo) });
ipcRenderer.send('version-info-requested');

View file

@ -13,8 +13,7 @@ import store from 'store.js';
import {
doChangePath,
doNavigate,
doDaemonReady,
doHistoryPush
doDaemonReady
} from 'actions/app'
import {
doFetchDaemonSettings

View file

@ -3,6 +3,7 @@ import React from 'react';
import lbry from 'lbry.js';
import Link from 'component/link';
import SubHeader from 'component/subHeader'
import {BusyMessage} from 'component/common'
import {version as uiVersion} from 'json!../../../package.json';
class HelpPage extends React.Component {
@ -16,11 +17,16 @@ class HelpPage extends React.Component {
}
componentWillMount() {
lbry.getVersionInfo((info) => {
lbry.getAppVersionInfo().then((info) => {
this.setState({
versionInfo: info,
appVersionInfo: info,
});
});
lbry.call('version', {}, (info) => {
this.setState({
versionInfo: info
})
})
lbry.getSessionInfo((info) => {
this.setState({
lbryId: info.lbry_id,
@ -37,7 +43,7 @@ class HelpPage extends React.Component {
if (this.state.versionInfo) {
ver = this.state.versionInfo;
console.log(ver)
if (ver.os_system == 'Darwin') {
osName = (parseInt(ver.os_release.match(/^\d+/)) < 16 ? 'Mac OS X' : 'Mac OS');
@ -87,14 +93,14 @@ class HelpPage extends React.Component {
<div className="meta">Thanks! LBRY is made by its users.</div>
</div>
</section>
{!ver ? null :
<section className="card">
<div className="card__title-primary"><h3>About</h3></div>
<div className="card__content">
{ver.lbrynet_update_available || ver.lbryum_update_available ?
<p>A newer version of LBRY is available. <Link href={newVerLink} label={`Download LBRY ${ver.remote_lbrynet} now!`} /></p>
: <p>Your copy of LBRY is up to date.</p>
}
<section className="card">
<div className="card__title-primary"><h3>About</h3></div>
<div className="card__content">
{this.state.appVersionInfo ?
(ver.lbrynet_update_available || ver.lbryum_update_available ?
<p>A newer version of LBRY is available. <Link href={newVerLink} label={`Download LBRY ${ver.remote_lbrynet} now!`} /></p>
: <p>Your copy of LBRY is up to date.</p>) : null}
{ ver ?
<table className="table-standard">
<tbody>
<tr>
@ -118,10 +124,11 @@ class HelpPage extends React.Component {
<td>{this.state.lbryId}</td>
</tr>
</tbody>
</table>
</div>
</section>
}
</table> :
<BusyMessage message="Looking up version info" />
}
</div>
</section>
</main>
);
}