update-12.15

This commit is contained in:
github-actions[bot] 2021-12-15 09:03:33 +08:00
parent 2f2a805130
commit ada4f3eae4
22 changed files with 172 additions and 290 deletions

View File

@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=UnblockNeteaseMusic PKG_NAME:=UnblockNeteaseMusic
PKG_BASE_VERSION:=0.27.0-rc.2 PKG_BASE_VERSION:=0.27.0-rc.2
PKG_RELEASE:=43 PKG_RELEASE:=44
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/UnblockNeteaseMusic/server.git PKG_SOURCE_URL:=https://github.com/UnblockNeteaseMusic/server.git
PKG_SOURCE_DATE:=2021-11-27 PKG_SOURCE_DATE:=2021-11-27
PKG_SOURCE_VERSION:=0738798a7cf025b26ef454f983952cc2e18521db PKG_SOURCE_VERSION:=fc76cd994f03f931b6b753fd08ceb976dfc57caf
PKG_MIRROR_HASH:=skip PKG_MIRROR_HASH:=skip
PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION))

View File

@ -10,7 +10,7 @@ function index()
page = entry({"admin", "services", "openclash"}, alias("admin", "services", "openclash", "client"), _("OpenClash"), 50) page = entry({"admin", "services", "openclash"}, alias("admin", "services", "openclash", "client"), _("OpenClash"), 50)
page.dependent = true page.dependent = true
page.acl_depends = { "luci-app-openclash" } page.acl_depends = { "luci-app-openclash" }
entry({"admin", "services", "openclash", "client"},cbi("openclash/client"),_("Overviews"), 20).leaf = true entry({"admin", "services", "openclash", "client"},form("openclash/client"),_("Overviews"), 20).leaf = true
entry({"admin", "services", "openclash", "status"},call("action_status")).leaf=true entry({"admin", "services", "openclash", "status"},call("action_status")).leaf=true
entry({"admin", "services", "openclash", "state"},call("action_state")).leaf=true entry({"admin", "services", "openclash", "state"},call("action_state")).leaf=true
entry({"admin", "services", "openclash", "startlog"},call("action_start")).leaf=true entry({"admin", "services", "openclash", "startlog"},call("action_start")).leaf=true

View File

@ -7,35 +7,35 @@ local UTIL = require "luci.util"
local fs = require "luci.openclash" local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor() local uci = require("luci.model.uci").cursor()
m = Map("openclash") m = SimpleForm("openclash",translate("OpenClash"))
m.title = translate("OpenClash")
m.description = translate("A Clash Client For OpenWrt") m.description = translate("A Clash Client For OpenWrt")
m.pageaction = false m.reset = false
m.submit = false
m:section(SimpleSection).template = "openclash/status" m:section(SimpleSection).template = "openclash/status"
function IsYamlFile(e) function IsYamlFile(e)
e=e or"" e=e or""
local e=string.lower(string.sub(e,-5,-1)) local e=string.lower(string.sub(e,-5,-1))
return e == ".yaml" return e == ".yaml"
end end
function IsYmlFile(e) function IsYmlFile(e)
e=e or"" e=e or""
local e=string.lower(string.sub(e,-4,-1)) local e=string.lower(string.sub(e,-4,-1))
return e == ".yml" return e == ".yml"
end end
function config_check(CONFIG_FILE) function config_check(CONFIG_FILE)
local yaml = fs.isfile(CONFIG_FILE) local yaml = fs.isfile(CONFIG_FILE)
if yaml then if yaml then
yaml = SYS.exec(string.format('ruby -ryaml -E UTF-8 -e "puts YAML.load_file(\'%s\')" 2>/dev/null',CONFIG_FILE)) yaml = SYS.exec(string.format('ruby -ryaml -E UTF-8 -e "puts YAML.load_file(\'%s\')" 2>/dev/null',CONFIG_FILE))
if yaml ~= "false\n" and yaml ~= "" then if yaml ~= "false\n" and yaml ~= "" then
return "Config Normal" return "Config Normal"
else else
return "Config Abnormal" return "Config Abnormal"
end end
elseif (yaml ~= 0) then elseif (yaml ~= 0) then
return "File Not Exist" return "File Not Exist"
end end
end end
@ -48,21 +48,22 @@ e[t].num=string.format(t)
e[t].name=fs.basename(o) e[t].name=fs.basename(o)
BACKUP_FILE="/etc/openclash/backup/".. e[t].name BACKUP_FILE="/etc/openclash/backup/".. e[t].name
if fs.mtime(BACKUP_FILE) then if fs.mtime(BACKUP_FILE) then
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(BACKUP_FILE)) e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",fs.mtime(BACKUP_FILE))
else else
e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",a.mtime) e[t].mtime=os.date("%Y-%m-%d %H:%M:%S",a.mtime)
end end
if m.uci:get("openclash", "config", "config_path") and string.sub(m.uci:get("openclash", "config", "config_path"), 23, -1) == e[t].name then if uci:get("openclash", "config", "config_path") and string.sub(uci:get("openclash", "config", "config_path"), 23, -1) == e[t].name then
e[t].state=translate("Enable") e[t].state=translate("Enable")
else else
e[t].state=translate("Disable") e[t].state=translate("Disable")
end end
e[t].check=translate(config_check(o)) e[t].check=translate(config_check(o))
end end
end end
form = Map("openclash") form = SimpleForm("openclash")
form.pageaction = false form.reset = false
form.submit = false
tb=form:section(Table,e) tb=form:section(Table,e)
st=tb:option(DummyValue,"state",translate("State")) st=tb:option(DummyValue,"state",translate("State"))
st.template="openclash/cfg_check" st.template="openclash/cfg_check"
@ -92,16 +93,18 @@ SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "client")) HTTP.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "client"))
end end
s = Map("openclash") s = SimpleForm("openclash")
s.pageaction = false s.reset = false
s.submit = false
s:section(SimpleSection).template = "openclash/myip" s:section(SimpleSection).template = "openclash/myip"
local t = { local t = {
{enable, disable} {enable, disable}
} }
ap = Map("openclash") ap = SimpleForm("openclash")
ap.pageaction = false ap.reset = false
ap.submit = false
ss = ap:section(Table, t) ss = ap:section(Table, t)
@ -109,31 +112,33 @@ o = ss:option(Button, "enable", " ")
o.inputtitle = translate("Enable OpenClash") o.inputtitle = translate("Enable OpenClash")
o.inputstyle = "apply" o.inputstyle = "apply"
o.write = function() o.write = function()
uci:set("openclash", "config", "enable", 1) uci:set("openclash", "config", "enable", 1)
uci:commit("openclash") uci:commit("openclash")
SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &") SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &")
end end
o = ss:option(Button, "disable", " ") o = ss:option(Button, "disable", " ")
o.inputtitle = translate("Disable OpenClash") o.inputtitle = translate("Disable OpenClash")
o.inputstyle = "reset" o.inputstyle = "reset"
o.write = function() o.write = function()
uci:set("openclash", "config", "enable", 0) uci:set("openclash", "config", "enable", 0)
uci:commit("openclash") uci:commit("openclash")
SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &") SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &")
end end
d = Map("openclash") d = SimpleForm("openclash")
d.title = translate("Credits") d.title = translate("Credits")
d.pageaction = false d.reset = false
d.submit = false
d:section(SimpleSection).template = "openclash/developer" d:section(SimpleSection).template = "openclash/developer"
dler = Map("openclash") dler = SimpleForm("openclash")
dler.pageaction = false dler.reset = false
dler.submit = false
dler:section(SimpleSection).template = "openclash/dlercloud" dler:section(SimpleSection).template = "openclash/dlercloud"
if m.uci:get("openclash", "config", "dler_token") then if uci:get("openclash", "config", "dler_token") then
return m, dler, form, s, ap, d return m, dler, form, s, ap, d
else else
return m, form, s, ap, d return m, form, s, ap, d
end end

View File

@ -7,8 +7,8 @@ local sys = require "luci.sys"
local json = require "luci.jsonc" local json = require "luci.jsonc"
local sid = arg[1] local sid = arg[1]
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -9,8 +9,8 @@ local UTIL = require "luci.util"
local fs = require "luci.openclash" local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -8,8 +8,8 @@ local fs = require "luci.openclash"
local uci = require("luci.model.uci").cursor() local uci = require("luci.model.uci").cursor()
local CHIF = "0" local CHIF = "0"
font_green = [[<font color="green">]] font_green = [[<b style=color:green>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]
align_mid = [[<p align="center">]] align_mid = [[<p align="center">]]

View File

@ -6,8 +6,8 @@ local fs = require "luci.openclash"
local sys = require "luci.sys" local sys = require "luci.sys"
local sid = arg[1] local sid = arg[1]
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]
@ -129,4 +129,4 @@ o.write = function()
luci.http.redirect(m.redirect) luci.http.redirect(m.redirect)
end end
return m return m

View File

@ -6,9 +6,9 @@ local fs = require "luci.openclash"
local sys = require "luci.sys" local sys = require "luci.sys"
local sid = arg[1] local sid = arg[1]
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_green = [[<font color="green">]] font_green = [[<b style=color:green>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]
@ -337,4 +337,4 @@ o.write = function()
luci.http.redirect(m.redirect) luci.http.redirect(m.redirect)
end end
return m return m

View File

@ -6,8 +6,8 @@ local sys = require "luci.sys"
local sid = arg[1] local sid = arg[1]
local fs = require "luci.openclash" local fs = require "luci.openclash"
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -6,8 +6,8 @@ local fs = require "luci.openclash"
local sys = require "luci.sys" local sys = require "luci.sys"
local sid = arg[1] local sid = arg[1]
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -7,8 +7,8 @@ local sys = require "luci.sys"
local sid = arg[1] local sid = arg[1]
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid") local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -4,8 +4,8 @@ local openclash = "openclash"
local uci = luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local fs = require "luci.openclash" local fs = require "luci.openclash"
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -8,9 +8,9 @@ local fs = require "luci.openclash"
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
local json = require "luci.jsonc" local json = require "luci.jsonc"
font_green = [[<font color="green">]] font_green = [[<b style=color:green>]]
font_red = [[<font color="red">]] font_red = [[<b style=color:red>]]
font_off = [[</font>]] font_off = [[</b>]]
bold_on = [[<strong>]] bold_on = [[<strong>]]
bold_off = [[</strong>]] bold_off = [[</strong>]]

View File

@ -1,6 +1,6 @@
<%+cbi/valueheader%> <%+cbi/valueheader%>
<% if self:cfgvalue(section) ~= false then %> <% if self:cfgvalue(section) ~= false then %>
<input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> /> <input class="btn cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> />
<% else %> <% else %>
- -
<% end %> <% end %>

View File

@ -16,7 +16,7 @@ local dsp = require "luci.dispatcher"
domain: pings[i].getAttribute("hint") domain: pings[i].getAttribute("hint")
}, },
function(x, result) { function(x, result) {
pings[result.index].innerHTML = (result.ping ? "<b><font color=green>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Test failed%></font></b>"); pings[result.index].innerHTML = (result.ping ? "<b style=color:green>"+result.ping+"</b> ms" : "<b style=color:red><%:Test failed%></b>");
} }
); );
XHR.poll(10,'<%=dsp.build_url("admin", "services", "openclash", "ping")%>',{ XHR.poll(10,'<%=dsp.build_url("admin", "services", "openclash", "ping")%>',{
@ -24,9 +24,9 @@ local dsp = require "luci.dispatcher"
domain: pings[i].getAttribute("hint") domain: pings[i].getAttribute("hint")
}, },
function(x, result) { function(x, result) {
pings[result.index].innerHTML = (result.ping ? "<b><font color=green>"+result.ping+"</font></b> ms" : "<b><font color=red><%:Test failed%></font></b>"); pings[result.index].innerHTML = (result.ping ? "<b style=color:green>"+result.ping+"</b> ms" : "<b style=color:red><%:Test failed%></b>");
} }
); );
} }
//]]> //]]>
</script> </script>

View File

@ -69,9 +69,9 @@ function export_ssr_url(btn, urlname, sid) {
textarea.select(); textarea.select();
try { try {
document.execCommand("copy"); // Security exception may be thrown by some browsers. document.execCommand("copy"); // Security exception may be thrown by some browsers.
s.innerHTML = "<font color='green'><%:Copy SSR to clipboard successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Copy SSR to clipboard successfully.%></font>";
} catch (ex) { } catch (ex) {
s.innerHTML = "<font color='red'><%:Unable to copy SSR to clipboard.%></font>"; s.innerHTML = "<font style=\"color:red\"><%:Unable to copy SSR to clipboard.%></font>";
} finally { } finally {
document.body.removeChild(textarea); document.body.removeChild(textarea);
} }
@ -83,7 +83,7 @@ function import_ssr_url(btn, urlname, sid) {
if (!s) return false; if (!s) return false;
var ssrurl = prompt("<%:Paste sharing link here%>", ""); var ssrurl = prompt("<%:Paste sharing link here%>", "");
if (ssrurl == null || ssrurl == "") { if (ssrurl == null || ssrurl == "") {
s.innerHTML = "<font color='red'><%:User cancelled.%></font>"; s.innerHTML = "<font style=\"color:red\"><%:User cancelled.%></font>";
return false; return false;
} }
s.innerHTML = ""; s.innerHTML = "";
@ -156,7 +156,7 @@ function import_ssr_url(btn, urlname, sid) {
if (param != undefined) { if (param != undefined) {
document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param);
} }
s.innerHTML = "<font color='green'><%:Import configuration information successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Import configuration information successfully.%></font>";
} else { } else {
var sstr = b64decsafe(url0); var sstr = b64decsafe(url0);
document.getElementsByName('cbid.openclash.' + sid + '.type')[0].value = ssu[0]; document.getElementsByName('cbid.openclash.' + sid + '.type')[0].value = ssu[0];
@ -171,7 +171,7 @@ function import_ssr_url(btn, urlname, sid) {
if (param != undefined) { if (param != undefined) {
document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param);
} }
s.innerHTML = "<font color='green'><%:Import configuration information successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Import configuration information successfully.%></font>";
} }
return false; return false;
case "ssr": case "ssr":
@ -204,7 +204,7 @@ function import_ssr_url(btn, urlname, sid) {
document.getElementsByName('cbid.openclash.' + sid + '.protocol_param')[0].value = dictvalue(pdict, 'protoparam'); document.getElementsByName('cbid.openclash.' + sid + '.protocol_param')[0].value = dictvalue(pdict, 'protoparam');
var rem = pdict['remarks']; var rem = pdict['remarks'];
if (typeof (rem) != 'undefined' && rem != '' && rem.length > 0) document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = b64decutf8safe(rem); if (typeof (rem) != 'undefined' && rem != '' && rem.length > 0) document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = b64decutf8safe(rem);
s.innerHTML = "<font color='green'><%:Import configuration information successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Import configuration information successfully.%></font>";
return false; return false;
case "trojan": case "trojan":
var url0, param = ""; var url0, param = "";
@ -246,7 +246,7 @@ function import_ssr_url(btn, urlname, sid) {
if (param != undefined) { if (param != undefined) {
document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param);
} }
s.innerHTML = "<font color='green'><%:Import configuration information successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Import configuration information successfully.%></font>";
return false; return false;
case "vmess": case "vmess":
var sstr = b64DecodeUnicode(ssu[1]); var sstr = b64DecodeUnicode(ssu[1]);
@ -302,10 +302,10 @@ function import_ssr_url(btn, urlname, sid) {
if (ssm.sni) { if (ssm.sni) {
document.getElementsByName('cbid.openclash.' + sid + '.servername')[0].value = ssm.sni; document.getElementsByName('cbid.openclash.' + sid + '.servername')[0].value = ssm.sni;
} }
s.innerHTML = "<font color='green'><%:Import configuration information successfully.%></font>"; s.innerHTML = "<font style=\"color:green\"><%:Import configuration information successfully.%></font>";
return false; return false;
default: default:
s.innerHTML = "<font color='red'><%:Invalid format.%></font>"; s.innerHTML = "<font style=\"color:red\"><%:Invalid format.%></font>";
return false; return false;
} }
} }

View File

@ -77,7 +77,7 @@
<span> <span>
&nbsp;&nbsp;<%:Up:%>&nbsp; &nbsp;&nbsp;<%:Up:%>&nbsp;
<span id="upload_"> <span id="upload_">
<font color=green> <font style=color:green>
0 KB/S 0 KB/S
</font> </font>
</span> </span>
@ -86,7 +86,7 @@
<span> <span>
&nbsp;&nbsp;<%:Down:%>&nbsp; &nbsp;&nbsp;<%:Down:%>&nbsp;
<span id="download_"> <span id="download_">
<font color=green> <font style=color:green>
0 KB/S 0 KB/S
</font> </font>
</span> </span>
@ -95,7 +95,7 @@
<span> <span>
&nbsp;&nbsp;<%:Up Total:%>&nbsp; &nbsp;&nbsp;<%:Up Total:%>&nbsp;
<span id="uploadtotal_"> <span id="uploadtotal_">
<font color=green> <font style=color:green>
0 KB 0 KB
</font> </font>
</span> </span>
@ -104,7 +104,7 @@
<span> <span>
&nbsp;&nbsp;<%:Down Total:%>&nbsp; &nbsp;&nbsp;<%:Down Total:%>&nbsp;
<span id="downloadtotal_"> <span id="downloadtotal_">
<font color=green> <font style=color:green>
0 KB 0 KB
</font> </font>
</span> </span>
@ -113,7 +113,7 @@
<span> <span>
&nbsp;&nbsp;<%:Connections:%>&nbsp; &nbsp;&nbsp;<%:Connections:%>&nbsp;
<span id="connect_t"> <span id="connect_t">
<font color=green> <font style=color:green>
0 0
</font> </font>
</span> </span>
@ -122,7 +122,7 @@
<span> <span>
&nbsp;&nbsp;<%:Ram:%>&nbsp; &nbsp;&nbsp;<%:Ram:%>&nbsp;
<span id="mem_t"> <span id="mem_t">
<font color=green> <font style=color:green>
0 KB 0 KB
</font> </font>
</span> </span>
@ -131,7 +131,7 @@
<span> <span>
&nbsp;&nbsp;<%:CPU:%>&nbsp; &nbsp;&nbsp;<%:CPU:%>&nbsp;
<span id="cpu_t"> <span id="cpu_t">
<font color=green> <font style=color:green>
0 % 0 %
</font> </font>
</span> </span>
@ -227,36 +227,36 @@
if ( x && x.status == 200 ) { if ( x && x.status == 200 ) {
if ( status.restricted_mode != "1" ) if ( status.restricted_mode != "1" )
{ {
clash.innerHTML = status.clash ? '<b><font color=green><%:Running%></font></b>' : '<b><font color=red><%:Not Running%></font></b>'; clash.innerHTML = status.clash ? '<b style=color:green><%:Running%></b>' : '<b style=color:red><%:Not Running%></b>';
} }
else else
{ {
clash.innerHTML = status.clash ? '<b><font color=green><%:Running%> <%:<Limited State>%></font></b>' : '<b><font color=red><%:Not Running%></font></b>'; clash.innerHTML = status.clash ? '<b style=color:green><%:Running%> <%:<Limited State>%></b>' : '<b style=color:red><%:Not Running%></b>';
} }
watchdog.innerHTML = status.watchdog ? '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b><font color=green><%:Running%></font></b>' : '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b><font color=red><%:Not Running%></font></b>'; watchdog.innerHTML = status.watchdog ? '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b style=color:green><%:Running%></b>' : '&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<%:Daemons%>:&nbsp;&nbsp;&nbsp;<b style=color:red><%:Not Running%></b>';
dase.innerHTML = status.dase ? "<b><font color=green>"+status.dase+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; dase.innerHTML = status.dase ? "<b style=color:green>"+status.dase+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
web.innerHTML = status.web ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Open Panel%>" onclick="return ycad_dashboard(this)"/>' : '<b><font color=red><%:Not Running%></font></b>'; web.innerHTML = status.web ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Open Panel%>" onclick="return ycad_dashboard(this)"/>' : '<b style=color:red><%:Not Running%></b>';
webo.innerHTML = status.web ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Open Panel%>" onclick="return net_dashboard(this)"/>' : '<b><font color=red><%:Not Running%></font></b>'; webo.innerHTML = status.web ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Open Panel%>" onclick="return net_dashboard(this)"/>' : '<b style=color:red><%:Not Running%></b>';
close_all_connection.innerHTML = status.clash ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Close All Connections%>" onclick="return b_close_all_connection(this)"/>' : '<b><font color=red><%:Not Running%></font></b>'; close_all_connection.innerHTML = status.clash ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Close All Connections%>" onclick="return b_close_all_connection(this)"/>' : '<b style=color:red><%:Not Running%></b>';
reload_firewall.innerHTML = status.clash ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Reload Firewall Rules%>" onclick="return b_reload_firewall(this)"/>' : '<b><font color=red><%:Not Running%></font></b>'; reload_firewall.innerHTML = status.clash ? '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Reload Firewall Rules%>" onclick="return b_reload_firewall(this)"/>' : '<b style=color:red><%:Not Running%></b>';
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check All Components Update%>" onclick="return all_one_key_update(this)"/>'; one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check All Components Update%>" onclick="return all_one_key_update(this)"/>';
update_subscribe.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Config Update%>" onclick="return b_update_subscribe(this)"/>'; update_subscribe.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Config Update%>" onclick="return b_update_subscribe(this)"/>';
update_other_rules.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Third Party Rules Update%>" onclick="return b_update_other_rules(this)"/>'; update_other_rules.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check Third Party Rules Update%>" onclick="return b_update_other_rules(this)"/>';
update_geoip.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check GEOIP Data Update%>" onclick="return b_update_geoip(this)"/>'; update_geoip.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check GEOIP Data Update%>" onclick="return b_update_geoip(this)"/>';
if (status.daip && window.location.hostname == status.daip) { if (status.daip && window.location.hostname == status.daip) {
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; daip.innerHTML = status.daip ? "<b style=color:green>"+status.daip+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
dapo.innerHTML = status.cn_port ? "<b><font color=green>"+status.cn_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; dapo.innerHTML = status.cn_port ? "<b style=color:green>"+status.cn_port+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port;
} }
else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port) else if (status.daip && window.location.hostname != status.daip && status.db_foward_domain && status.db_foward_port)
{ {
daip.innerHTML = status.db_foward_domain ? "<b><font color=green>"+status.db_foward_domain+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; daip.innerHTML = status.db_foward_domain ? "<b style=color:green>"+status.db_foward_domain+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
dapo.innerHTML = status.db_foward_port ? "<b><font color=green>"+status.db_foward_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; dapo.innerHTML = status.db_foward_port ? "<b style=color:green>"+status.db_foward_port+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.db_foward_domain + ":" + status.db_foward_port; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.db_foward_domain + ":" + status.db_foward_port;
} }
else { else {
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; daip.innerHTML = status.daip ? "<b style=color:green>"+status.daip+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
dapo.innerHTML = status.cn_port ? "<b><font color=green>"+status.cn_port+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>"; dapo.innerHTML = status.cn_port ? "<b style=color:green>"+status.cn_port+"</b>" : "<b style=color:red>"+"<%:Not Set%>"+"</b>";
luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port;
}; };
@ -267,7 +267,7 @@
else { else {
radio_mode.style.display = "none"; radio_mode.style.display = "none";
radio_de.style.display = ""; radio_de.style.display = "";
radio_de.innerHTML = "<b><font color=red><%:Not Running%></font></b>"; radio_de.innerHTML = "<b style=color:red><%:Not Running%></b>";
}; };
if (status.clash) { if (status.clash) {
@ -345,12 +345,12 @@
if (x && x.status == 200 && status.mode) { if (x && x.status == 200 && status.mode) {
if (status.mode == "fake-ip" || status.mode == "fake-ip-tun" || status.mode == "fake-ip-mix") if (status.mode == "fake-ip" || status.mode == "fake-ip-tun" || status.mode == "fake-ip-mix")
{ {
mode.innerHTML = status.clash ? "<b><font color=green><%:Fake-IP%></font></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b><font color=red><%:Not Running%></font></b>'; mode.innerHTML = status.clash ? "<b style=color:green><%:Fake-IP%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>';
radio_run_normal.innerHTML = "<%:Enhance%>" radio_run_normal.innerHTML = "<%:Enhance%>"
} }
else if (status.mode == "redir-host" || status.mode == "redir-host-tun" || status.mode == "redir-host-mix") else if (status.mode == "redir-host" || status.mode == "redir-host-tun" || status.mode == "redir-host-mix")
{ {
mode.innerHTML = status.clash ? "<b><font color=green><%:Redir-Host%></font></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b><font color=red><%:Not Running%></font></b>'; mode.innerHTML = status.clash ? "<b style=color:green><%:Redir-Host%></b>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;" : '<b style=color:red><%:Not Running%></b>';
radio_run_normal.innerHTML = "<%:Compatible%>" radio_run_normal.innerHTML = "<%:Compatible%>"
}; };
for (i=0; i<radio_ru.length; i++) { for (i=0; i<radio_ru.length; i++) {
@ -382,16 +382,16 @@
function state_get() { function state_get() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "state")%>', null, function(x, status) { XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "state")%>', null, function(x, status) {
if ( x && x.status == 200 ) { if ( x && x.status == 200 ) {
ipdb.innerHTML = status.ipdb ? "<b><font color=green>"+status.ipdb+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>"; ipdb.innerHTML = status.ipdb ? "<b style=color:green>"+status.ipdb+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
lhie1.innerHTML = status.lhie1 ? "<b><font color=green>"+status.lhie1+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>"; lhie1.innerHTML = status.lhie1 ? "<b style=color:green>"+status.lhie1+"/b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
ConnersHua.innerHTML = status.ConnersHua ? "<b><font color=green>"+status.ConnersHua+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>"; ConnersHua.innerHTML = status.ConnersHua ? "<b style=color:green>"+status.ConnersHua+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
ConnersHua_return.innerHTML = status.ConnersHua_return ? "<b><font color=green>"+status.ConnersHua_return+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>"; ConnersHua_return.innerHTML = status.ConnersHua_return ? "<b style=color:green>"+status.ConnersHua_return+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
chnroute.innerHTML = status.chnroute ? "<b><font color=green>"+status.chnroute+"</font></b>" : "<b><font color=red>"+"<%:File Not Exist%>"+"</font></b>"; chnroute.innerHTML = status.chnroute ? "<b style=color:green>"+status.chnroute+"</b>" : "<b style=color:red>"+"<%:File Not Exist%>"+"</b>";
if ( status.historychecktime != "0" ) { if ( status.historychecktime != "0" ) {
historychecktime.innerHTML = "<b><font color=green>"+status.historychecktime+"</font></b>"; historychecktime.innerHTML = "<b style=color:green>"+status.historychecktime+"</b>";
} }
else { else {
historychecktime.innerHTML = "<b><font color=green>"+"<%:No Backup%>"+"</font></b>"; historychecktime.innerHTML = "<b style=color:green>"+"<%:No Backup%>"+"</b>";
} }
} }
}); });
@ -428,30 +428,30 @@
ws_error = true; ws_error = true;
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show")%>', null, function(x, status) { XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show")%>', null, function(x, status) {
if (x && x.status == 200 && x.responseText != "") { if (x && x.status == 200 && x.responseText != "") {
document.getElementById("upload_").innerHTML = "<font color=green>"+status.up+"</font>"; document.getElementById("upload_").innerHTML = "<font style=\"color:green\">"+status.up+"</font>";
document.getElementById("download_").innerHTML = "<font color=green>"+status.down+"</font>"; document.getElementById("download_").innerHTML = "<font style=\"color:green\">"+status.down+"</font>";
document.getElementById("uploadtotal_").innerHTML = "<font color=green>"+status.up_total+"</font>"; document.getElementById("uploadtotal_").innerHTML = "<font style=\"color:green\">"+status.up_total+"</font>";
document.getElementById("downloadtotal_").innerHTML = "<font color=green>"+status.down_total+"</font>"; document.getElementById("downloadtotal_").innerHTML = "<font style=\"color:green\">"+status.down_total+"</font>";
document.getElementById("mem_t").innerHTML = "<font color=green>"+status.mem+"</font>"; document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">"+status.mem+"</font>";
document.getElementById("connect_t").innerHTML = "<font color=green>"+status.connections+"</font>"; document.getElementById("connect_t").innerHTML = "<font style=\"color:green\">"+status.connections+"</font>";
if (status.cpu <= 50) { if (status.cpu <= 50) {
document.getElementById("cpu_t").innerHTML = "<font color=green>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">"+status.cpu+" %</font>";
} }
else if (status.cpu >= 50 && status.cpu <= 80) { else if (status.cpu >= 50 && status.cpu <= 80) {
document.getElementById("cpu_t").innerHTML = "<font color=orange>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:orange\">"+status.cpu+" %</font>";
} }
else { else {
document.getElementById("cpu_t").innerHTML = "<font color=red>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:red\">"+status.cpu+" %</font>";
} }
} }
else { else {
document.getElementById("upload_").innerHTML = "<font color=green>0 B/S</font>"; document.getElementById("upload_").innerHTML = "<font style=\"color:green\">0 B/S</font>";
document.getElementById("download_").innerHTML = "<font color=green>0 B/S</font>"; document.getElementById("download_").innerHTML = "<font style=\"color:green\">0 B/S</font>";
document.getElementById("uploadtotal_").innerHTML = "<font color=green>0 KB</font>"; document.getElementById("uploadtotal_").innerHTML = "<font style=\"color:green\">0 KB</font>";
document.getElementById("downloadtotal_").innerHTML = "<font color=green>0 KB</font>"; document.getElementById("downloadtotal_").innerHTML = "<font style=\"color:green\">0 KB</font>";
document.getElementById("mem_t").innerHTML = "<font color=green>0 KB</font>"; document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">0 KB</font>";
document.getElementById("cpu_t").innerHTML = "<font color=green>0 %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">0 %</font>";
document.getElementById("connect_t").innerHTML = "<font color=green>0</font>"; document.getElementById("connect_t").innerHTML = "<font style=\"color:green\">0</font>";
} }
}); });
}; };
@ -459,35 +459,35 @@
function show_sys() { function show_sys() {
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show_sys")%>', null, function(x, status) { XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show_sys")%>', null, function(x, status) {
if (x && x.status == 200 && x.responseText != "") { if (x && x.status == 200 && x.responseText != "") {
document.getElementById("mem_t").innerHTML = "<font color=green>"+status.mem+"</font>"; document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">"+status.mem+"</font>";
if (status.cpu <= 50) { if (status.cpu <= 50) {
document.getElementById("cpu_t").innerHTML = "<font color=green>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">"+status.cpu+" %</font>";
} }
else if (status.cpu >= 50 && status.cpu <= 80) { else if (status.cpu >= 50 && status.cpu <= 80) {
document.getElementById("cpu_t").innerHTML = "<font color=orange>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:orange\">"+status.cpu+" %</font>";
} }
else { else {
document.getElementById("cpu_t").innerHTML = "<font color=red>"+status.cpu+" %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:red\">"+status.cpu+" %</font>";
} }
} }
else { else {
document.getElementById("mem_t").innerHTML = "<font color=green>0 KB</font>"; document.getElementById("mem_t").innerHTML = "<font style=\"color:green\">0 KB</font>";
document.getElementById("cpu_t").innerHTML = "<font color=green>0 %</font>"; document.getElementById("cpu_t").innerHTML = "<font style=\"color:green\">0 %</font>";
} }
}); });
}; };
function ws_tmessage(event) { function ws_tmessage(event) {
var data = JSON.parse(event.data) var data = JSON.parse(event.data)
document.getElementById("upload_").innerHTML = "<font color=green>"+bytesToSize(data.up)+"/S</font>"; document.getElementById("upload_").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.up)+"/S</font>";
document.getElementById("download_").innerHTML = "<font color=green>"+bytesToSize(data.down)+"/S</font>"; document.getElementById("download_").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.down)+"/S</font>";
}; };
function ws_cmessage(event) { function ws_cmessage(event) {
var data = JSON.parse(event.data) var data = JSON.parse(event.data)
document.getElementById("uploadtotal_").innerHTML = "<font color=green>"+bytesToSize(data.uploadTotal)+"</font>"; document.getElementById("uploadtotal_").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.uploadTotal)+"</font>";
document.getElementById("downloadtotal_").innerHTML = "<font color=green>"+bytesToSize(data.downloadTotal)+"</font>"; document.getElementById("downloadtotal_").innerHTML = "<font style=\"color:green\">"+bytesToSize(data.downloadTotal)+"</font>";
document.getElementById("connect_t").innerHTML = "<font color=green>"+Object.keys(data.connections).length+"</font>"; document.getElementById("connect_t").innerHTML = "<font style=\"color:green\">"+Object.keys(data.connections).length+"</font>";
show_sys(); show_sys();
}; };
@ -778,7 +778,7 @@
alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('msg=')[1]); alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('msg=')[1]);
} }
else if ( status.startlog != "\n" && status.startlog != "" ) { else if ( status.startlog != "\n" && status.startlog != "" ) {
startlog.innerHTML = '<b><font color="green">'+status.startlog+'</font></b>'; startlog.innerHTML = '<b style=color:green>'+status.startlog+'</b>';
} }
} }
}); });

View File

@ -118,67 +118,67 @@
var arr_model = cpu_models.split(","); var arr_model = cpu_models.split(",");
var cpu_model1 = arr_model[0]; var cpu_model1 = arr_model[0];
var cpu_model22 = arr_model[1]; var cpu_model22 = arr_model[1];
cpu_model.innerHTML = cpu_model1 ? "<b><font color=green>"+cpu_model1+"</font></b>" : "<b><font color=red><%:Model Not Found%></font></b>"; cpu_model.innerHTML = cpu_model1 ? "<b style=color:green>"+cpu_model1+"</b>" : "<b style=color:red><%:Model Not Found%></b>";
cpu_model2.innerHTML = cpu_model22 ? "<b><font color=green>"+cpu_model22+"</font></b>" : "<b><font color=red><%:Model Not Found%></font></b>"; cpu_model2.innerHTML = cpu_model22 ? "<b style=color:green>"+cpu_model22+"</b>" : "<b style=color:red><%:Model Not Found%></b>";
if ( status.upchecktime != "1" ) { if ( status.upchecktime != "1" ) {
checktime.innerHTML = "<b><font color=green>"+status.upchecktime+"</font></b>"; checktime.innerHTML = "<b style=color:green>"+status.upchecktime+"</b>";
} }
else { else {
checktime.innerHTML = "<b><font color=red><%:Check Failed%></font></b>"; checktime.innerHTML = "<b style=color:red><%:Check Failed%></b>";
} }
if ( status.corecv == "0" ) { if ( status.corecv == "0" ) {
core_cv.innerHTML = "<b><font color=red><%:File Not Exist%></font></b>"; core_cv.innerHTML = "<b style=color:red><%:File Not Exist%></b>";
} }
else if (status.corecv != "") { else if (status.corecv != "") {
core_cv.innerHTML = "<b><font color=green>"+status.corecv+"</font></b>"; core_cv.innerHTML = "<b style=color:green>"+status.corecv+"</b>";
} }
else { else {
core_cv.innerHTML = "<b><font color=red><%:Unknown%></font></b>"; core_cv.innerHTML = "<b style=color:red><%:Unknown%></b>";
} }
if ( status.coretuncv == "0" ) { if ( status.coretuncv == "0" ) {
core_tun_cv.innerHTML = "<b><font color=red><%:File Not Exist%></font></b>"; core_tun_cv.innerHTML = "<b style=color:red><%:File Not Exist%></b>";
} }
else if (status.coretuncv != "") { else if (status.coretuncv != "") {
core_tun_cv.innerHTML = "<b><font color=green>"+status.coretuncv+"</font></b>"; core_tun_cv.innerHTML = "<b style=color:green>"+status.coretuncv+"</b>";
} }
else { else {
core_tun_cv.innerHTML = "<b><font color=red><%:Unknown%></font></b>"; core_tun_cv.innerHTML = "<b style=color:red><%:Unknown%></b>";
} }
var corelv = status.corelv; var corelv = status.corelv;
var arr_core = corelv.split(","); var arr_core = corelv.split(",");
var corelvis = arr_core[0]; var corelvis = arr_core[0];
var coretunlvis = arr_core[1]; var coretunlvis = arr_core[1];
if (corelvis != status.corecv && corelvis != "") { if (corelvis != status.corecv && corelvis != "") {
core_lv.innerHTML = "<b><font color=green>"+corelvis+"<%:<New>%></font></b>"; core_lv.innerHTML = "<b style=color:green>"+corelvis+"<%:<New>%></b>";
} }
else if (corelvis != "" && corelvis == status.corecv) { else if (corelvis != "" && corelvis == status.corecv) {
core_lv.innerHTML = "<b><font color=green>"+corelvis+"</font></b>"; core_lv.innerHTML = "<b style=color:green>"+corelvis+"</b>";
} }
else { else {
core_lv.innerHTML = "<b><font color=red><%:Unknown%></font></b>"; core_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
} }
if (coretunlvis != status.coretuncv && coretunlvis != "") { if (coretunlvis != status.coretuncv && coretunlvis != "") {
core_tun_lv.innerHTML = "<b><font color=green>"+coretunlvis+"<%:<New>%></font></b>"; core_tun_lv.innerHTML = "<b style=color:green>"+coretunlvis+"<%:<New>%></b>";
} }
else if (coretunlvis != "" && coretunlvis == status.coretuncv) { else if (coretunlvis != "" && coretunlvis == status.coretuncv) {
core_tun_lv.innerHTML = "<b><font color=green>"+coretunlvis+"</font></b>"; core_tun_lv.innerHTML = "<b style=color:green>"+coretunlvis+"</b>";
} }
else { else {
core_tun_lv.innerHTML = "<b><font color=red><%:Unknown%></font></b>"; core_tun_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
} }
var oplv = status.oplv; var oplv = status.oplv;
var arr_op = oplv.split(","); var arr_op = oplv.split(",");
var oplvis = arr_op[0]; var oplvis = arr_op[0];
var new_op = arr_op[1]; var new_op = arr_op[1];
op_cv.innerHTML = status.opcv ? "<b><font color=green>"+status.opcv+"</font></b>" : "<b><font color=red><%:Unknown%></font></b>"; op_cv.innerHTML = status.opcv ? "<b style=color:green>"+status.opcv+"</b>" : "<b style=color:red><%:Unknown%></b>";
if ( new_op == "2" ) { if ( new_op == "2" ) {
op_lv.innerHTML = "<b><font color=green>"+oplvis+"<%:<New>%></font></b>"; op_lv.innerHTML = "<b style=color:green>"+oplvis+"<%:<New>%></b>";
} }
else if (oplvis != "") { else if (oplvis != "") {
op_lv.innerHTML = "<b><font color=green>"+oplvis+"</font></b>"; op_lv.innerHTML = "<b style=color:green>"+oplvis+"</b>";
} }
else { else {
op_lv.innerHTML = "<b><font color=red><%:Unknown%></font></b>"; op_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
} }
} }
}); });
@ -377,9 +377,9 @@
XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) { XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
if ( x && x.status == 200 ) { if ( x && x.status == 200 ) {
if ( status.startlog != "\n" && status.startlog != "" ) { if ( status.startlog != "\n" && status.startlog != "" ) {
update_tip.innerHTML = '<b><font color="green">'+status.startlog+'</font></b>'; update_tip.innerHTML = '<b style=color:green>'+status.startlog+'</b>';
} }
} }
}); });
//]]></script> //]]></script>

