From 24c5d300c9d0131583b6ad6407ad19a262ad1b99 Mon Sep 17 00:00:00 2001 From: andrey271192 <76248502+andrey271192@users.noreply.github.com> Date: Fri, 13 Nov 2026 23:04:16 +0300 Subject: [PATCH] router install: short one-line command + second IP in full command Co-Authored-By: Claude Opus 5.5 --- app.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app.py b/app.py index 59a2ed7..a078ef7 100644 --- a/app.py +++ b/app.py @@ -4468,6 +4468,8 @@ def install_command(token, port=None): urls = [f"{panel_scheme()}://{host}:{port}/init/{token}.sh", f"http://{host}/init/{token}.sh"] if host != SERVER_IP: urls += [f"{panel_scheme()}://{SERVER_IP}:{port}/init/{token}.sh", f"http://{SERVER_IP}/init/{token}.sh"] + for alt in alt_endpoints(SERVER_IP): # second IP: reachable where the main one is blocked + urls += [f"http://{alt}:{port}/init/{token}.sh", f"http://{alt}/init/{token}.sh"] return ("p=/tmp/phobos-init-$$.sh; ok=0; " f"for u in {' '.join(urls)}; do " "rm -f $p; " @@ -4477,6 +4479,13 @@ def install_command(token, port=None): "done; rm -f $p; [ $ok -eq 1 ] || echo ERROR_install_script_download_failed") +def short_install_command(token, port=None): + port = port or panel_port() + alts = alt_endpoints(SERVER_IP) + host = alts[0] if alts else client_endpoint(SERVER_IP) # prefer the IP that is reachable from RU + return f"wget -qO /tmp/p.sh {"http" if alts else panel_scheme()}://{host}:{port}/init/{token}.sh && sh /tmp/p.sh" + + @app.route("/init/") def serve_init(name): return send_from_directory(f"{PHOBOS_DIR}/www/init", name, mimetype="application/x-sh") @@ -4932,6 +4941,7 @@ def client_router_config(cid): return ("client not found", 404) token = _latest_token_for_client(cid) cmd = install_command(token) if token else "" + scmd = short_install_command(token) if token else "" title = tr("Установка на роутер", "Router install") copy = tr("Копировать", "Copy") copied = tr("Скопировано", "Copied") @@ -4941,6 +4951,11 @@ def client_router_config(cid): {cmd} +

{tr("Короткая — если веб-терминал обрезает длинную вставку.", "Short — if a web terminal cuts long pastes.")}

+
+ {scmd} + +
""" if cmd else f'

{tr("Нет активной команды установки. Создай/обнови клиента, чтобы выпустить install token.", "No active install command. Create/update the client to issue an install token.")}

') html = f"""