From ea4014bceb03dc6a5b50c1c9f8d5dfb18162c516 Mon Sep 17 00:00:00 2001 From: ReturnFI <151555003+ReturnFI@users.noreply.github.com> Date: Thu, 25 Dec 2025 17:10:42 +0000 Subject: [PATCH] fix(normalsub): conditionally generate sing-box obfs config --- core/scripts/normalsub/normalsub.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/scripts/normalsub/normalsub.py b/core/scripts/normalsub/normalsub.py index af4906b..aa963e5 100644 --- a/core/scripts/normalsub/normalsub.py +++ b/core/scripts/normalsub/normalsub.py @@ -308,15 +308,11 @@ class SingboxConfigGenerator: print(f"Error during Singbox config generation from URI: {e}, URI: {uri}") return None - return { + outbound_config = { "type": "hysteria2", "tag": unquote(parsed_url.fragment), "server": server, "server_port": server_port, - "obfs": { - "type": "salamander", - "password": obfs_password - }, "password": final_password, "tls": { "enabled": True, @@ -325,6 +321,14 @@ class SingboxConfigGenerator: } } + if obfs_password: + outbound_config["obfs"] = { + "type": "salamander", + "password": obfs_password + } + + return outbound_config + def combine_configs(self, all_uris: List[str], username: str, fragment: str) -> Optional[Dict[str, Any]]: if not all_uris: return None