新增 Clash/mihomo 节点输出: sbp user show --clash

This commit is contained in:
typist committed 2026-11-01 06:58:42 +08:00
1 parent 79fe594385
commit f9874454f0
16 files changed
+318 -14

No files matched your search

+5 -3
View File
@@ -33,15 +33,17 @@ def _detail(app: "App", name: str) -> None:
while True:
choice = app.term.menu(
f"User {name}",
["Show share URIs", "Show client config", "Delete user", "Back"],
["Show share URIs", "Show Clash YAML", "Show client config", "Delete user", "Back"],
)
if choice is None or choice == 3:
if choice is None or choice == 4:
return
if choice == 0:
uris = show_op.user_uris(app.paths, name)
text = "\n\n".join(f"{key}\n {uri}" for key, uri in uris) or "no enabled protocols"
app.term.scroll_text(f"Share URIs: {name}", text)
elif choice == 1:
app.term.scroll_text(f"Clash: {name}", show_op.user_clash(app.paths, name))
elif choice == 2:
enabled = [row.key for row in app.status().protocols if row.enabled]
if not enabled:
app.term.message("Client config", "no enabled protocols")
@@ -54,7 +56,7 @@ def _detail(app: "App", name: str) -> None:
f"Client config: {name} / {enabled[picked]}",
show_op.client_config_json(app.paths, name, enabled[picked]),
)
elif choice == 2:
elif choice == 3:
if app.term.confirm("Delete user", f"Delete {name}? Clients using this user stop working."):
app.term.run_external("Delete user", lambda progress: users_op.remove(app.paths, name))
return