hatecomputers.club/templates/dns.html

78 lines
2.0 KiB
HTML

{{ define "content" }}
<table>
<tr>
<th>Type</th>
<th>Name</th>
<th>Content</th>
<th>TTL</th>
<th>Delete</th>
</tr>
{{ if (eq (len .DNSRecords) 0) }}
<tr>
<td colspan="5"><span class="blinky">No DNS records found</span></td>
</tr>
{{ end }}
{{ range $record := .DNSRecords }}
<tr>
<td>{{ $record.Type }}</td>
<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" 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"
{{ if not .RecordForm }}
placeholder="CNAME"
{{ else }}
value="{{ .RecordForm.Type }}"
{{ end }}
required />
<label for="name">Name</label>
<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"
{{ if not .RecordForm }}
placeholder="{{ .User.Username }}.dev"
{{ else }}
value="{{ .RecordForm.Content }}"
{{ end }}
required />
<label for="ttl">TTL</label>
<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 }}