Merge pull request #97 from lbryio/lbry-id-new-method

Update API method used to get LBRY ID
This commit is contained in:
alexliebowitz 2016-11-30 00:34:18 -05:00 committed by GitHub
commit d913e0be63
2 changed files with 11 additions and 4 deletions

View file

@ -310,6 +310,9 @@ lbry.setClientSetting = function(setting, value) {
return localStorage.setItem('setting_' + setting, JSON.stringify(value)); return localStorage.setItem('setting_' + setting, JSON.stringify(value));
} }
lbry.getSessionInfo = function(callback) {
lbry.call('get_lbry_session_info', {}, callback);
}
lbry.reportBug = function(message, callback) { lbry.reportBug = function(message, callback) {
lbry.call('upload_log', { lbry.call('upload_log', {

View file

@ -4,6 +4,7 @@ var HelpPage = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
versionInfo: null, versionInfo: null,
lbryId: null,
}; };
}, },
componentWillMount: function() { componentWillMount: function() {
@ -12,17 +13,20 @@ var HelpPage = React.createClass({
versionInfo: info, versionInfo: info,
}); });
}); });
lbry.getSessionInfo((info) => {
this.setState({
lbryId: info.lbry_id,
});
});
}, },
componentDidMount: function() { componentDidMount: function() {
document.title = "Help"; document.title = "Help";
}, },
render: function() { render: function() {
let ver, osName, platform, newVerLink, lbryId; let ver, osName, platform, newVerLink;
if (this.state.versionInfo) { if (this.state.versionInfo) {
ver = this.state.versionInfo; ver = this.state.versionInfo;
lbryId = ver.lbry_id;
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');
@ -84,7 +88,7 @@ var HelpPage = React.createClass({
</tr> </tr>
<tr> <tr>
<th>Installation ID</th> <th>Installation ID</th>
<td>{lbryId}</td> <td>{this.state.lbryId}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>