🏅 Sync 2022-06-11 20:39

This commit is contained in:
github-actions[bot] 2022-06-11 20:39:42 +08:00
parent 6d5abf7fd1
commit 9118177a5d
2 changed files with 8 additions and 5 deletions

View File

@ -596,7 +596,9 @@ function sub_info_get()
download = string.sub(string.match(info, "download=%d+"), 10, -1) or nil
total = tonumber(string.format("%.1f",string.sub(string.match(info, "total=%d+"), 7, -1))) or nil
used = tonumber(string.format("%.1f",(upload + download))) or nil
day_expire = tonumber(string.sub(string.match(info, "expire=%d+"), 8, -1)) or nil
if string.match(info, "expire=%d+") then
day_expire = tonumber(string.sub(string.match(info, "expire=%d+"), 8, -1)) or nil
end
expire = os.date("%Y-%m-%d", day_expire) or "null"
if day_expire and os.time() <= day_expire then
day_left = math.ceil((day_expire - os.time()) / (3600*24))
@ -605,6 +607,7 @@ function sub_info_get()
else
day_left = 0
end
if used and total and used <= total then
percent = string.format("%.1f",(used/total)*100) or nil
elseif used == nil or total == nil or total == 0 then
@ -1491,4 +1494,4 @@ function process_status(name)
else
return luci.sys.call(string.format("ps -w |grep '%s' |grep -v grep >/dev/null", name)) == 0
end
end
end

View File

@ -39,9 +39,9 @@ sub_info_get_<%=idname%>();
function progressbar_<%=idname%>(v, m, pc, np, f, t, tr) {
return String.format(
'<div style="width:250px; max-width:500px; position:relative; border:1px solid #999999; border-radius: 6px">' +
(pc <= 50 ? '<div style="background-color:#9edd9e; width:%d%%; height:35px; border-radius: 6px">' : (pc > 50 && pc <= 80 ? '<div style="background-color:#ffc99f; width:%d%%; height:35px">' : '<div style="background-color:#ffb9b9; width:%d%%; height:35px">')) +
'<div style="position:absolute; left:0; top:0; text-align:center; width:100%%">' +
'<small>%s '+(f ? f : '/')+' %s ' + (np ? "" : '(%s%%)') + '<br/>' + '%s (<%:Remaining%> %s <%:days%>)</small>' +
(pc <= 50 ? '<div style="background-color:#9edd9e; width:%d%%; height:36px; border-radius: 6px">' : (pc > 50 && pc <= 80 ? '<div style="background-color:#ffc99f; width:%d%%; height:35px">' : '<div style="background-color:#ffb9b9; width:%d%%; height:35px">')) +
'<div style="position:absolute; left:0;' + (t == "null" ? 'top:12px;' : 'top:0;') + 'text-align:center; width:100%%">' +
'<small>%s '+ (f ? f : '/') +' %s ' + (np ? "" : '(%s%%)') + (t == "null" ? '<div style="visibility: hidden;">' : '<div style="visibility: visible;">') + '%s (<%:Remaining%> %s <%:days%>)</small>' +
'</div>' +
'</div>' +
'</div>', pc, v, m, pc, t, tr