OpenClash: sync with upstream source

This commit is contained in:
CN_SZTL 2020-03-31 20:08:39 +08:00
parent c3458b5b63
commit 486cf828c2
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
9 changed files with 1053 additions and 57 deletions

View File

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

View File

@ -274,9 +274,17 @@ yml_dns_check()
fi
if [ ! -z "$(grep "^ \{0,\}listen:" "$CONFIG_FILE")" ]; then
sed -i "/^ \{0,\}listen:/c\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
if [ "$ipv6_enable" -ne 1 ]; then
sed -i "/^ \{0,\}listen:/c\ listen: 127.0.0.1:${dns_port}" "$CONFIG_FILE" 2>/dev/null
else
sed -i "/^ \{0,\}listen:/c\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
fi
else
sed -i "/^dns:/a\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
if [ "$ipv6_enable" -ne 1 ]; then
sed -i "/^dns:/a\ listen: 127.0.0.1:${dns_port}" "$CONFIG_FILE" 2>/dev/null
else
sed -i "/^dns:/a\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
fi
fi
uci set openclash.config.dns_port="$dns_port" && uci commit openclash
@ -773,7 +781,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
uci set firewall.openclash.reload=1 >/dev/null 2>&1
fi
if [ ! -z "$en_mode_tun" ] && [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
if [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
uci set firewall.@defaults[0].forward=ACCEPT >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
/etc/init.d/firewall reload >/dev/null 2>&1

File diff suppressed because one or more lines are too long

View File

@ -288,6 +288,12 @@ o:depends("rule_source", "ConnersHua")
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "Microsoft", translate("Microsoft"))
o:depends("rule_source", "lhie1")
for l in file:lines() do
o:value(l)
end
file:seek("set")
o = s:taboption("rules", ListValue, "Netflix", translate("Netflix"))
o:depends("rule_source", "lhie1")
for l in file:lines() do

View File

@ -597,6 +597,11 @@ cat >> "$SERVER_FILE" <<-EOF
proxies:
- DIRECT
- Proxy
- name: Microsoft
type: select
proxies:
- DIRECT
- Proxy
- name: Netflix
type: select
proxies:
@ -733,6 +738,7 @@ uci set openclash.config.GlobalTV="GlobalTV"
uci set openclash.config.AsianTV="AsianTV"
uci set openclash.config.Proxy="Proxy"
uci set openclash.config.Apple="Apple"
uci set openclash.config.Microsoft="Microsoft"
uci set openclash.config.Netflix="Netflix"
uci set openclash.config.Spotify="Spotify"
uci set openclash.config.Steam="Steam"

View File

@ -37,6 +37,7 @@ if [ "$2" != 0 ]; then
Speedtest=$(grep '##Speedtest:' "$4" |awk -F ':' '{print $2}')
Telegram=$(grep '##Telegram:' "$4" |awk -F ':' '{print $2}')
PayPal=$(grep '##PayPal:' "$4" |awk -F ':' '{print $2}')
Microsoft=$(grep '##Microsoft:' "$4" |awk -F ':' '{print $2}')
if [ "$2" = "ConnersHua_return" ]; then
if [ "$(uci get openclash.config.Proxy)" != "$Proxy" ]\
@ -65,6 +66,7 @@ if [ "$2" != 0 ]; then
|| [ "$(uci get openclash.config.Netease_Music)" != "$Netease_Music" ]\
|| [ "$(uci get openclash.config.Speedtest)" != "$Speedtest" ]\
|| [ "$(uci get openclash.config.Telegram)" != "$Telegram" ]\
|| [ "$(uci get openclash.config.Microsoft)" != "$Microsoft" ]\
|| [ "$(uci get openclash.config.PayPal)" != "$PayPal" ]\
|| [ "$(uci get openclash.config.Others)" != "$Others" ]\
|| [ "$(uci get openclash.config.Domestic)" != "$Domestic" ]; then
@ -85,43 +87,49 @@ if [ "$2" != 0 ]; then
Netease_Music=$(uci get openclash.config.Netease_Music 2>/dev/null)
Speedtest=$(uci get openclash.config.Speedtest 2>/dev/null)
Telegram=$(uci get openclash.config.Telegram 2>/dev/null)
Microsoft=$(uci get openclash.config.Microsoft 2>/dev/null)
PayPal=$(uci get openclash.config.PayPal 2>/dev/null)
Domestic=$(uci get openclash.config.Domestic 2>/dev/null)
Others=$(uci get openclash.config.Others 2>/dev/null)
if [ "$2" = "lhie1" ]; then
sed -i '/^Rule:/,$d' "$4"
cat /etc/openclash/lhie1.yaml >> "$4"
sed -i -e "s/,GlobalTV/,${GlobalTV}#d/g" -e "/Rule:/a\##GlobalTV:${GlobalTV}"\
-e "s/,AsianTV/,${AsianTV}#d/g" -e "/Rule:/a\##AsianTV:${AsianTV}"\
-e "s/,Proxy/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,Apple/,${Apple}#d/g" -e "/Rule:/a\##Apple:${Apple}"\
-e "s/,Netflix/,${Netflix}#d/g" -e "/Rule:/a\##Netflix:${Netflix}"\
-e "s/,Spotify/,${Spotify}#d/g" -e "/Rule:/a\##Spotify:${Spotify}"\
-e "s/,Steam/,${Steam}#d/g" -e "/Rule:/a\##Steam:${Steam}"\
-e "s/,AdBlock/,${AdBlock}#d/g" -e "/Rule:/a\##AdBlock:${AdBlock}"\
-e "s/,Netease Music/,${Netease_Music}#d/g" -e "/Rule:/a\##Netease_Music:${Netease_Music}"\
-e "s/,Speedtest/,${Speedtest}#d/g" -e "/Rule:/a\##Speedtest:${Speedtest}"\
-e "s/,Telegram/,${Telegram}#d/g" -e "/Rule:/a\##Telegram:${Telegram}"\
-e "s/,PayPal/,${PayPal}#d/g" -e "/Rule:/a\##PayPal:${PayPal}"\
-e "s/,Domestic/,${Domestic}#d/g" -e "/Rule:/a\##Domestic:${Domestic}"\
-e "s/,Others/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
sed -i -e "s/,GlobalTV$/,${GlobalTV}#d/g" -e "/Rule:/a\##GlobalTV:${GlobalTV}"\
-e "s/,AsianTV$/,${AsianTV}#d/g" -e "/Rule:/a\##AsianTV:${AsianTV}"\
-e "s/,Proxy$/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,Apple$/,${Apple}#d/g"\
-e "s/,Apple,no-resolve$/,${Apple},no-resolve#d/g" -e "/Rule:/a\##Apple:${Apple}"\
-e "s/,Netflix$/,${Netflix}#d/g" -e "/Rule:/a\##Netflix:${Netflix}"\
-e "s/,Spotify$/,${Spotify}#d/g" -e "/Rule:/a\##Spotify:${Spotify}"\
-e "s/,Steam$/,${Steam}#d/g" -e "/Rule:/a\##Steam:${Steam}"\
-e "s/,AdBlock$/,${AdBlock}#d/g" -e "/Rule:/a\##AdBlock:${AdBlock}"\
-e "s/,Netease Music$/,${Netease_Music}#d/g" -e "/Rule:/a\##Netease_Music:${Netease_Music}"\
-e "s/,Speedtest$/,${Speedtest}#d/g" -e "/Rule:/a\##Speedtest:${Speedtest}"\
-e "s/,Telegram$/,${Telegram}#d/g" -e "/Rule:/a\##Telegram:${Telegram}"\
-e "s/,Microsoft$/,${Microsoft}#d/g" -e "/Rule:/a\##Microsoft:${Microsoft}"\
-e "s/,PayPal$/,${PayPal}#d/g" -e "/Rule:/a\##PayPal:${PayPal}"\
-e "s/,Domestic$/,${Domestic}#d/g" -e "/Rule:/a\##Domestic:${Domestic}"\
-e "s/,Others$/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
-e "s/#d//g" "$4"
elif [ "$2" = "ConnersHua" ]; then
sed -i '/^Rule:/,$d' "$4"
cat /etc/openclash/ConnersHua.yaml >> "$4"
sed -i -e "s/,GlobalMedia/,${GlobalTV}#d/g" -e "/Rule:/a\##GlobalTV:${GlobalTV}"\
-e "s/,HKMTMedia/,${AsianTV}#d/g" -e "/Rule:/a\##AsianTV:${AsianTV}"\
-e "s/,PROXY/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,Apple/,${Apple}#d/g" -e "/Rule:/a\##Apple:${Apple}"\
-e "s/,Hijacking/,${AdBlock}#d/g" -e "/Rule:/a\##AdBlock:${AdBlock}"\
-e "s/,DIRECT/,${Domestic}#d/g" -e "/Rule:/a\##Domestic:${Domestic}"\
-e "s/,Final/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
sed -i -e "s/,GlobalMedia$/,${GlobalTV}#d/g"\
-e "s/,GlobalMedia,no-resolve$/,${GlobalTV},no-resolve#d/g" -e "/Rule:/a\##GlobalTV:${GlobalTV}"\
-e "s/,HKMTMedia$/,${AsianTV}#d/g" -e "/Rule:/a\##AsianTV:${AsianTV}"\
-e "s/,PROXY$/,${Proxy}#d/g"\
-e "s/,PROXY,no-resolve$/,${Proxy},no-resolve#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,Apple$/,${Apple}#d/g" -e "/Rule:/a\##Apple:${Apple}"\
-e "s/,Hijacking,no-resolve$/,${AdBlock},no-resolve#d/g"\
-e "s/,Hijacking$/,${AdBlock}#d/g" -e "/Rule:/a\##AdBlock:${AdBlock}"\
-e "s/,DIRECT$/,${Domestic}#d/g" -e "/Rule:/a\##Domestic:${Domestic}"\
-e "s/,Final$/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
-e "s/#d//g" "$4"
else
sed -i '/^Rule:/,$d' "$4"
cat /etc/openclash/ConnersHua_return.yaml >> "$4"
sed -i -e "s/,PROXY/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,DIRECT/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
sed -i -e "s/,PROXY$/,${Proxy}#d/g" -e "/Rule:/a\##Proxy:${Proxy}"\
-e "s/,DIRECT$/,${Others}#d/g" -e "/Rule:/a\##Others:${Others}"\
-e "s/#d//g" "$4"
fi
fi

View File

@ -415,6 +415,9 @@ msgstr "必须代理的流量"
msgid "Apple"
msgstr "苹果服务流量"
msgid "Microsoft"
msgstr "微软服务流量"
msgid "Netflix"
msgstr "Netflix流量"