mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-02-04 10:11:28 +08:00
Update start.sh
This commit is contained in:
20
start.sh
20
start.sh
@ -343,9 +343,25 @@ if [ "$SKIP_CONFIG_REBUILD" != "true" ]; then
|
|||||||
|
|
||||||
# Configure Clash Dashboard
|
# Configure Clash Dashboard
|
||||||
Work_Dir="$(cd "$(dirname "$0")" && pwd)"
|
Work_Dir="$(cd "$(dirname "$0")" && pwd)"
|
||||||
Dashboard_Dir="${Work_Dir}/dashboard/public"
|
|
||||||
|
# SAFE_PATHS: only allow paths under $Conf_Dir, so place dashboard under conf via symlink
|
||||||
|
Dashboard_Src="${Work_Dir}/dashboard/public"
|
||||||
|
Dashboard_Link="${Conf_Dir}/ui"
|
||||||
|
|
||||||
if [ "$EXTERNAL_CONTROLLER_ENABLED" = "true" ]; then
|
if [ "$EXTERNAL_CONTROLLER_ENABLED" = "true" ]; then
|
||||||
sed -ri "s@^# external-ui:.*@external-ui: ${Dashboard_Dir}@g" "$Conf_Dir/config.yaml" || true
|
# create/update symlink
|
||||||
|
if [ -d "$Dashboard_Src" ]; then
|
||||||
|
ln -sfn "$Dashboard_Src" "$Dashboard_Link"
|
||||||
|
else
|
||||||
|
echo -e "\033[33m[WARN]\033[0m Dashboard source not found: $Dashboard_Src (external-ui may not work)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ensure external-ui points to conf subpath
|
||||||
|
if grep -qE '^[[:space:]]*external-ui:' "$Conf_Dir/config.yaml"; then
|
||||||
|
sed -i -E "s|^[[:space:]]*external-ui:.*$|external-ui: ${Dashboard_Link}|g" "$Conf_Dir/config.yaml"
|
||||||
|
else
|
||||||
|
printf "\nexternal-ui: %s\n" "$Dashboard_Link" >> "$Conf_Dir/config.yaml"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 写入 secret
|
# 写入 secret
|
||||||
|
|||||||
Reference in New Issue
Block a user