From f17b8edc18dd0abbff464fd89c4be00ad855e6d1 Mon Sep 17 00:00:00 2001 From: Dorae <86833913+Toperlock@users.noreply.github.com> Date: Sat, 6 Jan 2024 11:50:25 +0800 Subject: [PATCH] Update main.py --- main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index becc47c3d..2a586bae9 100644 --- a/main.py +++ b/main.py @@ -401,17 +401,20 @@ def combin_to_config(config, data): for out in config_outbounds: if out.get("outbounds"): if out['tag'] == 'proxy': + out["outbounds"] = [out["outbounds"]] if isinstance(out["outbounds"], str) else out["outbounds"] if '{all}' in out["outbounds"]: index_of_all = out["outbounds"].index('{all}') out["outbounds"][index_of_all] = (group.rsplit("-", 1)[0]).rsplit("-", 1)[-1] else: - out["outbounds"].insert(i + 1, (group.rsplit("-", 1)[0]).rsplit("-", 1)[-1]) + out["outbounds"].insert(i - 1, (group.rsplit("-", 1)[0]).rsplit("-", 1)[-1]) new_outbound = {'tag': (group.rsplit("-", 1)[0]).rsplit("-", 1)[-1], 'type': 'selector', 'outbounds': ['{' + group + '}']} config_outbounds.insert(-4, new_outbound) else: for out in config_outbounds: - if out['tag'] == 'proxy': - out["outbounds"].append('{' + group + '}') + if out.get("outbounds"): + if out['tag'] == 'proxy': + out["outbounds"] = [out["outbounds"]] if isinstance(out["outbounds"], str) else out["outbounds"] + out["outbounds"].append('{' + group + '}') temp_outbounds = [] if config_outbounds: # 提前处理all模板