Force update on version click
This commit is contained in:
@@ -31,6 +31,7 @@ class Updater(Plugin):
|
||||
|
||||
addApiView('updater.info', self.getInfo)
|
||||
addApiView('updater.update', self.doUpdateView)
|
||||
addApiView('updater.check', self.checkView)
|
||||
|
||||
def getInfo(self):
|
||||
|
||||
@@ -90,6 +91,10 @@ class Updater(Plugin):
|
||||
|
||||
self.last_check = time.time()
|
||||
|
||||
def checkView(self):
|
||||
self.check()
|
||||
return self.getInfo()
|
||||
|
||||
def doUpdateView(self):
|
||||
return jsonified({
|
||||
'success': self.doUpdate()
|
||||
|
||||
@@ -12,6 +12,15 @@ var UpdaterBase = new Class({
|
||||
});
|
||||
},
|
||||
|
||||
check: function(onComplete){
|
||||
var self = this;
|
||||
|
||||
Api.request('updater.check', {
|
||||
'onComplete': onComplete || Function.from()
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
info: function(timeout){
|
||||
var self = this;
|
||||
|
||||
|
||||
@@ -85,7 +85,12 @@ var AboutSettingTab = new Class({
|
||||
}).inject(self.content).adopt(
|
||||
new Element('dl.info').adopt(
|
||||
new Element('dt[text=Version]'),
|
||||
self.version_text = new Element('dd', {'text': 'Getting version...'}),
|
||||
self.version_text = new Element('dd', {
|
||||
'text': 'Getting version...',
|
||||
'events': {
|
||||
'click': self.checkForUpdate.bind(self)
|
||||
}
|
||||
}),
|
||||
new Element('dt[text=Directories]'),
|
||||
new Element('dd', {'text': App.getOption('app_dir')}),
|
||||
new Element('dd', {'text': App.getOption('data_dir')}),
|
||||
@@ -124,6 +129,14 @@ var AboutSettingTab = new Class({
|
||||
var self = this;
|
||||
var date = new Date(json.version.date * 1000);
|
||||
self.version_text.set('text', json.version.hash + ' ('+date.toUTCString()+')');
|
||||
},
|
||||
|
||||
checkForUpdate: function(){
|
||||
var self = this;
|
||||
|
||||
Updater.check(function(json){
|
||||
self.fillVersion(json)
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user