From 01714385050131bf9f6acc2aa215aa2bbd68f162 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 3 Aug 2026 16:06:40 +0000 Subject: [PATCH] fix: dynamic menu numbering via ops dict --- sources/python/main.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sources/python/main.py b/sources/python/main.py index 282edbb..e14a263 100644 --- a/sources/python/main.py +++ b/sources/python/main.py @@ -150,10 +150,10 @@ def main(): n += 1 if deployed: - print(f" [{n}] Edit nodes"); n += 1 - print(f" [{n}] Delete a node"); n += 1 - print(f" [{n}] Status"); n += 1 - print(f" [{n}] Remote tunnel"); n += 1 + print(f" [{n}] Edit nodes"); ops['edit'] = str(n); n += 1 + print(f" [{n}] Delete a node"); ops['del'] = str(n); n += 1 + print(f" [{n}] Status"); ops['status'] = str(n); n += 1 + print(f" [{n}] Remote tunnel"); ops['tunnel'] = str(n); n += 1 print(" [q] Quit") c = input("\nChoice: ").strip() @@ -170,13 +170,21 @@ def main(): str(nc.get("upstream_port","80")), "", nc.get("mode","monitoring")) deployed.add(name) - elif c == str(n-4) and deployed: + # Track what number each action got + ops = {} + if deployed: + ops['edit'] = str(n); n += 1 + ops['del'] = str(n); n += 1 + ops['status'] = str(n); n += 1 + ops['tunnel'] = str(n); n += 1 + + if c == ops.get('edit') and deployed: edit_nodes() - elif c == str(n-3) and deployed: + elif c == ops.get('del') and deployed: remove_menu() - elif c == str(n-2): + elif c == ops.get('status'): container_status() - elif c == str(n-1): + elif c == ops.get('tunnel'): start_tunnel() elif c.lower() == "q": break