conf\config.yaml start.sh

This commit is contained in:
wnlen
2026-01-18 22:21:37 +08:00
parent e28e4e5138
commit d66a2d0ad2
2 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ ipv6: true
udp: true
external-controller: 127.0.0.1:9090
external-ui: /opt/clash-for-linux/conf/ui
external-ui: /opt/clash-for-linux/.config/mihomo/ui
proxies: []
proxy-groups: []

View File

@ -176,18 +176,18 @@ ensure_ui_links() {
force_write_controller_and_ui() {
local file="$1"
local controller="${EXTERNAL_CONTROLLER:-127.0.0.1:9090}"
local MIHOMO_UI_DIR="/opt/clash-for-linux/.config/mihomo/ui"
[ -n "$file" ] || return 1
# 1) external-controller
upsert_yaml_kv "$file" "external-controller" "$controller" || true
# 2) external-ui永远写稳定路径 Conf_Dir/ui脚本保证它存在且指向真实 UI
ensure_ui_links
# 2) external-ui使用 mihomo SAFE_PATH
mkdir -p "$MIHOMO_UI_DIR" 2>/dev/null || true
# 如果 UI 源目录缺失,就不要写 external-ui避免写一个死路径
if [ -e "$Conf_Dir/ui" ]; then
upsert_yaml_kv "$file" "external-ui" "$Conf_Dir/ui" || true
if [ -d "$MIHOMO_UI_DIR" ]; then
upsert_yaml_kv "$file" "external-ui" "$MIHOMO_UI_DIR" || true
fi
}