fix version info on help
This commit is contained in:
parent
a899d623d0
commit
aee0603dc9
5 changed files with 26 additions and 20 deletions
|
@ -68,6 +68,7 @@ function checkForNewVersion(callback) {
|
||||||
'User-Agent': `LBRY/${localVersion}`,
|
'User-Agent': `LBRY/${localVersion}`,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const req = https.get(Object.assign(opts, url.parse(LATEST_RELEASE_API_URL)), (res) => {
|
const req = https.get(Object.assign(opts, url.parse(LATEST_RELEASE_API_URL)), (res) => {
|
||||||
res.on('data', (data) => {
|
res.on('data', (data) => {
|
||||||
result += data;
|
result += data;
|
||||||
|
@ -76,7 +77,6 @@ function checkForNewVersion(callback) {
|
||||||
const tagName = JSON.parse(result).tag_name;
|
const tagName = JSON.parse(result).tag_name;
|
||||||
const [_, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
|
const [_, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
|
||||||
if (!remoteVersion) {
|
if (!remoteVersion) {
|
||||||
console.log('Malformed remote version string:', tagName);
|
|
||||||
if (win) {
|
if (win) {
|
||||||
win.webContents.send('version-info-received', null);
|
win.webContents.send('version-info-received', null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ export function doCheckUpgradeAvailable() {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
const state = getState()
|
const state = getState()
|
||||||
|
|
||||||
lbry.getVersionInfo().then(({remoteVersion, upgradeAvailable}) => {
|
lbry.getAppVersionInfo().then(({remoteVersion, upgradeAvailable}) => {
|
||||||
if (upgradeAvailable) {
|
if (upgradeAvailable) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.UPDATE_VERSION,
|
type: types.UPDATE_VERSION,
|
||||||
|
|
|
@ -360,7 +360,7 @@ lbry.showMenuIfNeeded = function() {
|
||||||
sessionStorage.setItem('menuShown', chosenMenu);
|
sessionStorage.setItem('menuShown', chosenMenu);
|
||||||
};
|
};
|
||||||
|
|
||||||
lbry.getVersionInfo = function() {
|
lbry.getAppVersionInfo = function() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipcRenderer.once('version-info-received', (event, versionInfo) => { resolve(versionInfo) });
|
ipcRenderer.once('version-info-received', (event, versionInfo) => { resolve(versionInfo) });
|
||||||
ipcRenderer.send('version-info-requested');
|
ipcRenderer.send('version-info-requested');
|
||||||
|
|
|
@ -13,8 +13,7 @@ import store from 'store.js';
|
||||||
import {
|
import {
|
||||||
doChangePath,
|
doChangePath,
|
||||||
doNavigate,
|
doNavigate,
|
||||||
doDaemonReady,
|
doDaemonReady
|
||||||
doHistoryPush
|
|
||||||
} from 'actions/app'
|
} from 'actions/app'
|
||||||
import {
|
import {
|
||||||
doFetchDaemonSettings
|
doFetchDaemonSettings
|
||||||
|
|
|
@ -3,6 +3,7 @@ import React from 'react';
|
||||||
import lbry from 'lbry.js';
|
import lbry from 'lbry.js';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import SubHeader from 'component/subHeader'
|
import SubHeader from 'component/subHeader'
|
||||||
|
import {BusyMessage} from 'component/common'
|
||||||
import {version as uiVersion} from 'json!../../../package.json';
|
import {version as uiVersion} from 'json!../../../package.json';
|
||||||
|
|
||||||
class HelpPage extends React.Component {
|
class HelpPage extends React.Component {
|
||||||
|
@ -16,11 +17,16 @@ class HelpPage extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
lbry.getVersionInfo((info) => {
|
lbry.getAppVersionInfo().then((info) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
versionInfo: info,
|
appVersionInfo: info,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
lbry.call('version', {}, (info) => {
|
||||||
|
this.setState({
|
||||||
|
versionInfo: info
|
||||||
|
})
|
||||||
|
})
|
||||||
lbry.getSessionInfo((info) => {
|
lbry.getSessionInfo((info) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
lbryId: info.lbry_id,
|
lbryId: info.lbry_id,
|
||||||
|
@ -37,7 +43,7 @@ class HelpPage extends React.Component {
|
||||||
|
|
||||||
if (this.state.versionInfo) {
|
if (this.state.versionInfo) {
|
||||||
ver = this.state.versionInfo;
|
ver = this.state.versionInfo;
|
||||||
|
console.log(ver)
|
||||||
if (ver.os_system == 'Darwin') {
|
if (ver.os_system == 'Darwin') {
|
||||||
osName = (parseInt(ver.os_release.match(/^\d+/)) < 16 ? 'Mac OS X' : 'Mac OS');
|
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 className="meta">Thanks! LBRY is made by its users.</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{!ver ? null :
|
<section className="card">
|
||||||
<section className="card">
|
<div className="card__title-primary"><h3>About</h3></div>
|
||||||
<div className="card__title-primary"><h3>About</h3></div>
|
<div className="card__content">
|
||||||
<div className="card__content">
|
{this.state.appVersionInfo ?
|
||||||
{ver.lbrynet_update_available || ver.lbryum_update_available ?
|
(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>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>
|
: <p>Your copy of LBRY is up to date.</p>) : null}
|
||||||
}
|
{ ver ?
|
||||||
<table className="table-standard">
|
<table className="table-standard">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -118,10 +124,11 @@ class HelpPage extends React.Component {
|
||||||
<td>{this.state.lbryId}</td>
|
<td>{this.state.lbryId}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table> :
|
||||||
</div>
|
<BusyMessage message="Looking up version info" />
|
||||||
</section>
|
}
|
||||||
}
|
</div>
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue