also check for git updates
This commit is contained in:
parent
b87eee40d0
commit
f5bb5ee877
5 changed files with 96 additions and 41 deletions
|
@ -136,6 +136,17 @@ def getVersion(data):
|
|||
'current': settings.MINOR_VERSION,
|
||||
'upgrade': False,
|
||||
}
|
||||
if settings.MINOR_VERSION == 'git':
|
||||
cmd = ['git', 'rev-parse', '@']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
|
||||
stdout, stderr = p.communicate()
|
||||
current = stdout.strip()
|
||||
cmd = ['git', 'ls-remote', 'origin', '-h', 'refs/heads/master']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
|
||||
stdout, stderr = p.communicate()
|
||||
new = stdout.strip()[:40]
|
||||
response['update'] = current != new
|
||||
else:
|
||||
if not os.path.exists(os.path.join(settings.updates_path, 'release.json')):
|
||||
return response
|
||||
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
||||
|
|
|
@ -36,15 +36,17 @@ oml.ui.appDialog = function() {
|
|||
.appendTo($logo);
|
||||
if (id == 'update') {
|
||||
$content.html('<h1><b>' + title + '</b></h1>');
|
||||
oml.api.getVersion(function(response) {
|
||||
if (response.data.update) {
|
||||
Ox.Element()
|
||||
var $update = Ox.Element()
|
||||
.css({
|
||||
paddingTop: '4px',
|
||||
paddingBottom: '16px'
|
||||
})
|
||||
.html('A new version of Open Media Library is available')
|
||||
.appendTo($content);
|
||||
}).appendTo($content);
|
||||
oml.api.getVersion(function(response) {
|
||||
if (response.data.update) {
|
||||
if (response.data.current == 'git') {
|
||||
$update.html('A new version of Open Media Library is available in git.<br>To update run: <code>./ctl update</code>');
|
||||
} else {
|
||||
$update.html('A new version of Open Media Library is available');
|
||||
Ox.Button({
|
||||
id: 'update',
|
||||
title: Ox._('Install Now')
|
||||
|
@ -61,14 +63,9 @@ oml.ui.appDialog = function() {
|
|||
});
|
||||
}
|
||||
}).appendTo($content);
|
||||
} else if (response.data.current == 'git') {
|
||||
Ox.Element()
|
||||
.html('To update a development version, run ./ctl update')
|
||||
.appendTo($content);
|
||||
}
|
||||
} else {
|
||||
Ox.Element()
|
||||
.html('No updates available')
|
||||
.appendTo($content);
|
||||
$update.html('No updates available')
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -10,6 +10,7 @@ oml.ui.mainMenu = function() {
|
|||
that = Ox.MainMenu({
|
||||
extras: [
|
||||
oml.$ui.connectionButton = oml.ui.connectionButton(),
|
||||
oml.$ui.updateButton = oml.ui.updateButton(),
|
||||
oml.$ui.notificationsButton = oml.ui.notificationsButton(),
|
||||
oml.$ui.loadingIcon = oml.ui.loadingIcon()
|
||||
],
|
||||
|
|
45
static/js/updateBotton.js
Normal file
45
static/js/updateBotton.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
oml.ui.updateButton = function() {
|
||||
|
||||
var that = Ox.Element({
|
||||
tooltip: Ox._('Updates Available')
|
||||
})
|
||||
.css({
|
||||
marginRight: '3px'
|
||||
}).hide();
|
||||
|
||||
function check() {
|
||||
oml.api.getVersion(function(response) {
|
||||
if (response.data.update) {
|
||||
that.show();
|
||||
} else {
|
||||
that.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
check();
|
||||
setTimeout(check, 86400000);
|
||||
|
||||
Ox.Button({
|
||||
style: 'symbol',
|
||||
title: 'upload',
|
||||
type: 'image'
|
||||
})
|
||||
.css({
|
||||
float: 'left',
|
||||
borderRadius: 0
|
||||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
oml.UI.set({
|
||||
'page': 'app',
|
||||
'part.app': 'update'
|
||||
})
|
||||
}
|
||||
})
|
||||
.appendTo(that);
|
||||
|
||||
return that;
|
||||
|
||||
};
|
|
@ -59,6 +59,7 @@
|
|||
"statusIcon.js",
|
||||
"statusbar.js",
|
||||
"transfersDialog.js",
|
||||
"updateBotton.js",
|
||||
"userButton.js",
|
||||
"usersDialog.js",
|
||||
"utils.js",
|
||||
|
|
Loading…
Reference in a new issue