From 8e124be1f05c7f7f4424f847766ebac09622abd7 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Tue, 14 Apr 2026 12:47:31 +0300 Subject: [PATCH] GUI: status accuracy + remove-only action; sync script peer names on exists --- gui/app.py | 2 +- gui/static/style.css | 1 + gui/templates/index.html | 11 +---------- server/wg-peerctl.sh | 6 ++++++ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/gui/app.py b/gui/app.py index a9e21c6..114935c 100644 --- a/gui/app.py +++ b/gui/app.py @@ -18,7 +18,7 @@ WG_INTERFACE = os.environ.get("WG_INTERFACE", "wg0") WG_META_FILE = os.environ.get("WG_META_FILE", "/etc/wireguard/wg-meta.env") ADMIN_USER = os.environ.get("ADMIN_USER", "admin") ADMIN_PASSWORD = os.environ.get("ADMIN_PASSWORD", "") -ONLINE_WINDOW_SEC = int(os.environ.get("ONLINE_WINDOW_SEC", "1800")) +ONLINE_WINDOW_SEC = int(os.environ.get("ONLINE_WINDOW_SEC", "120")) def db_conn(): diff --git a/gui/static/style.css b/gui/static/style.css index 2fe9b77..bd22288 100644 --- a/gui/static/style.css +++ b/gui/static/style.css @@ -14,6 +14,7 @@ main { padding: 22px; } label { display: grid; gap: 6px; } input, select, button { padding: 10px; border-radius: 10px; border: 1px solid #bad2bf; font-size: 14px; } button { background: var(--brand); color: #fff; border: 0; font-weight: 700; cursor: pointer; } +button.danger { background: #b42318; } table { width: 100%; border-collapse: collapse; background: white; border: 1px solid #d7e7da; } th, td { border-bottom: 1px solid #e0ece2; padding: 8px; font-size: 13px; text-align: left; vertical-align: top; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; } diff --git a/gui/templates/index.html b/gui/templates/index.html index c908ba9..f297811 100644 --- a/gui/templates/index.html +++ b/gui/templates/index.html @@ -24,17 +24,8 @@ {% if p.id %} QR/Config - {% if p.status == 'online' %} -
- -
- {% else %} -
- -
- {% endif %}
- +
{% else %} - diff --git a/server/wg-peerctl.sh b/server/wg-peerctl.sh index a93d1ac..e99f916 100755 --- a/server/wg-peerctl.sh +++ b/server/wg-peerctl.sh @@ -257,7 +257,13 @@ cmd_add() { if peer_exists_by_pubkey "$client_pubkey"; then local existing_addr + local existing_allowed existing_addr="$(extract_peer_address_by_pubkey "$client_pubkey")" + existing_allowed="${existing_addr:-}" + if [[ -n "$client_routes" ]]; then + existing_allowed="${existing_allowed},${client_routes}" + fi + sync_gui_db_upsert_peer "$client_name" "$client_pubkey" "${existing_addr:-}" "$client_routes" "$client_psk" "${existing_allowed}" 1 cat <