Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Toperlock authored Jan 6, 2024
1 parent b0299b1 commit f17b8ed
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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模板
Expand Down

0 comments on commit f17b8ed

Please sign in to comment.