small-package/luci-app-gpsysupgrade/luasrc/view/admin_status/index/sysupgrade.htm

43 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%
local fs = require "nixio.fs"
local uci = require 'luci.model.uci'.cursor()
luci.sys.exec("opkg update >/dev/null &")
if fs.access('/etc/config/wizard') then
autoupgrade_fm = uci:get('wizard', 'default', 'autoupgrade_fm')
end
if autoupgrade_fm ~= '0' then
-%>
<script>
var tokenStr = '<%=token%>';
XHR.get('<%=url([[admin]], [[services]], [[gpsysupgrade]], [[sysversion_check]])%>', {
token: tokenStr,
model: ''
}, function(x,json) {
if(json.code) {
} else {
if(json.notice) {
sysUpgradeInfo = json;
setTimeout(function(){
var ckeckDetailElm = document.querySelector("#maincontent");
if(ckeckDetailElm) {
var urlNode = '';
if(json.version) {
urlNode = '<div class="alert-message fade-in success" style="display:flex;margin-top: -1.5rem;padding: 0.31rem 0rem;"><div style="flex:10"><a href="<%=url([[admin]], [[services]], [[gpsysupgrade]])%>"><p><%:New version available%>' + json.version + '</p></a></div></div>';
ckeckDetailElm.innerHTML=urlNode+ckeckDetailElm.innerHTML;
}
}
}, 0);
} else {
}
}
},300);
</script>
<% end -%>