mirror of
https://github.com/wnlen/clash-for-linux.git
synced 2026-10-10 04:03:04 +08:00
fix: 修复局域网代理开关持久化
clashctl lan off 原本只更新 config/template.yaml,但运行配置生成流程会在规范化之后继续应用 runtime/mixin.yaml。 如果已有 mixin override 将 allow-lan 设为 true,最终生成的 runtime/config.yaml 会被重新覆盖为 true,导致 mihomo 仍监听局域网地址。 现在将同一个 allow-lan 值同步写入 runtime mixin override,确保 lan on/off 能保留到最终合并后的运行配置。
This commit is contained in:
@@ -394,6 +394,7 @@ config_allow_lan() {
|
||||
set_config_allow_lan() {
|
||||
local value="$1"
|
||||
local file="$CONFIG_DIR/template.yaml"
|
||||
local mixin_file_path
|
||||
|
||||
case "$value" in
|
||||
true|false) ;;
|
||||
@@ -404,6 +405,13 @@ set_config_allow_lan() {
|
||||
ALLOW_LAN_VALUE="$value" "$(yq_bin)" eval -i '
|
||||
.["allow-lan"] = (env(ALLOW_LAN_VALUE) == "true")
|
||||
' "$file"
|
||||
|
||||
ensure_mixin_file
|
||||
mixin_file_path="$(mixin_file)"
|
||||
ALLOW_LAN_VALUE="$value" "$(yq_bin)" eval -i '
|
||||
.override = (.override // {}) |
|
||||
.override["allow-lan"] = (env(ALLOW_LAN_VALUE) == "true")
|
||||
' "$mixin_file_path"
|
||||
}
|
||||
|
||||
subscription_url_scheme() {
|
||||
|
||||
Reference in New Issue
Block a user