If user has old version, redirect them to lbry.io/[os] to upgrade
The OS checking is ugly, but once we have an "upgrade" page on lbry.io we'll change it to point there
This commit is contained in:
parent
458ff88602
commit
f8c0382db0
2 changed files with 21 additions and 0 deletions
|
@ -9,6 +9,15 @@ var App = React.createClass({
|
|||
viewingPage: window.location.search === '?settings' ? 'settings' : 'home'
|
||||
}
|
||||
},
|
||||
componentWillMount: function() {
|
||||
lbry.checkNewVersionAvailable(function(isAvailable) {
|
||||
if (isAvailable) {
|
||||
alert("The version of LBRY you're using is not up to date.\n\n" +
|
||||
"You'll now be taken to lbry.io, where you can download the latest version.");
|
||||
window.location = "http://www.lbry.io/" + (navigator.userAgent.indexOf('Mac OS X') != -1 ? 'osx' : 'linux');
|
||||
}
|
||||
});
|
||||
},
|
||||
componentDidMount: function() {
|
||||
lbry.getStartNotice(function(notice) {
|
||||
if (notice) {
|
||||
|
|
12
js/lbry.js
12
js/lbry.js
|
@ -91,6 +91,18 @@ lbry.search = function(query, callback)
|
|||
lbry.call("search_nametrie", { "search": query }, callback);
|
||||
}
|
||||
|
||||
lbry.checkNewVersionAvailable = function(callback) {
|
||||
lbry.call('version', {}, function() {
|
||||
// If the "version" method is available, we have a daemon new enough to do version checking
|
||||
lbry.call('check_for_new_version', callback);
|
||||
}, function(err) {
|
||||
if (err.fault == 'NoSuchFunction') {
|
||||
// If it's not available, we're definitely in an old version
|
||||
callback(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//utilities
|
||||
lbry.formatCredits = function(amount, precision)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue