diff --git a/UnblockNeteaseMusic/Makefile b/UnblockNeteaseMusic/Makefile index 8ca469696..a4700d591 100644 --- a/UnblockNeteaseMusic/Makefile +++ b/UnblockNeteaseMusic/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=UnblockNeteaseMusic PKG_BASE_VERSION:=0.27.0-rc.2 -PKG_RELEASE:=43 +PKG_RELEASE:=44 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/UnblockNeteaseMusic/server.git PKG_SOURCE_DATE:=2021-11-27 -PKG_SOURCE_VERSION:=0738798a7cf025b26ef454f983952cc2e18521db +PKG_SOURCE_VERSION:=fc76cd994f03f931b6b753fd08ceb976dfc57caf PKG_MIRROR_HASH:=skip PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) diff --git a/luci-app-openclash/luasrc/controller/openclash.lua b/luci-app-openclash/luasrc/controller/openclash.lua index 2441814c0..fe70da71b 100644 --- a/luci-app-openclash/luasrc/controller/openclash.lua +++ b/luci-app-openclash/luasrc/controller/openclash.lua @@ -10,7 +10,7 @@ function index() page = entry({"admin", "services", "openclash"}, alias("admin", "services", "openclash", "client"), _("OpenClash"), 50) page.dependent = true 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", "state"},call("action_state")).leaf=true entry({"admin", "services", "openclash", "startlog"},call("action_start")).leaf=true diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/client.lua b/luci-app-openclash/luasrc/model/cbi/openclash/client.lua index ddf10414b..e4f51e616 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/client.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/client.lua @@ -7,35 +7,35 @@ local UTIL = require "luci.util" local fs = require "luci.openclash" local uci = require("luci.model.uci").cursor() -m = Map("openclash") -m.title = translate("OpenClash") +m = SimpleForm("openclash",translate("OpenClash")) m.description = translate("A Clash Client For OpenWrt") -m.pageaction = false +m.reset = false +m.submit = false m:section(SimpleSection).template = "openclash/status" function IsYamlFile(e) - e=e or"" - local e=string.lower(string.sub(e,-5,-1)) - return e == ".yaml" + e=e or"" + local e=string.lower(string.sub(e,-5,-1)) + return e == ".yaml" end function IsYmlFile(e) - e=e or"" - local e=string.lower(string.sub(e,-4,-1)) - return e == ".yml" + e=e or"" + local e=string.lower(string.sub(e,-4,-1)) + return e == ".yml" end function config_check(CONFIG_FILE) - local yaml = fs.isfile(CONFIG_FILE) - if yaml then - 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 - return "Config Normal" - else - return "Config Abnormal" - end + local yaml = fs.isfile(CONFIG_FILE) + if yaml then + 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 + return "Config Normal" + else + return "Config Abnormal" + end elseif (yaml ~= 0) then - return "File Not Exist" + return "File Not Exist" end end @@ -48,21 +48,22 @@ e[t].num=string.format(t) e[t].name=fs.basename(o) BACKUP_FILE="/etc/openclash/backup/".. e[t].name 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 - 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 -if m.uci:get("openclash", "config", "config_path") and string.sub(m.uci:get("openclash", "config", "config_path"), 23, -1) == e[t].name then - e[t].state=translate("Enable") +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") else - e[t].state=translate("Disable") + e[t].state=translate("Disable") end e[t].check=translate(config_check(o)) end end -form = Map("openclash") -form.pageaction = false +form = SimpleForm("openclash") +form.reset = false +form.submit = false tb=form:section(Table,e) st=tb:option(DummyValue,"state",translate("State")) 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")) end -s = Map("openclash") -s.pageaction = false +s = SimpleForm("openclash") +s.reset = false +s.submit = false s:section(SimpleSection).template = "openclash/myip" local t = { {enable, disable} } -ap = Map("openclash") -ap.pageaction = false +ap = SimpleForm("openclash") +ap.reset = false +ap.submit = false ss = ap:section(Table, t) @@ -109,31 +112,33 @@ o = ss:option(Button, "enable", " ") o.inputtitle = translate("Enable OpenClash") o.inputstyle = "apply" o.write = function() - uci:set("openclash", "config", "enable", 1) - uci:commit("openclash") - SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &") + uci:set("openclash", "config", "enable", 1) + uci:commit("openclash") + SYS.call("/etc/init.d/openclash restart >/dev/null 2>&1 &") end o = ss:option(Button, "disable", " ") o.inputtitle = translate("Disable OpenClash") o.inputstyle = "reset" o.write = function() - uci:set("openclash", "config", "enable", 0) - uci:commit("openclash") - SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &") + uci:set("openclash", "config", "enable", 0) + uci:commit("openclash") + SYS.call("/etc/init.d/openclash stop >/dev/null 2>&1 &") end -d = Map("openclash") +d = SimpleForm("openclash") d.title = translate("Credits") -d.pageaction = false +d.reset = false +d.submit = false d:section(SimpleSection).template = "openclash/developer" -dler = Map("openclash") -dler.pageaction = false +dler = SimpleForm("openclash") +dler.reset = false +dler.submit = false dler:section(SimpleSection).template = "openclash/dlercloud" -if m.uci:get("openclash", "config", "dler_token") then - return m, dler, form, s, ap, d +if uci:get("openclash", "config", "dler_token") then + return m, dler, form, s, ap, d else return m, form, s, ap, d end \ No newline at end of file diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua index 92d8d3eff..8bc3fd166 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe-edit.lua @@ -7,8 +7,8 @@ local sys = require "luci.sys" local json = require "luci.jsonc" local sid = arg[1] -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe.lua index 4d5d2409a..d1b00fc5c 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config-subscribe.lua @@ -9,8 +9,8 @@ local UTIL = require "luci.util" local fs = require "luci.openclash" local uci = require "luci.model.uci".cursor() -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/config.lua index 5bf44d651..045ab050c 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/config.lua @@ -8,8 +8,8 @@ local fs = require "luci.openclash" local uci = require("luci.model.uci").cursor() local CHIF = "0" -font_green = [[]] -font_off = [[]] +font_green = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] align_mid = [[

]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/groups-config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/groups-config.lua index 89f3df741..30323056f 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/groups-config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/groups-config.lua @@ -6,8 +6,8 @@ local fs = require "luci.openclash" local sys = require "luci.sys" local sid = arg[1] -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] @@ -129,4 +129,4 @@ o.write = function() luci.http.redirect(m.redirect) end -return m \ No newline at end of file +return m diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua b/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua index ddf0bbbb1..5b1d89a36 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua @@ -6,9 +6,9 @@ local fs = require "luci.openclash" local sys = require "luci.sys" local sid = arg[1] -font_red = [[]] -font_green = [[]] -font_off = [[]] +font_red = [[]] +font_green = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] @@ -337,4 +337,4 @@ o.write = function() luci.http.redirect(m.redirect) end -return m \ No newline at end of file +return m diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/proxy-provider-config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/proxy-provider-config.lua index 17e76da57..d71eadf4a 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/proxy-provider-config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/proxy-provider-config.lua @@ -6,8 +6,8 @@ local sys = require "luci.sys" local sid = arg[1] local fs = require "luci.openclash" -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua index 2a42a6999..ba371ba03 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/rule-providers-config.lua @@ -6,8 +6,8 @@ local fs = require "luci.openclash" local sys = require "luci.sys" local sid = arg[1] -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/servers-config.lua b/luci-app-openclash/luasrc/model/cbi/openclash/servers-config.lua index fa0bd518c..8e817058b 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/servers-config.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/servers-config.lua @@ -7,8 +7,8 @@ local sys = require "luci.sys" local sid = arg[1] local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid") -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua index 499c61a52..bbb410cff 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua @@ -4,8 +4,8 @@ local openclash = "openclash" local uci = luci.model.uci.cursor() local fs = require "luci.openclash" -font_red = [[]] -font_off = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua b/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua index 185a89ce1..58fe325d5 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/settings.lua @@ -8,9 +8,9 @@ local fs = require "luci.openclash" local uci = require "luci.model.uci".cursor() local json = require "luci.jsonc" -font_green = [[]] -font_red = [[]] -font_off = [[]] +font_green = [[]] +font_red = [[]] +font_off = [[]] bold_on = [[]] bold_off = [[]] diff --git a/luci-app-openclash/luasrc/view/openclash/other_button.htm b/luci-app-openclash/luasrc/view/openclash/other_button.htm index 1c391ad98..a7a2e4957 100644 --- a/luci-app-openclash/luasrc/view/openclash/other_button.htm +++ b/luci-app-openclash/luasrc/view/openclash/other_button.htm @@ -1,6 +1,6 @@ <%+cbi/valueheader%> <% if self:cfgvalue(section) ~= false then %> - " style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> /> + " style="display: <%= display %>" type="submit"<%= attr("name", cbid) .. attr("id", cbid) .. attr("value", self.inputtitle or self.title)%> /> <% else %> - <% end %> diff --git a/luci-app-openclash/luasrc/view/openclash/server_list.htm b/luci-app-openclash/luasrc/view/openclash/server_list.htm index 8c3d4c118..bc373d3c0 100644 --- a/luci-app-openclash/luasrc/view/openclash/server_list.htm +++ b/luci-app-openclash/luasrc/view/openclash/server_list.htm @@ -16,7 +16,7 @@ local dsp = require "luci.dispatcher" domain: pings[i].getAttribute("hint") }, function(x, result) { - pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); + pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); } ); XHR.poll(10,'<%=dsp.build_url("admin", "services", "openclash", "ping")%>',{ @@ -24,9 +24,9 @@ local dsp = require "luci.dispatcher" domain: pings[i].getAttribute("hint") }, function(x, result) { - pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); + pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); } ); } //]]> - \ No newline at end of file + diff --git a/luci-app-openclash/luasrc/view/openclash/server_url.htm b/luci-app-openclash/luasrc/view/openclash/server_url.htm index 350970b72..134d70980 100644 --- a/luci-app-openclash/luasrc/view/openclash/server_url.htm +++ b/luci-app-openclash/luasrc/view/openclash/server_url.htm @@ -69,9 +69,9 @@ function export_ssr_url(btn, urlname, sid) { textarea.select(); try { document.execCommand("copy"); // Security exception may be thrown by some browsers. - s.innerHTML = "<%:Copy SSR to clipboard successfully.%>"; + s.innerHTML = "<%:Copy SSR to clipboard successfully.%>"; } catch (ex) { - s.innerHTML = "<%:Unable to copy SSR to clipboard.%>"; + s.innerHTML = "<%:Unable to copy SSR to clipboard.%>"; } finally { document.body.removeChild(textarea); } @@ -83,7 +83,7 @@ function import_ssr_url(btn, urlname, sid) { if (!s) return false; var ssrurl = prompt("<%:Paste sharing link here%>", ""); if (ssrurl == null || ssrurl == "") { - s.innerHTML = "<%:User cancelled.%>"; + s.innerHTML = "<%:User cancelled.%>"; return false; } s.innerHTML = ""; @@ -156,7 +156,7 @@ function import_ssr_url(btn, urlname, sid) { if (param != undefined) { document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); } - s.innerHTML = "<%:Import configuration information successfully.%>"; + s.innerHTML = "<%:Import configuration information successfully.%>"; } else { var sstr = b64decsafe(url0); document.getElementsByName('cbid.openclash.' + sid + '.type')[0].value = ssu[0]; @@ -171,7 +171,7 @@ function import_ssr_url(btn, urlname, sid) { if (param != undefined) { document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); } - s.innerHTML = "<%:Import configuration information successfully.%>"; + s.innerHTML = "<%:Import configuration information successfully.%>"; } return false; 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'); var rem = pdict['remarks']; if (typeof (rem) != 'undefined' && rem != '' && rem.length > 0) document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = b64decutf8safe(rem); - s.innerHTML = "<%:Import configuration information successfully.%>"; + s.innerHTML = "<%:Import configuration information successfully.%>"; return false; case "trojan": var url0, param = ""; @@ -246,7 +246,7 @@ function import_ssr_url(btn, urlname, sid) { if (param != undefined) { document.getElementsByName('cbid.openclash.' + sid + '.name')[0].value = decodeURI(param); } - s.innerHTML = "<%:Import configuration information successfully.%>"; + s.innerHTML = "<%:Import configuration information successfully.%>"; return false; case "vmess": var sstr = b64DecodeUnicode(ssu[1]); @@ -302,10 +302,10 @@ function import_ssr_url(btn, urlname, sid) { if (ssm.sni) { document.getElementsByName('cbid.openclash.' + sid + '.servername')[0].value = ssm.sni; } - s.innerHTML = "<%:Import configuration information successfully.%>"; + s.innerHTML = "<%:Import configuration information successfully.%>"; return false; default: - s.innerHTML = "<%:Invalid format.%>"; + s.innerHTML = "<%:Invalid format.%>"; return false; } } diff --git a/luci-app-openclash/luasrc/view/openclash/status.htm b/luci-app-openclash/luasrc/view/openclash/status.htm index b13bc22d3..ae2a3f38b 100644 --- a/luci-app-openclash/luasrc/view/openclash/status.htm +++ b/luci-app-openclash/luasrc/view/openclash/status.htm @@ -77,7 +77,7 @@   <%:Up:%>  - + 0 KB/S @@ -86,7 +86,7 @@   <%:Down:%>  - + 0 KB/S @@ -95,7 +95,7 @@   <%:Up Total:%>  - + 0 KB @@ -104,7 +104,7 @@   <%:Down Total:%>  - + 0 KB @@ -113,7 +113,7 @@   <%:Connections:%>  - + 0 @@ -122,7 +122,7 @@   <%:Ram:%>  - + 0 KB @@ -131,7 +131,7 @@   <%:CPU:%>  - + 0 % @@ -227,36 +227,36 @@ if ( x && x.status == 200 ) { if ( status.restricted_mode != "1" ) { - clash.innerHTML = status.clash ? '<%:Running%>' : '<%:Not Running%>'; + clash.innerHTML = status.clash ? '<%:Running%>' : '<%:Not Running%>'; } else { - clash.innerHTML = status.clash ? '<%:Running%> <%:%>' : '<%:Not Running%>'; + clash.innerHTML = status.clash ? '<%:Running%> <%:%>' : '<%:Not Running%>'; } - watchdog.innerHTML = status.watchdog ? '   |   <%:Daemons%>:   <%:Running%>' : '   |   <%:Daemons%>:   <%:Not Running%>'; - dase.innerHTML = status.dase ? ""+status.dase+"" : ""+"<%:Not Set%>"+""; - web.innerHTML = status.web ? '' : '<%:Not Running%>'; - webo.innerHTML = status.web ? '' : '<%:Not Running%>'; - close_all_connection.innerHTML = status.clash ? '' : '<%:Not Running%>'; - reload_firewall.innerHTML = status.clash ? '' : '<%:Not Running%>'; + watchdog.innerHTML = status.watchdog ? '   |   <%:Daemons%>:   <%:Running%>' : '   |   <%:Daemons%>:   <%:Not Running%>'; + dase.innerHTML = status.dase ? ""+status.dase+"" : ""+"<%:Not Set%>"+""; + web.innerHTML = status.web ? '' : '<%:Not Running%>'; + webo.innerHTML = status.web ? '' : '<%:Not Running%>'; + close_all_connection.innerHTML = status.clash ? '' : '<%:Not Running%>'; + reload_firewall.innerHTML = status.clash ? '' : '<%:Not Running%>'; one_key_update.innerHTML = ''; update_subscribe.innerHTML = ''; update_other_rules.innerHTML = ''; update_geoip.innerHTML = ''; if (status.daip && window.location.hostname == status.daip) { - daip.innerHTML = status.daip ? ""+status.daip+"" : ""+"<%:Not Set%>"+""; - dapo.innerHTML = status.cn_port ? ""+status.cn_port+"" : ""+"<%:Not Set%>"+""; + daip.innerHTML = status.daip ? ""+status.daip+"" : ""+"<%:Not Set%>"+""; + dapo.innerHTML = status.cn_port ? ""+status.cn_port+"" : ""+"<%:Not Set%>"+""; 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) { - daip.innerHTML = status.db_foward_domain ? ""+status.db_foward_domain+"" : ""+"<%:Not Set%>"+""; - dapo.innerHTML = status.db_foward_port ? ""+status.db_foward_port+"" : ""+"<%:Not Set%>"+""; + daip.innerHTML = status.db_foward_domain ? ""+status.db_foward_domain+"" : ""+"<%:Not Set%>"+""; + dapo.innerHTML = status.db_foward_port ? ""+status.db_foward_port+"" : ""+"<%:Not Set%>"+""; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.db_foward_domain + ":" + status.db_foward_port; } else { - daip.innerHTML = status.daip ? ""+status.daip+"" : ""+"<%:Not Set%>"+""; - dapo.innerHTML = status.cn_port ? ""+status.cn_port+"" : ""+"<%:Not Set%>"+""; + daip.innerHTML = status.daip ? ""+status.daip+"" : ""+"<%:Not Set%>"+""; + dapo.innerHTML = status.cn_port ? ""+status.cn_port+"" : ""+"<%:Not Set%>"+""; luci_protocol = (window.location.protocol == "http:" ? "ws://" : "wss://") + status.daip + ":" + status.cn_port; }; @@ -267,7 +267,7 @@ else { radio_mode.style.display = "none"; radio_de.style.display = ""; - radio_de.innerHTML = "<%:Not Running%>"; + radio_de.innerHTML = "<%:Not Running%>"; }; if (status.clash) { @@ -345,12 +345,12 @@ if (x && x.status == 200 && status.mode) { if (status.mode == "fake-ip" || status.mode == "fake-ip-tun" || status.mode == "fake-ip-mix") { - mode.innerHTML = status.clash ? "<%:Fake-IP%>   |   " : '<%:Not Running%>'; + mode.innerHTML = status.clash ? "<%:Fake-IP%>   |   " : '<%:Not Running%>'; radio_run_normal.innerHTML = "<%:Enhance%>" } else if (status.mode == "redir-host" || status.mode == "redir-host-tun" || status.mode == "redir-host-mix") { - mode.innerHTML = status.clash ? "<%:Redir-Host%>   |   " : '<%:Not Running%>'; + mode.innerHTML = status.clash ? "<%:Redir-Host%>   |   " : '<%:Not Running%>'; radio_run_normal.innerHTML = "<%:Compatible%>" }; for (i=0; i', null, function(x, status) { if ( x && x.status == 200 ) { - ipdb.innerHTML = status.ipdb ? ""+status.ipdb+"" : ""+"<%:File Not Exist%>"+""; - lhie1.innerHTML = status.lhie1 ? ""+status.lhie1+"" : ""+"<%:File Not Exist%>"+""; - ConnersHua.innerHTML = status.ConnersHua ? ""+status.ConnersHua+"" : ""+"<%:File Not Exist%>"+""; - ConnersHua_return.innerHTML = status.ConnersHua_return ? ""+status.ConnersHua_return+"" : ""+"<%:File Not Exist%>"+""; - chnroute.innerHTML = status.chnroute ? ""+status.chnroute+"" : ""+"<%:File Not Exist%>"+""; + ipdb.innerHTML = status.ipdb ? ""+status.ipdb+"" : ""+"<%:File Not Exist%>"+""; + lhie1.innerHTML = status.lhie1 ? ""+status.lhie1+"/b>" : ""+"<%:File Not Exist%>"+""; + ConnersHua.innerHTML = status.ConnersHua ? ""+status.ConnersHua+"" : ""+"<%:File Not Exist%>"+""; + ConnersHua_return.innerHTML = status.ConnersHua_return ? ""+status.ConnersHua_return+"" : ""+"<%:File Not Exist%>"+""; + chnroute.innerHTML = status.chnroute ? ""+status.chnroute+"" : ""+"<%:File Not Exist%>"+""; if ( status.historychecktime != "0" ) { - historychecktime.innerHTML = ""+status.historychecktime+""; + historychecktime.innerHTML = ""+status.historychecktime+""; } else { - historychecktime.innerHTML = ""+"<%:No Backup%>"+""; + historychecktime.innerHTML = ""+"<%:No Backup%>"+""; } } }); @@ -428,30 +428,30 @@ ws_error = true; XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show")%>', null, function(x, status) { if (x && x.status == 200 && x.responseText != "") { - document.getElementById("upload_").innerHTML = ""+status.up+""; - document.getElementById("download_").innerHTML = ""+status.down+""; - document.getElementById("uploadtotal_").innerHTML = ""+status.up_total+""; - document.getElementById("downloadtotal_").innerHTML = ""+status.down_total+""; - document.getElementById("mem_t").innerHTML = ""+status.mem+""; - document.getElementById("connect_t").innerHTML = ""+status.connections+""; + document.getElementById("upload_").innerHTML = ""+status.up+""; + document.getElementById("download_").innerHTML = ""+status.down+""; + document.getElementById("uploadtotal_").innerHTML = ""+status.up_total+""; + document.getElementById("downloadtotal_").innerHTML = ""+status.down_total+""; + document.getElementById("mem_t").innerHTML = ""+status.mem+""; + document.getElementById("connect_t").innerHTML = ""+status.connections+""; if (status.cpu <= 50) { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } else if (status.cpu >= 50 && status.cpu <= 80) { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } else { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } } else { - document.getElementById("upload_").innerHTML = "0 B/S"; - document.getElementById("download_").innerHTML = "0 B/S"; - document.getElementById("uploadtotal_").innerHTML = "0 KB"; - document.getElementById("downloadtotal_").innerHTML = "0 KB"; - document.getElementById("mem_t").innerHTML = "0 KB"; - document.getElementById("cpu_t").innerHTML = "0 %"; - document.getElementById("connect_t").innerHTML = "0"; + document.getElementById("upload_").innerHTML = "0 B/S"; + document.getElementById("download_").innerHTML = "0 B/S"; + document.getElementById("uploadtotal_").innerHTML = "0 KB"; + document.getElementById("downloadtotal_").innerHTML = "0 KB"; + document.getElementById("mem_t").innerHTML = "0 KB"; + document.getElementById("cpu_t").innerHTML = "0 %"; + document.getElementById("connect_t").innerHTML = "0"; } }); }; @@ -459,35 +459,35 @@ function show_sys() { XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "toolbar_show_sys")%>', null, function(x, status) { if (x && x.status == 200 && x.responseText != "") { - document.getElementById("mem_t").innerHTML = ""+status.mem+""; + document.getElementById("mem_t").innerHTML = ""+status.mem+""; if (status.cpu <= 50) { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } else if (status.cpu >= 50 && status.cpu <= 80) { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } else { - document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; + document.getElementById("cpu_t").innerHTML = ""+status.cpu+" %"; } } else { - document.getElementById("mem_t").innerHTML = "0 KB"; - document.getElementById("cpu_t").innerHTML = "0 %"; + document.getElementById("mem_t").innerHTML = "0 KB"; + document.getElementById("cpu_t").innerHTML = "0 %"; } }); }; function ws_tmessage(event) { var data = JSON.parse(event.data) - document.getElementById("upload_").innerHTML = ""+bytesToSize(data.up)+"/S"; - document.getElementById("download_").innerHTML = ""+bytesToSize(data.down)+"/S"; + document.getElementById("upload_").innerHTML = ""+bytesToSize(data.up)+"/S"; + document.getElementById("download_").innerHTML = ""+bytesToSize(data.down)+"/S"; }; function ws_cmessage(event) { var data = JSON.parse(event.data) - document.getElementById("uploadtotal_").innerHTML = ""+bytesToSize(data.uploadTotal)+""; - document.getElementById("downloadtotal_").innerHTML = ""+bytesToSize(data.downloadTotal)+""; - document.getElementById("connect_t").innerHTML = ""+Object.keys(data.connections).length+""; + document.getElementById("uploadtotal_").innerHTML = ""+bytesToSize(data.uploadTotal)+""; + document.getElementById("downloadtotal_").innerHTML = ""+bytesToSize(data.downloadTotal)+""; + document.getElementById("connect_t").innerHTML = ""+Object.keys(data.connections).length+""; show_sys(); }; @@ -778,7 +778,7 @@ alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('msg=')[1]); } else if ( status.startlog != "\n" && status.startlog != "" ) { - startlog.innerHTML = ''+status.startlog+''; + startlog.innerHTML = ''+status.startlog+''; } } }); diff --git a/luci-app-openclash/luasrc/view/openclash/update.htm b/luci-app-openclash/luasrc/view/openclash/update.htm index 3605a755d..92f7f3037 100644 --- a/luci-app-openclash/luasrc/view/openclash/update.htm +++ b/luci-app-openclash/luasrc/view/openclash/update.htm @@ -118,67 +118,67 @@ var arr_model = cpu_models.split(","); var cpu_model1 = arr_model[0]; var cpu_model22 = arr_model[1]; - cpu_model.innerHTML = cpu_model1 ? ""+cpu_model1+"" : "<%:Model Not Found%>"; - cpu_model2.innerHTML = cpu_model22 ? ""+cpu_model22+"" : "<%:Model Not Found%>"; + cpu_model.innerHTML = cpu_model1 ? ""+cpu_model1+"" : "<%:Model Not Found%>"; + cpu_model2.innerHTML = cpu_model22 ? ""+cpu_model22+"" : "<%:Model Not Found%>"; if ( status.upchecktime != "1" ) { - checktime.innerHTML = ""+status.upchecktime+""; + checktime.innerHTML = ""+status.upchecktime+""; } else { - checktime.innerHTML = "<%:Check Failed%>"; + checktime.innerHTML = "<%:Check Failed%>"; } if ( status.corecv == "0" ) { - core_cv.innerHTML = "<%:File Not Exist%>"; + core_cv.innerHTML = "<%:File Not Exist%>"; } else if (status.corecv != "") { - core_cv.innerHTML = ""+status.corecv+""; + core_cv.innerHTML = ""+status.corecv+""; } else { - core_cv.innerHTML = "<%:Unknown%>"; + core_cv.innerHTML = "<%:Unknown%>"; } if ( status.coretuncv == "0" ) { - core_tun_cv.innerHTML = "<%:File Not Exist%>"; + core_tun_cv.innerHTML = "<%:File Not Exist%>"; } else if (status.coretuncv != "") { - core_tun_cv.innerHTML = ""+status.coretuncv+""; + core_tun_cv.innerHTML = ""+status.coretuncv+""; } else { - core_tun_cv.innerHTML = "<%:Unknown%>"; + core_tun_cv.innerHTML = "<%:Unknown%>"; } var corelv = status.corelv; var arr_core = corelv.split(","); var corelvis = arr_core[0]; var coretunlvis = arr_core[1]; if (corelvis != status.corecv && corelvis != "") { - core_lv.innerHTML = ""+corelvis+"<%:%>"; + core_lv.innerHTML = ""+corelvis+"<%:%>"; } else if (corelvis != "" && corelvis == status.corecv) { - core_lv.innerHTML = ""+corelvis+""; + core_lv.innerHTML = ""+corelvis+""; } else { - core_lv.innerHTML = "<%:Unknown%>"; + core_lv.innerHTML = "<%:Unknown%>"; } if (coretunlvis != status.coretuncv && coretunlvis != "") { - core_tun_lv.innerHTML = ""+coretunlvis+"<%:%>"; + core_tun_lv.innerHTML = ""+coretunlvis+"<%:%>"; } else if (coretunlvis != "" && coretunlvis == status.coretuncv) { - core_tun_lv.innerHTML = ""+coretunlvis+""; + core_tun_lv.innerHTML = ""+coretunlvis+""; } else { - core_tun_lv.innerHTML = "<%:Unknown%>"; + core_tun_lv.innerHTML = "<%:Unknown%>"; } var oplv = status.oplv; var arr_op = oplv.split(","); var oplvis = arr_op[0]; var new_op = arr_op[1]; - op_cv.innerHTML = status.opcv ? ""+status.opcv+"" : "<%:Unknown%>"; + op_cv.innerHTML = status.opcv ? ""+status.opcv+"" : "<%:Unknown%>"; if ( new_op == "2" ) { - op_lv.innerHTML = ""+oplvis+"<%:%>"; + op_lv.innerHTML = ""+oplvis+"<%:%>"; } else if (oplvis != "") { - op_lv.innerHTML = ""+oplvis+""; + op_lv.innerHTML = ""+oplvis+""; } else { - op_lv.innerHTML = "<%:Unknown%>"; + op_lv.innerHTML = "<%:Unknown%>"; } } }); @@ -377,9 +377,9 @@ XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) { if ( x && x.status == 200 ) { if ( status.startlog != "\n" && status.startlog != "" ) { - update_tip.innerHTML = ''+status.startlog+''; + update_tip.innerHTML = ''+status.startlog+''; } } }); -//]]> \ No newline at end of file +//]]> diff --git a/my-default-settings/Makefile b/my-default-settings/Makefile index 76d3f00a7..e4c0bed78 100644 --- a/my-default-settings/Makefile +++ b/my-default-settings/Makefile @@ -34,10 +34,6 @@ define Package/$(PKG_NAME)/install $(INSTALL_DATA) ./files/uci.defaults $(1)/etc/uci-defaults/95-default-settings $(INSTALL_DIR) $(1)/etc/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_BIN) ./files/sysinfo.sh $(1)/etc/profile.d/sysinfo.sh $(INSTALL_DIR) $(1)/sbin @@ -48,4 +44,3 @@ define Package/$(PKG_NAME)/install endef $(eval $(call BuildPackage,$(PKG_NAME))) - diff --git a/my-default-settings/files/sysinfo.sh b/my-default-settings/files/sysinfo.sh index 273ae59a5..6e97e28e5 100644 --- a/my-default-settings/files/sysinfo.sh +++ b/my-default-settings/files/sysinfo.sh @@ -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_total=$(awk '{print $(2)}' <<<${swap_info}) -[ ! -f /etc/config/network ] && { -printf " System initializing please wait..." -echo "" -echo "" -} +[ -f /etc/config/network ] && { c=0 -while [ ! -f /etc/config/network ];do -[ $c -eq 8 ] && break || let c++ +while [ ! -n "$(get_ip_addresses)" ];do +[ $c -eq 7 ] && break || let c++ sleep 1 done ip_address="$(get_ip_addresses)" +} || ip_address="10.0.0.1" # display info display "系统负载" "${load%% *}" "${critical_load}" "0" "" "${load#* }" @@ -143,7 +140,7 @@ printf "IP 地址: \x1B[92m%s\x1B[0m" "$ip_address" echo "" # fixed newline 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 "" display "数据存储" "$data_usage" "90" "1" "%" " of $data_total" diff --git a/my-default-settings/files/wifi-init.init b/my-default-settings/files/wifi-init.init deleted file mode 100644 index b580adbf7..000000000 --- a/my-default-settings/files/wifi-init.init +++ /dev/null @@ -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 -} diff --git a/my-default-settings/files/wifi-init.sh b/my-default-settings/files/wifi-init.sh deleted file mode 100644 index 116edf284..000000000 --- a/my-default-settings/files/wifi-init.sh +++ /dev/null @@ -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 -}