mirror of
https://github.com/kenzok8/small-package
synced 2025-01-09 08:59:26 +08:00
56 lines
2.2 KiB
HTML
56 lines
2.2 KiB
HTML
<%+cbi/valueheader%>
|
|
<label class="cbi-value-title"><%= translate("Update the core") %></label>
|
|
<div class="cbi-value-field">
|
|
<input class="btn cbi-button cbi-button-reload" id="update" type="button" size="0" onclick="check_version()" value="<%:Collecting data...%>" />
|
|
<div class="cbi-value-description">
|
|
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
|
|
<%:If repeated failures occur, you can download the binaries for the corresponding schemas at the following url.%>
|
|
</br>
|
|
<%:https://github.com/ochinchina/supervisord/releases%>
|
|
</br>
|
|
<%:Unpack the package and place it in the top path.%>
|
|
</br>
|
|
<%:The author binary version number may not have changed.%>
|
|
</br>
|
|
<%:If you successfully update, the refresh page is still lower than the latest version.%>
|
|
</br>
|
|
<%:This is normal.%>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
function getver() {
|
|
XHR.get('<%=url([[admin]], [[services]], [[supervisord]], [[getver]])%>', null,
|
|
function(x, data) {
|
|
const tb = document.getElementById('update');
|
|
if (data && tb) {
|
|
if (data.newver) {
|
|
tb.value = '<%:Local version is %>' + data.nowver + '<%:, New version is %>' + data.newver;
|
|
tb.setAttribute('newver', data.newver);
|
|
}else{
|
|
tb.value = '<%:The check failed. Please try again%>';
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
getver()
|
|
function check_version() {
|
|
const tb = document.getElementById('update');
|
|
const newver= tb.getAttribute("newver")
|
|
if (newver){
|
|
tb.disabled = true;
|
|
XHR.get('<%=url([[admin]], [[services]], [[supervisord]], [[update]])%>', {version: newver}, (x, r) => {
|
|
if (r.error == 0) {
|
|
tb.disabled = false;
|
|
tb.value = '<%:Local version is %>' + newver + '<%:, New version is %>' + newver;
|
|
} else {
|
|
tb.disabled = false;
|
|
tb.value = '<%:The update failed. Please try again%>';
|
|
}
|
|
});
|
|
}else{
|
|
getver()
|
|
}
|
|
}
|
|
</script>
|
|
<%+cbi/valuefooter%> |