~bigbes/sr-ht-dolt

ref: 377c616a8a3b385f18a8d6509c7a6be3a31af2bd sr-ht-dolt/web/templates/keys.html -rw-r--r-- 2.3 KiB
377c616a — Eugene Blikh web: render memory bodies as markdown, and resolve their references 3 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{{define "content" -}}
<h2>Dolt keys</h2>
{{if .Error}}<div class="alert alert-danger">{{.Error}}</div>{{end}}
{{if .Notice}}<div class="alert alert-success">{{.Notice}}</div>{{end}}

<p>
  Associate a dolt Ed25519 credential to clone and push without a personal access
  token, like a git SSH key. Run:
</p>
<pre>dolt creds new
dolt login --auth-endpoint {{doltHost .SelfOrigin}} --login-url {{.SelfOrigin}}/settings/keys</pre>
<p>
  <code>dolt login</code> opens this page with your public key in the URL; the
  field below is filled in automatically. Without JavaScript, paste the
  <code>pub key</code> value the command printed.
</p>

<form method="POST" action="/settings/keys">
  <div class="form-group">
    <label for="pubkey">Public key</label>
    <input type="text" class="form-control" name="pubkey" id="pubkey"
      autocomplete="off" spellcheck="false">
  </div>
  <div class="form-group">
    <label for="comment">Comment (optional)</label>
    <input type="text" class="form-control" name="comment" id="comment" maxlength="256">
  </div>
  <button type="submit" class="btn btn-primary">Add key</button>
</form>

<div class="header-extension"></div>
<h4>Your keys</h4>
{{if .Keys}}
<table class="table">
  <thead><tr><th>Key ID</th><th>Comment</th><th>Added</th><th>Last used</th><th></th></tr></thead>
  <tbody>
    {{range .Keys}}
    <tr>
      <td><code>{{.KID}}</code></td>
      <td>{{.Comment}}</td>
      <td class="text-muted" title="{{.Created | abstime}}">{{.Created | reltime}}</td>
      <td class="text-muted">{{if .LastUsed}}{{.LastUsed | reltime}}{{else}}never{{end}}</td>
      <td>
        <form method="POST" action="/settings/keys" style="display:inline">
          <input type="hidden" name="delete_id" value="{{.ID}}">
          <button type="submit" class="btn btn-sm btn-danger">Delete</button>
        </form>
      </td>
    </tr>
    {{end}}
  </tbody>
</table>
{{else}}
<p class="text-muted">No keys registered.</p>
{{end}}

<script>
  // Prefill the public key from the URL fragment that `dolt login` appends
  // (#<pubkey-base32>). Progressive enhancement only: the page works without JS.
  (function () {
    if (window.location.hash.length > 1) {
      var field = document.getElementById("pubkey");
      if (field && !field.value) {
        field.value = decodeURIComponent(window.location.hash.substring(1));
      }
    }
  })();
</script>
{{- end}}