From dda2d31901ec9a1ac0c155c843ea0dbcee5a471f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Oct 2021 08:59:25 +0800 Subject: [PATCH] update-10.27 --- luci-app-openclash/luasrc/controller/openclash.lua | 12 ++++++++++-- .../luasrc/model/cbi/openclash/servers.lua | 4 ++-- .../luasrc/view/openclash/server_list.htm | 4 ++-- luci-app-openclash/po/zh-cn/openclash.zh-cn.po | 2 ++ .../usr/share/openclash/openclash_debug_getcon.lua | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/luci-app-openclash/luasrc/controller/openclash.lua b/luci-app-openclash/luasrc/controller/openclash.lua index ca062abbe..eed4bd4ad 100644 --- a/luci-app-openclash/luasrc/controller/openclash.lua +++ b/luci-app-openclash/luasrc/controller/openclash.lua @@ -521,7 +521,11 @@ function action_rule_mode() local cn_port = cn_port() if not daip or not cn_port then return end info = json.parse(luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/configs', dase, daip, cn_port))) - mode = info["mode"] or "rule" + if info then + mode = info["mode"] + else + mode = uci:get("openclash", "config", "proxy_mode") or "rule" + end else mode = uci:get("openclash", "config", "proxy_mode") or "rule" end @@ -591,7 +595,11 @@ function action_log_level() local cn_port = cn_port() if not daip or not cn_port then return end info = json.parse(luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/configs', dase, daip, cn_port))) - level = info["log-level"] or "info" + if info then + level = info["log-level"] + else + level = uci:get("openclash", "config", "log_level") or "info" + end else level = uci:get("openclash", "config", "log_level") or "info" end diff --git a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua index 3765fc7e8..499c61a52 100644 --- a/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua +++ b/luci-app-openclash/luasrc/model/cbi/openclash/servers.lua @@ -162,9 +162,9 @@ end o = s:option(DummyValue, "udp", translate("UDP Support")) function o.cfgvalue(...) if Value.cfgvalue(...) == "true" then - return translate("支持") + return translate("Enable") elseif Value.cfgvalue(...) == "false" then - return translate("不支持") + return translate("Disable") else return translate("None") end diff --git a/luci-app-openclash/luasrc/view/openclash/server_list.htm b/luci-app-openclash/luasrc/view/openclash/server_list.htm index c5430f044..8c3d4c118 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" : "<%: 检测失败 %>"); + pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); } ); XHR.poll(10,'<%=dsp.build_url("admin", "services", "openclash", "ping")%>',{ @@ -24,7 +24,7 @@ local dsp = require "luci.dispatcher" domain: pings[i].getAttribute("hint") }, function(x, result) { - pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%: 检测失败 %>"); + pings[result.index].innerHTML = (result.ping ? ""+result.ping+" ms" : "<%:Test failed%>"); } ); } diff --git a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po index 6246eb4e5..635d6ec31 100644 --- a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po +++ b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po @@ -2450,3 +2450,5 @@ msgstr "未抓取到任何域名..." msgid "Will Run Once Immediately After Started, The Interval Does Not Need To Be Too Short (Take Effect Immediately After Commit)" msgstr "启动后会立即执行一次,间隔无需太短(修改后保存配置即可生效)" +msgid "Test failed" +msgstr "检测失败" \ No newline at end of file diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_debug_getcon.lua b/luci-app-openclash/root/usr/share/openclash/openclash_debug_getcon.lua index b8df04c5b..008962f62 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_debug_getcon.lua +++ b/luci-app-openclash/root/usr/share/openclash/openclash_debug_getcon.lua @@ -42,7 +42,7 @@ local function debug_getcon() if not addr then luci.sys.exec(string.format('echo "%s. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】" >> /tmp/openclash_debug.log', i, (info.connections[i].metadata.sourceIP), host, (info.connections[i].metadata.destinationIP), (info.connections[i].metadata.network), (info.connections[i].rulePayload),(info.connections[i].chains[1]))) elseif addr == "netflix-nflxvideo" then - if string.match(host, "nflxvideo.net") then + if string.match(host, "nflxvideo.net") or string.match(host, "amazonaws.com") then print(host) end else