summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/api_keys.html40
-rw-r--r--templates/base.html4
-rw-r--r--templates/dns.html52
3 files changed, 90 insertions, 6 deletions
diff --git a/templates/api_keys.html b/templates/api_keys.html
new file mode 100644
index 0000000..93eebd5
--- /dev/null
+++ b/templates/api_keys.html
@@ -0,0 +1,40 @@
+{{ define "content" }}
+ <table>
+ <tr>
+ <th>Key</th>
+ <th>Created At</th>
+ <th>Revoke</th>
+ </tr>
+ {{ if (eq (len .APIKeys) 0) }}
+ <tr>
+ <td colspan="5"><span class="blinky">No API Keys Found</span></td>
+ </tr>
+ {{ end }}
+ {{ range $key := .APIKeys }}
+ <tr>
+ <td>{{ $key.Key }}</td>
+ <td>{{ $key.CreatedAt }}</td>
+ <td>
+ <form method="POST" action="/keys/delete">
+ <input type="hidden" name="key" value="{{ $key.Key }}" />
+ <input type="submit" value="Revoke" />
+ </form>
+ </td>
+ </tr>
+ {{ end }}
+ </table>
+ <br>
+ <form method="POST" action="/keys" class="form">
+ <h2>Add An API Key</h2>
+ <hr>
+ <input type="submit" value="Generate" />
+ </form>
+
+ {{ if .FormError }}
+ {{ if (len .FormError.Errors) }}
+ {{ range $error := .FormError.Errors }}
+ <div class="error">{{ $error }}</div>
+ {{ end }}
+ {{ end }}
+ {{ end }}
+{{ end }}
diff --git a/templates/base.html b/templates/base.html
index 79e0d12..9f5a903 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -35,7 +35,10 @@
{{ if .User }}
<a href="/dns">dns.</a>
<span> | </span>
+ <a href="/keys">api keys.</a>
+ <span> | </span>
<a href="/logout">logout, {{ .User.DisplayName }}.</a>
+
{{ else }}
<a href="/login">login.</a>
{{ end }}
@@ -74,6 +77,7 @@
<img width='150' height='20' src='/static/img/blinkies/connection.gif'>
<img width='150' height='20' src='/static/img/blinkies/eepy.gif'>
<img width='150' height='20' src='/static/img/blinkies/loveuguys.gif'>
+ <img width='150' height='20' src='/static/img/blinkies/capitalism.gif'>
</div>
</div>
</div>
diff --git a/templates/dns.html b/templates/dns.html
index 0a40cab..e317d05 100644
--- a/templates/dns.html
+++ b/templates/dns.html
@@ -5,10 +5,11 @@
<th>Name</th>
<th>Content</th>
<th>TTL</th>
+ <th>Delete</th>
</tr>
{{ if (eq (len .DNSRecords) 0) }}
<tr>
- <td colspan="4"><span class="blinky">No DNS records found</span></td>
+ <td colspan="5"><span class="blinky">No DNS records found</span></td>
</tr>
{{ end }}
{{ range $record := .DNSRecords }}
@@ -17,21 +18,60 @@
<td>{{ $record.Name }}</td>
<td>{{ $record.Content }}</td>
<td>{{ $record.TTL }}</td>
+ <td>
+ <form method="POST" action="/dns/delete">
+ <input type="hidden" name="id" value="{{ $record.ID }}" />
+ <input type="submit" value="Delete" />
+ </form>
+ </td>
</tr>
{{ end }}
</table>
<br>
- <form method="POST" action="/dns">
+ <form method="POST" action="/dns" class="form">
<h2>Add DNS Records</h2>
+ <p>note that the name <em>must</em> be a subdomain of <em>{{ .User.Username }}</em></p>
<hr>
<label for="type">Type</label>
- <input type="text" name="type" placeholder="CNAME" required />
+ <input type="text" name="type" placeholder="CNAME"
+ {{ if not .RecordForm }}
+ placeholder="CNAME"
+ {{ else }}
+ value="{{ .RecordForm.Type }}"
+ {{ end }}
+ required />
<label for="name">Name</label>
- <input type="text" name="name" placeholder="{{ .User.Username }}" required />
+ <input type="text" name="name"
+ {{ if not .RecordForm }}
+ placeholder="{{ .User.Username }} || endpoint.{{ .User.Username }}..."
+ {{ else }}
+ value="{{ .RecordForm.Name }}"
+ {{ end }}
+ required/>
<label for="content">Content</label>
- <input type="text" name="content" placeholder="{{ .User.Username }}.dev" required />
+ <input type="text" name="content"
+ {{ if not .RecordForm }}
+ placeholder="{{ .User.Username }}.dev"
+ {{ else }}
+ value="{{ .RecordForm.Content }}"
+ {{ end }}
+ required />
<label for="ttl">TTL</label>
- <input type="text" name="ttl" placeholder="43200" required />
+ <input type="text" name="ttl"
+ {{ if not .RecordForm }}
+ placeholder="43200"
+ {{ else }}
+ value="{{ .RecordForm.TTL }}"
+ {{ end }}
+ required />
<input type="submit" value="Add" />
</form>
+
+ {{ if .FormError }}
+ {{ if (len .FormError.Errors) }}
+ {{ range $error := .FormError.Errors }}
+ <div class="error">{{ $error }}</div>
+ {{ end }}
+ {{ end }}
+ {{ end }}
{{ end }}