OpenClash: sync with upstream source

This commit is contained in:
CN_SZTL 2020-07-23 01:50:45 +08:00
parent fe5e355670
commit 104e4ea91e
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
4 changed files with 13 additions and 9 deletions

View File

@ -59,3 +59,9 @@ config dns_servers
option type 'tls'
option enabled '0'
option group 'fallback'
config dns_servers
option ip 'doh.rixcloud.dev/dns-query'
option type 'https'
option enabled '0'
option group 'fallback'

View File

@ -275,7 +275,9 @@ yml_dns_check()
sed -i '/^Proxy:/i\ nameserver:' "$CONFIG_FILE" 2>/dev/null
fi 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - tls://8.8.8.8:853" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - https://doh.rixcloud.dev/dns-query" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ fallback:" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - 223.5.5.5" "$CONFIG_FILE" 2>/dev/null
sed -i "/^ \{0,\}nameserver:/a\ - 114.114.114.114" "$CONFIG_FILE" 2>/dev/null
fi
@ -656,8 +658,6 @@ sed -i '/OpenClash-Game-Rules-End/d' "$RULE_FILE" 2>/dev/null
sed -i '1,/^ \{0,\}- GEOIP,/{/^ \{0,\}- GEOIP,/s/^ \{0,\}- GEOIP,/#===================== OpenClash-Game-Rules =====================#\n&/}' "$RULE_FILE" 2>/dev/null
elif [ -n "$(grep "^ \{0,\}- MATCH," "$RULE_FILE")" ]; then
sed -i '1,/^ \{0,\}- MATCH,/{/^ \{0,\}- MATCH,/s/^ \{0,\}- MATCH,/#===================== OpenClash-Game-Rules =====================#\n&/}' "$RULE_FILE" 2>/dev/null
elif [ -n "$(grep "^ \{0,\}- FINAL," "$RULE_FILE")" ]; then
sed -i '1,/^ \{0,\}- FINAL,/{/^ \{0,\}- FINAL,/s/^ \{0,\}- FINAL,/#===================== OpenClash-Game-Rules =====================#\n&/}' "$RULE_FILE" 2>/dev/null
else
echo "#===================== OpenClash-Game-Rules =====================#" >> "$RULE_FILE" 2>/dev/null
fi
@ -705,9 +705,6 @@ yml_rule_set_add()
elif [ -n "$(grep "^ \{0,\}- MATCH," "$RULE_FILE")" ]; then
sed -i '1,/^ \{0,\}- MATCH,/{/^ \{0,\}- MATCH,/s/^ \{0,\}- MATCH,/#===================== OpenClash-Rule-Set-Extended-End =====================#\n&/}' "$RULE_FILE" 2>/dev/null
sed -i "/OpenClash-Rule-Set-Extended-End/i\#===================== OpenClash-Rule-Set-Extended =====================#" "$RULE_FILE" 2>/dev/null
elif [ -n "$(grep "^ \{0,\}- FINAL," "$RULE_FILE")" ]; then
sed -i '1,/^ \{0,\}- FINAL,/{/^ \{0,\}- FINAL,/s/^ \{0,\}- FINAL,/#===================== OpenClash-Rule-Set-Extended-End =====================#\n&/}' "$RULE_FILE" 2>/dev/null
sed -i "/OpenClash-Rule-Set-Extended-End/i\#===================== OpenClash-Rule-Set-Extended =====================#" "$RULE_FILE" 2>/dev/null
else
echo "#===================== OpenClash-Rule-Set-Extended =====================#" >> "$RULE_FILE" 2>/dev/null
echo "#===================== OpenClash-Rule-Set-Extended-End =====================#" >> "$RULE_FILE" 2>/dev/null

View File

@ -28,6 +28,7 @@
curl -sL --connect-timeout 10 --retry 2 https://raw.githubusercontent.com/DivineEngine/Profiles/master/Clash/Global.yaml -o /tmp/rules.yaml >/dev/null 2>&1
fi
sed -i -n '/^rule-providers:/,$p' /tmp/rules.yaml 2>/dev/null
sed -i "s/# - RULE-SET,ChinaIP,DIRECT/- RULE-SET,ChinaIP,DIRECT/g" /tmp/rules.yaml 2>/dev/null
elif [ "$RUlE_SOURCE" = "ConnersHua_return" ]; then
if pidof clash >/dev/null; then
curl -sL --connect-timeout 10 --retry 2 -x http://$PROXY_ADDR:$HTTP_PORT -U "$PROXY_AUTH" https://raw.githubusercontent.com/ConnersHua/Profiles/master/Clash/China.yaml -o /tmp/rules.yaml >/dev/null 2>&1

View File

@ -265,10 +265,10 @@ if [ "$2" != 0 ]; then
sed -i "/rules:/a\##Proxy:${Proxy}" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,China,DIRECT$/,China,${Domestic}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,China,DIRECT,no-resolve$/,China,${Domestic},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,ChinaIP,DIRECT$/,China,${Domestic}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,ChinaIP,DIRECT,no-resolve$/,China,${Domestic},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,CN,DIRECT$/,China,${Domestic}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,CN,DIRECT,no-resolve$/,China,${Domestic},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,ChinaIP,DIRECT$/,ChinaIP,${Domestic}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,ChinaIP,DIRECT,no-resolve$/,ChinaIP,${Domestic},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,CN,DIRECT$/,CN,${Domestic}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,CN,DIRECT,no-resolve$/,CN,${Domestic},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "/rules:/a\##Domestic:${Domestic}" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,MATCH$/,${Others}#d/g" "/tmp/other_rule.yaml" 2>/dev/null
sed -i "s/,MATCH,no-resolve$/,${Others},no-resolve#d/g" "/tmp/other_rule.yaml" 2>/dev/null