Added update button to main page
This commit is contained in:
parent
4c6e1e6f7e
commit
854e03fb14
@ -225,6 +225,8 @@ return view.extend({
|
|||||||
select.value = st.profile;
|
select.value = st.profile;
|
||||||
// mihomo serves its external-ui at /ui; metacubexd/zashboard take the API from the query
|
// mihomo serves its external-ui at /ui; metacubexd/zashboard take the API from the query
|
||||||
var updState = E('em', 'проверяю обновления…');
|
var updState = E('em', 'проверяю обновления…');
|
||||||
|
// shown only next to "есть обновление"; the same command as on «Система»
|
||||||
|
var updBtn = this.button('Обновить', 'apply', 'update', null, 'Скачать свежий kit и пересобрать профили?');
|
||||||
callUpdateCheck().then(function(u) {
|
callUpdateCheck().then(function(u) {
|
||||||
if (u.error)
|
if (u.error)
|
||||||
return dom.content(updState, '— не удалось проверить обновления: ' + u.error);
|
return dom.content(updState, '— не удалось проверить обновления: ' + u.error);
|
||||||
@ -232,7 +234,7 @@ return view.extend({
|
|||||||
if (u.installed && u.installed.indexOf(u.latest) == 0)
|
if (u.installed && u.installed.indexOf(u.latest) == 0)
|
||||||
return dom.content(updState, '— актуальная');
|
return dom.content(updState, '— актуальная');
|
||||||
dom.content(updState, [ '— ', E('strong', 'есть обновление: '), link(u.commit, u.latest), ' ' + (u.message || '') ]
|
dom.content(updState, [ '— ', E('strong', 'есть обновление: '), link(u.commit, u.latest), ' ' + (u.message || '') ]
|
||||||
.concat(u.compare ? [ ' (', link(u.compare, 'что изменилось'), ')' ] : []));
|
.concat(u.compare ? [ ' (', link(u.compare, 'что изменилось'), ')' ] : []).concat([ ' ', updBtn ]));
|
||||||
}).catch(function(e) { dom.content(updState, '— не удалось проверить обновления: ' + e); });
|
}).catch(function(e) { dom.content(updState, '— не удалось проверить обновления: ' + e); });
|
||||||
var host = window.location.hostname;
|
var host = window.location.hostname;
|
||||||
var dash = 'http://' + host + ':' + st.api_port + '/ui/?hostname=' + encodeURIComponent(host) +
|
var dash = 'http://' + host + ':' + st.api_port + '/ui/?hostname=' + encodeURIComponent(host) +
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user