From 104e4ea91e47e5bbef09728e80fc87dd5473afc6 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Thu, 23 Jul 2020 01:50:45 +0800 Subject: [PATCH] OpenClash: sync with upstream source --- .../ctcgfw/luci-app-openclash/files/etc/config/openclash | 6 ++++++ .../ctcgfw/luci-app-openclash/files/etc/init.d/openclash | 7 ++----- .../files/usr/share/openclash/openclash_rule.sh | 1 + .../files/usr/share/openclash/yml_rules_change.sh | 8 ++++---- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/package/ctcgfw/luci-app-openclash/files/etc/config/openclash b/package/ctcgfw/luci-app-openclash/files/etc/config/openclash index ac29744758..72e9b7c109 100644 --- a/package/ctcgfw/luci-app-openclash/files/etc/config/openclash +++ b/package/ctcgfw/luci-app-openclash/files/etc/config/openclash @@ -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' \ No newline at end of file diff --git a/package/ctcgfw/luci-app-openclash/files/etc/init.d/openclash b/package/ctcgfw/luci-app-openclash/files/etc/init.d/openclash index 344a6255d3..8fc28b48a3 100755 --- a/package/ctcgfw/luci-app-openclash/files/etc/init.d/openclash +++ b/package/ctcgfw/luci-app-openclash/files/etc/init.d/openclash @@ -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 diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/openclash_rule.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/openclash_rule.sh index 43ef253bf6..e1fc398c7d 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/openclash_rule.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/openclash_rule.sh @@ -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 diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh index 5d5e000c90..09e177d021 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/yml_rules_change.sh @@ -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