mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-02-04 10:11:28 +08:00
conf\config.yaml start.sh
This commit is contained in:
@ -7,7 +7,7 @@ ipv6: true
|
|||||||
udp: true
|
udp: true
|
||||||
|
|
||||||
external-controller: 127.0.0.1:9090
|
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: []
|
proxies: []
|
||||||
proxy-groups: []
|
proxy-groups: []
|
||||||
|
|||||||
10
start.sh
10
start.sh
@ -176,18 +176,18 @@ ensure_ui_links() {
|
|||||||
force_write_controller_and_ui() {
|
force_write_controller_and_ui() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
local controller="${EXTERNAL_CONTROLLER:-127.0.0.1:9090}"
|
local controller="${EXTERNAL_CONTROLLER:-127.0.0.1:9090}"
|
||||||
|
local MIHOMO_UI_DIR="/opt/clash-for-linux/.config/mihomo/ui"
|
||||||
|
|
||||||
[ -n "$file" ] || return 1
|
[ -n "$file" ] || return 1
|
||||||
|
|
||||||
# 1) external-controller
|
# 1) external-controller
|
||||||
upsert_yaml_kv "$file" "external-controller" "$controller" || true
|
upsert_yaml_kv "$file" "external-controller" "$controller" || true
|
||||||
|
|
||||||
# 2) external-ui:永远写稳定路径 Conf_Dir/ui(脚本保证它存在且指向真实 UI)
|
# 2) external-ui:使用 mihomo SAFE_PATH
|
||||||
ensure_ui_links
|
mkdir -p "$MIHOMO_UI_DIR" 2>/dev/null || true
|
||||||
|
|
||||||
# 如果 UI 源目录缺失,就不要写 external-ui(避免写一个死路径)
|
if [ -d "$MIHOMO_UI_DIR" ]; then
|
||||||
if [ -e "$Conf_Dir/ui" ]; then
|
upsert_yaml_kv "$file" "external-ui" "$MIHOMO_UI_DIR" || true
|
||||||
upsert_yaml_kv "$file" "external-ui" "$Conf_Dir/ui" || true
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user