Skip to content

Commit

Permalink
feat: 节点名去重,避免冲突
Browse files Browse the repository at this point in the history
  • Loading branch information
nonPointer authored Mar 31, 2024
1 parent c70265b commit 171f306
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def from_config(config: dict) -> Site:
config['proxies'] += site.nodes
config['proxy-groups'][list(map(lambda x: x['name'], config['proxy-groups'])).index(site.group)]['proxies'] += site.get_titles()

# 对节点名去重
config['proxies'] = list({x['name']: x for x in config['proxies']}.values())

output_file = sys.argv[2] if len(sys.argv) == 3 else "out.yaml"
with open(output_file, "w", encoding="utf-8") as f:
f.write(yaml.dump(config, default_flow_style=False, allow_unicode=True))

0 comments on commit 171f306

Please sign in to comment.