1{{ define "title" }}SSH keys — settings{{ end }}
2{{ define "navextra" }}<a href="/settings/keys">SSH keys</a> <a href="/settings/mtls">mTLS</a> <a href="/settings/token">API tokens</a>{{ end }}
3{{ define "srv_settings_keys.html" }}{{ template "head" . }}
4<div class="container">
5 <h2 style="margin-bottom: 16px">SSH keys</h2>
6 {{ if .Error }}
7 <p class="error">{{.Error}}</p>
8 {{ end }} {{ if .Keys }}
9 <table style="margin-bottom: 24px">
10 <thead>
11 <tr>
12 <th>Label</th>
13 <th>Key (truncated)</th>
14 <th>Added</th>
15 <th></th>
16 </tr>
17 </thead>
18 <tbody>
19 {{ range .Keys }}
20 <tr>
21 <td>
22 {{ if .Label }}{{.Label}}{{ else }}<span style="color: #aaa">—</span>{{ end }}
23 </td>
24 <td style="font-family: monospace;
25 font-size: 12px;
26 max-width: 240px;
27 overflow: hidden;
28 text-overflow: ellipsis;
29 white-space: nowrap">{{.PublicKey | printf "%.60s"}}…</td>
30 <td style="font-size: 12px; color: #888">{{.AddedAt.Format "2006-01-02"}}</td>
31 <td>
32 <button onclick="deleteKey({{.ID}})"
33 style="background: #c0392b;
34 font-size: 12px;
35 padding: 2px 8px">Delete</button>
36 </td>
37 </tr>
38 {{ end }}
39 </tbody>
40 </table>
41{{ else }}
42 <p style="color: #888; margin-bottom: 24px">No SSH keys registered.</p>
43 {{ end }}
44 <details>
45 <summary style="cursor: pointer; font-size: 13px; color: #555">Add SSH key</summary>
46 <form method="post" action="/settings/keys" style="margin-top: 12px">
47 <div class="field">
48 <label>Label (optional)</label>
49 <input type="text"
50 name="label"
51 style="width: 280px"
52 placeholder="e.g. work laptop" />
53 </div>
54 <div class="field">
55 <label>Public key</label>
56 <textarea name="public_key"
57 rows="3"
58 required
59 style="width: 500px;
60 padding: 6px 8px;
61 border: 1px solid #ccc;
62 border-radius: 3px;
63 font-family: monospace;
64 font-size: 12px"
65 placeholder="ssh-ed25519 AAAA..."></textarea>
66 </div>
67 <button type="submit">Add key</button>
68 </form>
69 </details>
70</div>
71<script>
72function deleteKey(id) {
73 if (!confirm("Delete this SSH key?")) return;
74 fetch("/settings/keys/" + id, { method: "DELETE" }).then(function(r) {
75 if (r.ok) {
76 location.reload();
77 } else {
78 r.text().then(alert);
79 }
80 });
81}
82</script>
83{{ template "foot" . }}
84{{ end }}