Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
chore: update rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Aug 15, 2023
1 parent 50d741d commit ea2c923
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
11 changes: 11 additions & 0 deletions luci-app-openclash/luasrc/model/cbi/openclash/other-rules-edit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,17 @@ end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "AntiIP", translate("Anti IP"))
o:depends("rule_name", "lhie1")
o.rmempty = true
for groupname in string.gmatch(groupnames, "([^'##\n']+)##") do
if groupname ~= nil and groupname ~= "" then
o:value(groupname)
end
end
o:value("DIRECT")
o:value("REJECT")

o = s:option(ListValue, "Domestic", translate("Domestic"))
o:depends("rule_name", "lhie1")
o:depends("rule_name", "ConnersHua")
Expand Down
4 changes: 2 additions & 2 deletions luci-app-openclash/root/usr/share/openclash/res/lhie1.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rules:
- RULE-SET, Anti IP, DIRECT
- RULE-SET, Reject, AdBlock
- RULE-SET, Special, DIRECT
- RULE-SET, Anti IP, Anti IP
- RULE-SET, Netflix, Netflix
- RULE-SET, Disney Plus, Disney
- RULE-SET, YouTube, YouTube
Expand Down Expand Up @@ -66,9 +66,9 @@ script:
code: |
def main(ctx, metadata):
ruleset_action = {
'Anti IP': 'DIRECT',
'Reject': 'AdBlock',
'Special': 'DIRECT',
'Anti IP': 'Anti IP',
'Netflix': 'Netflix',
'Disney Plus': 'Disney',
'YouTube': 'YouTube',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cfg_groups_set()
sed -i "s/new_servers_group \'${old_name_cfg}\'/new_servers_group \'${name}\'/g" $CFG_FILE 2>/dev/null
sed -i "s/relay_groups \'${old_name_cfg}\'/relay_groups \'${name}\'/g" $CFG_FILE 2>/dev/null
#第三方规则处理
OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOGo" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "OpenAI" "AppleTV" "Crypto" "Discord")
OTHER_RULE_NAMES=("GlobalTV" "AsianTV" "Proxy" "Youtube" "Bilibili" "Bahamut" "HBOGo" "HBOMax" "Pornhub" "Apple" "GoogleFCM" "Scholar" "Microsoft" "Netflix" "Disney" "Spotify" "Steam" "Speedtest" "Telegram" "PayPal" "Netease_Music" "AdBlock" "Domestic" "Others" "miHoYo" "OpenAI" "AppleTV" "Crypto" "Discord" "Anti IP")
for i in ${OTHER_RULE_NAMES[@]}; do
sed -i "s/option ${i} \'${old_name_cfg}\'/option ${i} \'${name}\'/g" $CFG_FILE 2>/dev/null
done 2>/dev/null
Expand Down
16 changes: 16 additions & 0 deletions luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,20 @@ cat >> "$SERVER_FILE" <<-EOF
- REJECT
- DIRECT
- Proxy
- name: Anti IP
type: select
proxies:
- DIRECT
- Proxy
EOF
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
if [ -f "/tmp/Proxy_Provider" ]; then
cat >> "$SERVER_FILE" <<-EOF
use:
EOF
fi
cat /tmp/Proxy_Provider >> $SERVER_FILE 2>/dev/null
cat >> "$SERVER_FILE" <<-EOF
- name: Asian TV
type: select
proxies:
Expand Down Expand Up @@ -1892,6 +1906,7 @@ ${uci_set}Spotify="Spotify"
${uci_set}Steam="Steam"
${uci_set}miHoYo="miHoYo"
${uci_set}AdBlock="AdBlock"
${uci_set}AntiIP="Anti IP"
${uci_set}Speedtest="Speedtest"
${uci_set}Telegram="Telegram"
${uci_set}Crypto="Crypto"
Expand Down Expand Up @@ -1929,6 +1944,7 @@ ${uci_set}Others="Others"
${UCI_DEL_LIST}="Discord" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Discord" >/dev/null 2>&1
${UCI_DEL_LIST}="PayPal" >/dev/null 2>&1 && ${UCI_ADD_LIST}="PayPal" >/dev/null 2>&1
${UCI_DEL_LIST}="Speedtest" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Speedtest" >/dev/null 2>&1
${UCI_DEL_LIST}="Anti IP" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Anti IP" >/dev/null 2>&1
${UCI_DEL_LIST}="Others" >/dev/null 2>&1 && ${UCI_ADD_LIST}="Others" >/dev/null 2>&1
}
elif [ "$rule_sources" = "ConnersHua_return" ] && [ "$servers_if_update" != "1" ] && [ -z "$if_game_proxy" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ yml_other_rules_get()
config_get "OpenAI" "$section" "OpenAI" "$Proxy"
config_get "AppleTV" "$section" "AppleTV" "$GlobalTV"
config_get "miHoYo" "$section" "miHoYo" "$Domestic"
config_get "AntiIP" "$section" "AntiIP" "$Domestic"
}

if [ "$1" != "0" ]; then
Expand Down Expand Up @@ -1001,6 +1002,7 @@ if [ "$1" != "0" ]; then
|| [ -z "$(grep -F "$PayPal" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Others" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$GoogleFCM" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$AntiIP" /tmp/Proxy_Group)" ]\
|| [ -z "$(grep -F "$Domestic" /tmp/Proxy_Group)" ]; then
LOG_OUT "Warning: Because of The Different Porxy-Group's Name, Stop Setting The Other Rules!"
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}"
Expand Down Expand Up @@ -1040,6 +1042,7 @@ if [ "$1" != "0" ]; then
.gsub(/,[\s]?Discovery Plus,[\s]?Global TV$/, ', Discovery Plus, $Discovery#delete_')
.gsub(/,[\s]?DAZN,[\s]?Global TV$/, ', DAZN, $DAZN#delete_')
.gsub(/,[\s]?Pornhub,[\s]?Global TV$/, ', Pornhub, $Pornhub#delete_')
.gsub(/,[\s]?Anti IP$/, ', $AntiIP#delete_')
.gsub(/,[\s]?Global TV$/, ', $GlobalTV#delete_')
.gsub(/,[\s]?Asian TV$/, ', $AsianTV#delete_')
.gsub(/,[\s]?Proxy$/, ', $Proxy#delete_')
Expand Down Expand Up @@ -1094,6 +1097,7 @@ if [ "$1" != "0" ]; then
.gsub!(/: \'PayPal\'/,': \'$PayPal#delete_\'')
.gsub!(/: \'Domestic\'/,': \'$Domestic#delete_\'')
.gsub!(/: \'Google FCM\'/,': \'$GoogleFCM#delete_\'')
.gsub!(/: \'Anti IP\'/,': \'$AntiIP#delete_\'')
.gsub!(/return \'Domestic\'$/, 'return \'$Domestic#delete_\'')
.gsub!(/return \'Others\'$/, 'return \'$Others#delete_\'')
.gsub!(/#delete_/, '');
Expand Down

0 comments on commit ea2c923

Please sign in to comment.