Skip to content

Commit

Permalink
Issue #2 - updater js fix
Browse files Browse the repository at this point in the history
  • Loading branch information
styxit committed Aug 4, 2013
1 parent bd59f3a commit e212aaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions htpc/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def index(self):
""" Handle server requests. Update on POST. Get status on GET. """
if self.git == '':
self.logger.warning('Git not configured. Automatic update disabled.')
return -1
return -1
if cherrypy.request.method.upper() == 'POST':
Thread(target=self.git_update).start()
return 1
Expand Down Expand Up @@ -87,8 +87,7 @@ def check_update(self):
else:
behind = self.behind_by(current, latest)
self.logger.info("Currently " + str(behind) + " commits behind.")
return (behind, 'https://github.com/%s/%s/compare/%s...%s' % (
self.user, self.repo, current, latest))
return behind

def git_update(self):
""" Do update through git """
Expand Down
4 changes: 2 additions & 2 deletions interfaces/default/js/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ $(document).ready(function () {
$.getJSON(WEBDIR + 'update/', function (data) {
if (data == 0) {
notify('Update', 'Already running latest version.', 'success')
} else if ($.isNumeric(data[0] && data[0] > 0)) {
if (confirm('Your are '+data[0]+' versions behind. Update to latest version?')) {
} else if ($.isNumeric(data) && data > 0) {
if (confirm('Your are '+data+' versions behind. Update to latest version?')) {
$.post(WEBDIR + 'update/', function (data) {
if (data == 1) {
showModal('Installing update', '<div class="progress progress-striped active"><div class="bar" style="width:100%"></div></div>','')
Expand Down

0 comments on commit e212aaa

Please sign in to comment.