From 9cf782ffd6e1da239b4f31eae015f6ec325211b7 Mon Sep 17 00:00:00 2001 From: boris Date: Mon, 26 Jan 2026 23:36:12 +0000 Subject: [PATCH] Added certificate regeneration. Refactored server dashboard. --- .../accounts/templates/accounts/profile.html | 2 +- app/apps/keys/certificates.py | 4 +- .../servers/templates/servers/detail.html | 71 +++++++++++-------- 3 files changed, 45 insertions(+), 32 deletions(-) diff --git a/app/apps/accounts/templates/accounts/profile.html b/app/apps/accounts/templates/accounts/profile.html index 0d74010..90a693f 100644 --- a/app/apps/accounts/templates/accounts/profile.html +++ b/app/apps/accounts/templates/accounts/profile.html @@ -174,7 +174,7 @@ if (!response.ok) { throw new Error("Certificate regeneration failed."); } - window.location.href = "/api/v1/keys/" + keyId + "/certificate"; + window.alert("Certificate regenerated."); }) .catch(function (err) { window.alert(err.message); diff --git a/app/apps/keys/certificates.py b/app/apps/keys/certificates.py index 6173b47..e8f902b 100644 --- a/app/apps/keys/certificates.py +++ b/app/apps/keys/certificates.py @@ -120,8 +120,8 @@ def _sign_public_key( if not os.path.exists(cert_path): stderr = result.stderr.decode("utf-8", "ignore") raise RuntimeError(f"ssh-keygen output missing: {cert_path} {stderr}") - with open(cert_path, "r", encoding="utf-8") as handle: - return handle.read().strip() + with open(cert_path, "r", encoding="utf-8") as handle: + return handle.read().strip() def _ensure_comment(public_key: str, comment: str) -> str: diff --git a/app/apps/servers/templates/servers/detail.html b/app/apps/servers/templates/servers/detail.html index b79940e..638461a 100644 --- a/app/apps/servers/templates/servers/detail.html +++ b/app/apps/servers/templates/servers/detail.html @@ -19,20 +19,35 @@ Back to servers + +
-
-

Access

+
+

Server details

-
Access until
-
- {% if expires_at %} - {{ expires_at|date:"M j, Y H:i" }} - {% else %} - No expiry - {% endif %} -
+
Hostname
+
{{ server.hostname|default:"—" }}
+
+
IPv4
+
{{ server.ipv4|default:"—" }}
+
+
+
IPv6
+
{{ server.ipv6|default:"—" }}
+
+
+
+ +
+

Account & certificate

+
Account name
@@ -77,6 +92,22 @@ {% endif %}
+
+
+ +
+

Access

+
+
+
Access until
+
+ {% if expires_at %} + {{ expires_at|date:"M j, Y H:i" }} + {% else %} + No expiry + {% endif %} +
+
Last accessed
@@ -89,24 +120,6 @@
- -
-

Server details

-
-
-
Hostname
-
{{ server.hostname|default:"—" }}
-
-
-
IPv4
-
{{ server.ipv4|default:"—" }}
-
-
-
IPv6
-
{{ server.ipv6|default:"—" }}
-
-
-
@@ -160,7 +173,7 @@ if (!response.ok) { throw new Error("Certificate regeneration failed."); } - window.location.href = "/api/v1/keys/" + keyId + "/certificate"; + window.alert("Certificate regenerated."); }) .catch(function (err) { window.alert(err.message);