From 31b09cc3d278eb4a1be7e4b62bdcc379cd0cae94 Mon Sep 17 00:00:00 2001 From: Andrey Petelin Date: Mon, 6 Oct 2025 15:40:21 +0500 Subject: [PATCH] feat: conditionally include external_ui in clash_api config if external_ui path is provided --- podkop/files/usr/lib/sing_box_config_manager.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/podkop/files/usr/lib/sing_box_config_manager.sh b/podkop/files/usr/lib/sing_box_config_manager.sh index 33f8703..ce66424 100644 --- a/podkop/files/usr/lib/sing_box_config_manager.sh +++ b/podkop/files/usr/lib/sing_box_config_manager.sh @@ -1335,8 +1335,8 @@ sing_box_cm_configure_cache_file() { # Configure the experimental clash_api section of a sing-box JSON configuration. # Arguments: # config: JSON configuration (string) -# external_controller: string, URL or path for the external controller -# external_ui: string, URL or path for the external UI +# external_controller: API listening address; Clash API will be disabled if empty +# external_ui: Optional path to static web resources to serve at http://{{external-controller}}/ui # Outputs: # Writes updated JSON configuration to stdout # Example: @@ -1352,8 +1352,8 @@ sing_box_cm_configure_clash_api() { --arg external_ui "$external_ui" \ '.experimental.clash_api = { external_controller: $external_controller, - external_ui: $external_ui - }' + } + + (if $external_ui != "" then { external_ui: $external_ui } else {} end)' } #######################################