~修复proxies只有一行时无法正确生成配置文件的bug

This commit is contained in:
juewuy
2026-10-24 18:07:49 +08:00
parent b3b703778f
commit 0c0de44aea
2 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -4,6 +4,9 @@
check_config() { #检查clash配置文件
#检测节点或providers
sed -n "/^proxies:/,/^[a-z]/ { /^[a-z]/d; p; }" "$core_config_new" >"$TMPDIR"/proxies.yaml
if [ ! -s "$TMPDIR"/proxies.yaml ]; then
sed -n 's/^proxies:[[:space:]]*\[\(.*\)\][[:space:]]*$/ - \1/p' "$core_config_new" >"$TMPDIR"/proxies.yaml
fi
if ! grep -Eq 'server:|server":|server'\'':' "$TMPDIR"/proxies.yaml && ! grep -q 'proxy-providers:' "$core_config_new"; then
echo "-----------------------------------------------"
logger "获取到了配置文件【$core_config_new】,但似乎并不包含正确的节点信息!" 31
@@ -38,4 +41,4 @@ check_config() { #检查clash配置文件
done <"$TMPDIR"/clash_proxies
rm -rf "$TMPDIR"/clash_proxies
}
}
}