luci-app-openclash: bump to 0.40.3

This commit is contained in:
CN_SZTL 2020-09-13 00:50:07 +08:00
parent 88fdc7e962
commit a10bc629ef
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
10 changed files with 71 additions and 19 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.40.2 PKG_VERSION:=0.40.3
PKG_RELEASE:=beta PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash> PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -988,6 +988,16 @@ lan_ac()
} }
wan_ac()
{
if [ -z "$1" ]; then
return
fi
ipset add "$2" "$1" 2>/dev/null
}
firewall_redirect_exclude() firewall_redirect_exclude()
{ {
local section="$1" local section="$1"
@ -1040,7 +1050,6 @@ CONFIG_NAME=$(echo "$CONFIG_FILE" |awk -F '/' '{print $5}' 2>/dev/null)
do_run_mode() do_run_mode()
{ {
en_mode=$(uci get openclash.config.en_mode 2>/dev/null) en_mode=$(uci get openclash.config.en_mode 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
if [ "$en_mode" = "fake-ip-tun" ]; then if [ "$en_mode" = "fake-ip-tun" ]; then
en_mode_tun="1" en_mode_tun="1"
@ -1085,33 +1094,47 @@ do_run_core()
if [ "$en_mode_tun" = "1" ] || [ "$en_mode_tun" = "3" ]; then if [ "$en_mode_tun" = "1" ] || [ "$en_mode_tun" = "3" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun" core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 2
fi fi
if [ "$en_mode_tun" = "2" ]; then if [ "$en_mode_tun" = "2" ]; then
ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null
core_type="Game" core_type="Game"
echo "检测到配置了【Game】内核专属功能调用【Game】内核启动..." >$START_LOG
sleep 2
fi fi
if [ "$proxy_mode" = "script" ] || [ "$rule_source" = "ConnersHua" ] || [ "$rule_source" = "lhie1" ]; then if [ "$proxy_mode" = "script" ] || [ "$rule_source" = "ConnersHua" ] || [ "$rule_source" = "lhie1" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun" core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 2
fi fi
if [ -n "$(grep "^ \{0,\}rule-providers:" "$RULE_PROVIDER_FILE" 2>/dev/null)" ] && [ -n "$(grep "^ \{0,\}behavior" "$RULE_PROVIDER_FILE" 2>/dev/null |grep -v "^ \{0,\}#")" ]; then if [ -n "$(grep "^ \{0,\}rule-providers:" "$RULE_PROVIDER_FILE" 2>/dev/null)" ] && [ -n "$(grep "^ \{0,\}behavior" "$RULE_PROVIDER_FILE" 2>/dev/null |grep -v "^ \{0,\}#")" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
core_type="Tun" core_type="Tun"
echo "检测到配置了【Tun】内核专属功能调用【Tun】内核启动..." >$START_LOG
sleep 2
fi fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash" ] && [ -z "$core_type" ]; then if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash" ] && [ -z "$core_type" ]; then
ln -s /etc/openclash/core/clash /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash /etc/openclash/clash 2>/dev/null
echo "未检测到特殊配置调用【Dev】内核启动..." >$START_LOG
sleep 2
fi fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_tun" ] && [ "$core_type" != "Game" ]; then if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_tun" ] && [ "$core_type" != "Game" ]; then
ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_tun /etc/openclash/clash 2>/dev/null
echo "检测到【Dev】内核未安装调用【Tun】内核启动..." >$START_LOG
sleep 2
fi fi
if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_game" ] && [ "$core_type" != "Tun" ]; then if [ ! -f "/etc/openclash/clash" ] && [ -f "/etc/openclash/core/clash_game" ] && [ "$core_type" != "Tun" ]; then
ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null ln -s /etc/openclash/core/clash_game /etc/openclash/clash 2>/dev/null
echo "检测到【Dev】内核未安装调用【Game】内核启动..." >$START_LOG
sleep 2
fi fi
#权限检查 #权限检查
@ -1183,6 +1206,12 @@ if [ "$operation_mode" = "redir-host" ] && [ "$en_mode" = "redir-host" ]; then
fi fi
fi fi
if [ -n "$(uci get openclash.config.wan_ac_black_ips 2>/dev/null)" ]; then
ipset create wan_ac_black_ips hash:net
config_load "openclash"
config_list_foreach "config" "wan_ac_black_ips" wan_ac "wan_ac_black_ips"
fi
#local #local
ipset create localnetwork hash:net ipset create localnetwork hash:net
ipset add localnetwork 0.0.0.0/8 ipset add localnetwork 0.0.0.0/8
@ -1205,6 +1234,7 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
iptables -t nat -N openclash iptables -t nat -N openclash
iptables -t nat -F openclash iptables -t nat -F openclash
iptables -t nat -A openclash -m set --match-set localnetwork dst -j RETURN iptables -t nat -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t nat -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1 iptables -t nat -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
@ -1223,6 +1253,7 @@ if [ -z "$en_mode_tun" ] || [ "$en_mode_tun" -eq 3 ]; then
ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE" ip route add local 0.0.0.0/0 dev lo table "$PROXY_ROUTE_TABLE"
iptables -t mangle -N openclash iptables -t mangle -N openclash
iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN iptables -t mangle -A openclash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
@ -1308,6 +1339,7 @@ if [ -n "$en_mode_tun" ]; then
config_load "firewall" config_load "firewall"
config_foreach firewall_redirect_exclude "redirect" config_foreach firewall_redirect_exclude "redirect"
#其他流量 #其他流量
iptables -t mangle -A openclash -m set --match-set wan_ac_black_ips dst -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set --match-set lan_ac_black_ips src -j RETURN >/dev/null 2>&1
iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1 iptables -t mangle -A openclash -m set ! --match-set lan_ac_white_ips src -j RETURN >/dev/null 2>&1
if [ "$en_mode" = "redir-host" ]; then if [ "$en_mode" = "redir-host" ]; then
@ -1407,6 +1439,7 @@ revert_firewall()
ipset destroy china_ip_route >/dev/null 2>&1 ipset destroy china_ip_route >/dev/null 2>&1
ipset destroy lan_ac_white_ips >/dev/null 2>&1 ipset destroy lan_ac_white_ips >/dev/null 2>&1
ipset destroy lan_ac_black_ips >/dev/null 2>&1 ipset destroy lan_ac_black_ips >/dev/null 2>&1
ipset destroy wan_ac_black_ips >/dev/null 2>&1
} }
get_config() get_config()
@ -1417,6 +1450,7 @@ get_config()
da_password=$(uci get openclash.config.dashboard_password 2>/dev/null) da_password=$(uci get openclash.config.dashboard_password 2>/dev/null)
cn_port=$(uci get openclash.config.cn_port 2>/dev/null) cn_port=$(uci get openclash.config.cn_port 2>/dev/null)
proxy_port=$(uci get openclash.config.proxy_port 2>/dev/null) proxy_port=$(uci get openclash.config.proxy_port 2>/dev/null)
proxy_mode=$(uci get openclash.config.proxy_mode 2>/dev/null)
ipv6_enable=$(uci get openclash.config.ipv6_enable 2>/dev/null) ipv6_enable=$(uci get openclash.config.ipv6_enable 2>/dev/null)
http_port=$(uci get openclash.config.http_port 2>/dev/null) http_port=$(uci get openclash.config.http_port 2>/dev/null)
socks_port=$(uci get openclash.config.socks_port 2>/dev/null) socks_port=$(uci get openclash.config.socks_port 2>/dev/null)

File diff suppressed because one or more lines are too long

View File

@ -102,6 +102,7 @@ o.inputtitle = translate("Delete All File")
o.inputstyle = "remove" o.inputstyle = "remove"
o.write = function() o.write = function()
luci.sys.call("rm -rf /etc/openclash/proxy_provider/* >/dev/null 2>&1") luci.sys.call("rm -rf /etc/openclash/proxy_provider/* >/dev/null 2>&1")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "proxy-provider-file-manage"))
end end
o = a:option(Button, "Apply") o = a:option(Button, "Apply")

View File

@ -102,6 +102,7 @@ o.inputtitle = translate("Delete All File")
o.inputstyle = "remove" o.inputstyle = "remove"
o.write = function() o.write = function()
luci.sys.call("rm -rf /etc/openclash/rule_provider/* >/dev/null 2>&1") luci.sys.call("rm -rf /etc/openclash/rule_provider/* >/dev/null 2>&1")
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-file-manage"))
end end
o = a:option(Button, "Apply") o = a:option(Button, "Apply")

View File

@ -107,7 +107,7 @@ e.inputstyle="reset"
Button.render(e,t,a) Button.render(e,t,a)
end end
btnrm.write=function(a,t) btnrm.write=function(a,t)
fs.unlink("/etc/openclash/rule_provider/"..e[t].filename) fs.unlink("/etc/openclash/rule_provider/"..e[t].lfilename)
HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-manage")) HTTP.redirect(DISP.build_url("admin", "services", "openclash", "rule-providers-manage"))
end end

View File

@ -11,18 +11,18 @@ local uci = require "luci.model.uci".cursor()
m = Map(openclash, translate("Rule Providers and Groups")) m = Map(openclash, translate("Rule Providers and Groups"))
m.pageaction = false m.pageaction = false
m.description=translate("注意事项:<br/>游戏代理为测试功能,不保证可用性 \ m.description=translate("注意事项:<br/>游戏代理为测试功能,不保证规则可用性 \
<br/>\ <br/>\
<br/>1使:FallBackUDP \ <br/>1使:FallBackUDP \
<br/>2使 \ <br/>2使 \
<br/>3 \ <br/>3 \
<br/> \ <br/> \
<br/>使 \ <br/>使 \
<br/>1--UDP流量代理 \ <br/>1--UDP流量代理 \
<br/> \ <br/> \
<br/>TUN模式下使用 \ <br/>TUN模式下使用 \
<br/>1- \ <br/>1- \
<br/>2--TUN模式或者游戏模式并重新启动 \ <br/>2--TUN模式或者游戏模式并重新启动 \
<br/> \ <br/> \
<br/> \ <br/> \
<br/> \ <br/> \

View File

@ -167,7 +167,13 @@ end
o = s:option(DummyValue, "udp", translate("UDP Support")) o = s:option(DummyValue, "udp", translate("UDP Support"))
function o.cfgvalue(...) function o.cfgvalue(...)
return Value.cfgvalue(...) or translate("None") if Value.cfgvalue(...) == "true" then
return translate("支持")
elseif Value.cfgvalue(...) == "false" then
return translate("不支持")
else
return translate("None")
end
end end
o = s:option(DummyValue,"server",translate("Ping Latency")) o = s:option(DummyValue,"server",translate("Ping Latency"))

View File

@ -72,7 +72,7 @@ o:value("gvisor", translate("Gvisor"))
o.default = "system" o.default = "system"
o = s:taboption("op_mode", ListValue, "proxy_mode", font_red..bold_on..translate("Proxy Mode")..bold_off..font_off) o = s:taboption("op_mode", ListValue, "proxy_mode", font_red..bold_on..translate("Proxy Mode")..bold_off..font_off)
o.description = translate("Select Proxy Mode") o.description = translate("Select Proxy Mode, Use Script Mode Could Prevent Proxy BT traffics If Rules Support, eg.lhie1's")
o:value("rule", translate("Rule Proxy Mode")) o:value("rule", translate("Rule Proxy Mode"))
o:value("global", translate("Global Proxy Mode")) o:value("global", translate("Global Proxy Mode"))
o:value("direct", translate("Direct Proxy Mode")) o:value("direct", translate("Direct Proxy Mode"))
@ -243,7 +243,7 @@ end
---- Access Control ---- Access Control
if op_mode == "redir-host" then if op_mode == "redir-host" then
o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("Access Control Mode")) o = s:taboption("lan_ac", ListValue, "lan_ac_mode", translate("LAN Access Control Mode"))
o:value("0", translate("Black List Mode")) o:value("0", translate("Black List Mode"))
o:value("1", translate("White List Mode")) o:value("1", translate("White List Mode"))
o.default=0 o.default=0
@ -267,6 +267,10 @@ luci.ip.neighbors({ family = 4 }, function(entry)
end) end)
end end
o = s:taboption("lan_ac", DynamicList, "wan_ac_black_ips", translate("WAN Bypassed Host List"))
o.datatype = "ipaddr"
o.description = translate("In The Fake-IP Mode, Only Pure IP Requests Are Supported")
---- Rules Settings ---- Rules Settings
if op_mode == "fake-ip" then if op_mode == "fake-ip" then
o = s:taboption("rules", ListValue, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules(Access Control)")..bold_off..font_off) o = s:taboption("rules", ListValue, "enable_custom_clash_rules", font_red..bold_on..translate("Custom Clash Rules(Access Control)")..bold_off..font_off)

View File

@ -134,8 +134,8 @@ msgstr "选择运行模式Redir-Host模式下无法代理路由器自身流
msgid "Proxy Mode" msgid "Proxy Mode"
msgstr "*代理模式" msgstr "*代理模式"
msgid "Select Proxy Mode" msgid "Select Proxy Mode, Use Script Mode Could Prevent Proxy BT traffics If Rules Support, eg.lhie1's"
msgstr "选择默认代理模式" msgstr "选择默认代理模式如果规则支持使用脚本模式可以阻止代理BT流量比如lhie1规则"
msgid "Rule Proxy Mode" msgid "Rule Proxy Mode"
msgstr "Rule【策略代理】" msgstr "Rule【策略代理】"
@ -972,8 +972,8 @@ msgstr "切换"
msgid "Access Control" msgid "Access Control"
msgstr "访问控制" msgstr "访问控制"
msgid "Access Control Mode" msgid "LAN Access Control Mode"
msgstr "访问控制模式" msgstr "局域网访问控制模式"
msgid "Black List Mode" msgid "Black List Mode"
msgstr "黑名单模式" msgstr "黑名单模式"
@ -987,6 +987,12 @@ msgstr "不走代理的局域网LAN IP"
msgid "LAN Proxied Host List" msgid "LAN Proxied Host List"
msgstr "走代理的局域网LAN IP" msgstr "走代理的局域网LAN IP"
msgid "WAN Bypassed Host List"
msgstr "不走代理的WAN IP"
msgid "In The Fake-IP Mode, Only Pure IP Requests Are Supported"
msgstr "在Fake-IP模式下只支持过滤纯IP类型的请求"
msgid "Rule Match Proxy Mode" msgid "Rule Match Proxy Mode"
msgstr "*仅代理命中规则流量" msgstr "*仅代理命中规则流量"