diff --git a/couchpotato/core/_base/updater/main.py b/couchpotato/core/_base/updater/main.py index 13c4c51b..a99013cb 100644 --- a/couchpotato/core/_base/updater/main.py +++ b/couchpotato/core/_base/updater/main.py @@ -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() diff --git a/couchpotato/core/_base/updater/static/updater.js b/couchpotato/core/_base/updater/static/updater.js index 3c400efc..48d077c1 100644 --- a/couchpotato/core/_base/updater/static/updater.js +++ b/couchpotato/core/_base/updater/static/updater.js @@ -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; diff --git a/couchpotato/static/scripts/page/about.js b/couchpotato/static/scripts/page/about.js index 3e6db116..d7767603 100644 --- a/couchpotato/static/scripts/page/about.js +++ b/couchpotato/static/scripts/page/about.js @@ -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) + }) } });