Skip to content

Commit e8e4598

Browse files
author
put-go
committed
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 能保留到最终合并后的运行配置。
1 parent f4a868f commit e8e4598

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/core/config.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ config_allow_lan() {
394394
set_config_allow_lan() {
395395
local value="$1"
396396
local file="$CONFIG_DIR/template.yaml"
397+
local mixin_file_path
397398

398399
case "$value" in
399400
true|false) ;;
@@ -404,6 +405,13 @@ set_config_allow_lan() {
404405
ALLOW_LAN_VALUE="$value" "$(yq_bin)" eval -i '
405406
.["allow-lan"] = (env(ALLOW_LAN_VALUE) == "true")
406407
' "$file"
408+
409+
ensure_mixin_file
410+
mixin_file_path="$(mixin_file)"
411+
ALLOW_LAN_VALUE="$value" "$(yq_bin)" eval -i '
412+
.override = (.override // {}) |
413+
.override["allow-lan"] = (env(ALLOW_LAN_VALUE) == "true")
414+
' "$mixin_file_path"
407415
}
408416

409417
subscription_url_scheme() {

0 commit comments

Comments
 (0)