hatecomputers.club/templates/dns.html

92 lines
2.2 KiB
HTML
Raw Normal View History

2024-03-28 00:55:22 -04:00
{{ define "content" }}
<table>
<tr>
<th>Type</th>
<th>Name</th>
<th>Content</th>
<th>TTL</th>
<th>Internal</th>
<th>Delete</th>
2024-03-28 00:55:22 -04:00
</tr>
{{ if (eq (len .DNSRecords) 0) }}
<tr>
<td colspan="6"><span class="blinky">No DNS records found</span></td>
2024-03-28 00:55:22 -04:00
</tr>
{{ end }}
{{ range $record := .DNSRecords }}
<tr>
<td>{{ $record.Type }}</td>
<td>{{ $record.Name }}</td>
<td>{{ $record.Content }}</td>
<td>{{ $record.Internal }}</td>
2024-03-28 00:55:22 -04:00
<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>
2024-03-28 00:55:22 -04:00
</tr>
{{ end }}
</table>
<br>
<form method="POST" action="/dns" class="form">
2024-03-28 00:55:22 -04:00
<h2>Add DNS Records</h2>
<p>note that the name <em>must</em> be a subdomain of <em>{{ .User.Username }}</em></p>
2024-03-28 00:55:22 -04:00
<hr>
<label for="type">Type</label>
<input type="text" name="type" placeholder="CNAME"
{{ if not .RecordForm }}
placeholder="CNAME"
{{ else }}
value="{{ .RecordForm.Type }}"
{{ end }}
required />
2024-03-28 00:55:22 -04:00
<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/>
2024-03-28 00:55:22 -04:00
<label for="content">Content</label>
<input type="text" name="content"
{{ if not .RecordForm }}
placeholder="{{ .User.Username }}.dev"
{{ else }}
value="{{ .RecordForm.Content }}"
{{ end }}
required />
2024-03-28 00:55:22 -04:00
<label for="ttl">TTL</label>
<input type="text" name="ttl"
{{ if not .RecordForm }}
placeholder="43200"
{{ else }}
value="{{ .RecordForm.TTL }}"
{{ end }}
required />
<label for="internal">
Internal
<input style='display:inline;width:auto;' type="checkbox" name="internal"
{{ if .RecordForm.Internal }}
checked
{{ end }}
/>
</label>
2024-03-28 00:55:22 -04:00
<input type="submit" value="Add" />
{{ if .FormError }}
{{ if (len .FormError.Errors) }}
{{ range $error := .FormError.Errors }}
<div class="error">{{ $error }}</div>
{{ end }}
{{ end }}
{{ end }}
</form>
2024-03-28 00:55:22 -04:00
{{ end }}