feat: add host ping endpoint and automatic reconnection UI for disconnected terminals
Release / release (pull_request) Successful in 23s

This commit is contained in:
2026-07-09 20:57:52 +01:00
parent c487a4e949
commit d625c3903d
3 changed files with 111 additions and 30 deletions
+21
View File
@@ -4,6 +4,7 @@ SSH web client — Flask backend: auth, MariaDB, encrypted identities, WebSocket
from __future__ import annotations
import os
import socket
if os.getenv("GEVENT_MONKEY_PATCH", "").lower() in ("1", "true", "yes"):
from gevent import monkey
@@ -1411,6 +1412,26 @@ def list_hosts():
return jsonify({"items": rows})
@app.route("/api/hosts/<int:hid>/ping", methods=["GET"])
@require_auth("read:hosts")
def ping_host(hid: int):
with db_cursor() as (_, cur):
cur.execute("SELECT hostname, port FROM ssh_hosts WHERE id = %s", (hid,))
row = cur.fetchone()
if not row:
return jsonify({"error": "not found"}), 404
up = False
try:
with socket.create_connection((row["hostname"], row["port"]), timeout=2.0):
up = True
except Exception:
pass
return jsonify({"up": up})
@app.route("/api/tags", methods=["GET"])
@require_auth("read:hosts")
def list_tags():