diff --git a/luci-app-openclash/luasrc/controller/openclash.lua b/luci-app-openclash/luasrc/controller/openclash.lua index fd689c920..ca062abbe 100644 --- a/luci-app-openclash/luasrc/controller/openclash.lua +++ b/luci-app-openclash/luasrc/controller/openclash.lua @@ -521,9 +521,9 @@ function action_rule_mode() local cn_port = cn_port() if not daip or not cn_port then return end info = json.parse(luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/configs', dase, daip, cn_port))) - mode = info["mode"] + mode = info["mode"] or "rule" else - mode = uci:get("openclash", "config", "proxy_mode") or "info" + mode = uci:get("openclash", "config", "proxy_mode") or "rule" end luci.http.prepare_content("application/json") luci.http.write_json({ @@ -591,7 +591,7 @@ function action_log_level() local cn_port = cn_port() if not daip or not cn_port then return end info = json.parse(luci.sys.exec(string.format('curl -sL -m 3 -H "Content-Type: application/json" -H "Authorization: Bearer %s" -XGET http://"%s":"%s"/configs', dase, daip, cn_port))) - level = info["log-level"] + level = info["log-level"] or "info" else level = uci:get("openclash", "config", "log_level") or "info" end diff --git a/luci-app-openclash/root/etc/config/openclash b/luci-app-openclash/root/etc/config/openclash index 1713cabaf..0a447819f 100644 --- a/luci-app-openclash/root/etc/config/openclash +++ b/luci-app-openclash/root/etc/config/openclash @@ -74,47 +74,47 @@ config dns_servers config dns_servers option type 'https' - option group 'fallback' - option enabled '1' option ip 'doh.pub/dns-query' + option group 'fallback' + option enabled '1' config dns_servers option type 'https' - option group 'fallback' - option enabled '1' option ip 'dns.alidns.com/dns-query' + option group 'fallback' + option enabled '1' config dns_servers option type 'https' option group 'fallback' - option enabled '1' option ip 'cloudflare-dns.com/dns-query' + option enabled '1' config dns_servers option group 'fallback' - option enabled '1' option ip 'dns.rubyfish.cn/dns-query' option type 'https' + option enabled '1' config dns_servers - option enabled '0' option group 'fallback' option ip 'dns.google' option port '853' option type 'tls' + option enabled '0' config dns_servers - option enabled '0' option group 'fallback' option type 'https' option ip '1.1.1.1/dns-query' + option enabled '0' config dns_servers - option enabled '0' option group 'fallback' option ip '1.1.1.1' option port '853' option type 'tls' + option enabled '0' config dns_servers option enabled '0' @@ -122,17 +122,24 @@ config dns_servers option ip '8.8.8.8' option port '853' option type 'tls' - + config dns_servers - option enabled '0' option type 'udp' option group 'fallback' option ip '2001:4860:4860::8888' option port '53' + option enabled '0' config dns_servers - option enabled '0' option type 'udp' option group 'fallback' option ip '2001:4860:4860::8844' - option port '53' \ No newline at end of file + option port '53' + option enabled '0' + +config dns_servers + option type 'udp' + option group 'fallback' + option ip '2001:da8::666' + option port '53' + option enabled '1' \ No newline at end of file diff --git a/luci-app-openclash/root/etc/init.d/openclash b/luci-app-openclash/root/etc/init.d/openclash index b636ba666..ca6fa31f8 100644 --- a/luci-app-openclash/root/etc/init.d/openclash +++ b/luci-app-openclash/root/etc/init.d/openclash @@ -981,12 +981,12 @@ check_run_quick() else if [ -s "/tmp/openclash.change" ]; then for i in $check_file; do - if [ -z "$(grep "$i $(date -r $i)" "/tmp/openclash.change")" ]; then + if [ -z "$(grep "$i $(date -r $i)$" "/tmp/openclash.change")" ]; then LOG_OUT "Tip: Because of the file【 $i 】modificated, Pause quick start..." quick_start=false break fi - done + done 2>/dev/null fi fi } @@ -998,7 +998,7 @@ write_run_quick() : > "/tmp/openclash.change" for i in $check_file; do echo "$i $(date -r $i)" >> "/tmp/openclash.change" - done + done 2>/dev/null fi } diff --git a/luci-app-openclash/root/usr/share/openclash/openclash.sh b/luci-app-openclash/root/usr/share/openclash/openclash.sh index aee60cc85..e4b345110 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash.sh +++ b/luci-app-openclash/root/usr/share/openclash/openclash.sh @@ -232,9 +232,11 @@ change_dns() uci commit dhcp /etc/init.d/dnsmasq restart >/dev/null 2>&1 fi + iptables -t nat -D OUTPUT -j openclash_output >/dev/null 2>&1 + iptables -t mangle -D OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t nat -I OUTPUT -j openclash_output >/dev/null 2>&1 iptables -t mangle -I OUTPUT -j openclash_output >/dev/null 2>&1 - nohup /usr/share/openclash/openclash_watchdog.sh & + [ "$(unify_ps_status "openclash_watchdog.sh")" -eq 0 ] && [ "$(unify_ps_prevent)" -eq 0 ] && nohup /usr/share/openclash/openclash_watchdog.sh & fi } diff --git a/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh b/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh index 7361d8d6c..d5717e0f9 100644 --- a/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh +++ b/luci-app-openclash/root/usr/share/openclash/yml_proxys_set.sh @@ -618,6 +618,7 @@ EOF fi if [ ! -z "$grpc_service_name" ]; then cat >> "$SERVER_FILE" <<-EOF + network: grpc grpc-opts: grpc-service-name: "$grpc_service_name" EOF @@ -625,6 +626,7 @@ EOF if [ "$obfs_trojan" = "ws" ]; then if [ -n "$trojan_ws_path" ] || [ -n "$trojan_ws_headers" ]; then cat >> "$SERVER_FILE" <<-EOF + network: ws ws-opts: EOF fi