View File

@ -34,10 +34,6 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DATA) ./files/uci.defaults $(1)/etc/uci-defaults/95-default-settings $(INSTALL_DATA) ./files/uci.defaults $(1)/etc/uci-defaults/95-default-settings
$(INSTALL_DIR) $(1)/etc/config $(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/base_config.conf $(1)/etc/config/base_config $(INSTALL_DATA) ./files/base_config.conf $(1)/etc/config/base_config
$(INSTALL_DIR) $(1)/lib/wifi
$(INSTALL_DATA) ./files/wifi-init.sh $(1)/lib/wifi/wifi-init.sh
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/wifi-init.init $(1)/etc/init.d/wifi-init
$(INSTALL_DIR) $(1)/etc/profile.d $(INSTALL_DIR) $(1)/etc/profile.d
$(INSTALL_BIN) ./files/sysinfo.sh $(1)/etc/profile.d/sysinfo.sh $(INSTALL_BIN) ./files/sysinfo.sh $(1)/etc/profile.d/sysinfo.sh
$(INSTALL_DIR) $(1)/sbin $(INSTALL_DIR) $(1)/sbin
@ -48,4 +44,3 @@ define Package/$(PKG_NAME)/install
endef endef
$(eval $(call BuildPackage,$(PKG_NAME))) $(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -119,17 +119,14 @@ swap_info=$(LC_ALL=C free -m | grep "^Swap")
swap_usage=$( (awk '/Swap/ { printf("%3.0f", $3/$2*100) }' <<<${swap_info} 2>/dev/null || echo 0) | tr -c -d '[:digit:]') swap_usage=$( (awk '/Swap/ { printf("%3.0f", $3/$2*100) }' <<<${swap_info} 2>/dev/null || echo 0) | tr -c -d '[:digit:]')
swap_total=$(awk '{print $(2)}' <<<${swap_info}) swap_total=$(awk '{print $(2)}' <<<${swap_info})
[ ! -f /etc/config/network ] && { [ -f /etc/config/network ] && {
printf " System initializing please wait..."
echo ""
echo ""
}
c=0 c=0
while [ ! -f /etc/config/network ];do while [ ! -n "$(get_ip_addresses)" ];do
[ $c -eq 8 ] && break || let c++ [ $c -eq 7 ] && break || let c++
sleep 1 sleep 1
done done
ip_address="$(get_ip_addresses)" ip_address="$(get_ip_addresses)"
} || ip_address="10.0.0.1"
# display info # display info
display "系统负载" "${load%% *}" "${critical_load}" "0" "" "${load#* }" display "系统负载" "${load%% *}" "${critical_load}" "0" "" "${load#* }"
@ -143,7 +140,7 @@ printf "IP 地址: \x1B[92m%s\x1B[0m" "$ip_address"
echo "" # fixed newline echo "" # fixed newline
display "系统存储" "$root_usage" "90" "1" "%" " of $root_total" display "系统存储" "$root_usage" "90" "1" "%" " of $root_total"
printf "CPU 信息: \x1B[92m%s\x1B[0m\t" "$(/sbin/cpuinfo)" printf "CPU 信息: \x1B[92m%s\x1B[0m\t" "$(echo `/sbin/cpuinfo | cut -d '(' -f -1`)"
echo "" echo ""
display "数据存储" "$data_usage" "90" "1" "%" " of $data_total" display "数据存储" "$data_usage" "90" "1" "%" " of $data_total"

View File

@ -1,34 +0,0 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2020 X-WRT.COM
START=19
boot() {
. /lib/wifi/wifi-init.sh
local base wifi_init
local SSID SSID_PASSWD
base=`uci get base_config.@status[0].base 2>/dev/null`
base=$((base+0))
wifi_init=`uci get base_config.@status[0].wifi_init 2>/dev/null`
wifi_init=$((wifi_init+0))
test $base -lt 1 && {
wifi_init=1 #skip wifi_init=1 hook
}
test $wifi_init -lt 1 && {
wifi_first_init
wifi_init=1
}
uci set base_config.@status[0].wifi_init=$wifi_init
uci commit base_config
#XXX
test -f /rom/etc/uci-defaults/96-wizard-defaults && sh /rom/etc/uci-defaults/96-wizard-defaults
/etc/init.d/wifi-init disable
}

View File

@ -1,81 +0,0 @@
#!/bin/sh
wifi_setup_radio()
{
local radio=$1
uci get wireless.${radio} >/dev/null 2>&1 && {
#FIXME hack
local path
if test -e /sys/kernel/debug/ieee80211/phy0/mt76/dbdc &&
[ "$(readlink /sys/class/ieee80211/phy0/device)" = "$(readlink /sys/class/ieee80211/phy1/device)" ]; then
path="$(uci get wireless.${radio}.path)"
if test -z "${path#*+1}"; then
uci set wireless.${radio}.phy='phy1'
uci set wireless.${radio}.htmode='VHT80'
uci set wireless.${radio}.hwmode='11a'
else
uci set wireless.${radio}.phy='phy0'
uci set wireless.${radio}.htmode='HT20'
uci set wireless.${radio}.hwmode='11g'
fi
uci delete wireless.${radio}.path
fi
uci -q batch <<-EOT
set wireless.${radio}.disabled='0'
set wireless.${radio}.country='CN'
set wireless.${radio}.channel='auto'
EOT
if [ x`uci get wireless.${radio}.hwmode 2>/dev/null` = "x11a" ]; then
uci set wireless.${radio}.txpower='23'
else
uci set wireless.${radio}.txpower='20'
fi
obj=`uci add wireless wifi-iface`
test -n "$obj" && {
uci set wireless.$obj.device="${radio}"
uci set wireless.$obj.network='lan'
uci set wireless.$obj.mode='ap'
if [ x`uci get wireless.${radio}.hwmode 2>/dev/null` = "x11a" ]; then
uci set wireless.$obj.ssid="${SSID}_5G"
else
uci set wireless.$obj.ssid="${SSID}_2.4G"
fi
# uci set wireless.$obj.encryption='psk2'
uci set wireless.$obj.skip_inactivity_poll='1'
uci set wireless.$obj.wpa_group_rekey='0'
uci set wireless.$obj.wpa_pair_rekey='0'
uci set wireless.$obj.wpa_master_rekey='0'
uci set wireless.$obj.disassoc_low_ack='0'
# uci set wireless.$obj.key="${SSID_PASSWD}"
}
}
}
wifi_first_init()
{
SSID="${SSID-$(uci get base_config.@status[0].SSID 2>/dev/null || echo OpenWrt)}"
SSID_PASSWD="${SSID_PASSWD-$(uci get base_config.@status[0].SSID_PASSWD 2>/dev/null || echo 88888888)}"
while uci delete wireless.@wifi-iface[0] >/dev/null 2>&1; do :; done
for radio in radio0 radio1 radio2 radio3 wifi0 wifi1 wifi2 wifi3; do
wifi_setup_radio ${radio}
done
uci commit wireless
# wireless migration
local widx=0
local change=0
while uci rename wireless.@wifi-iface[$widx]=wifinet$widx >/dev/null 2>&1; do widx=$((widx+1)); done
uci changes wireless | tr ".='" " " | while read _ a b; do
if [ "x$a" != "x$b" ]; then
uci commit wireless
change=1
break
fi
done
[ "x$change" = "x0" ] && uci revert wireless
}