Add admin interface
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
{{define "content"}}
|
||||
<section class="card">
|
||||
<h1>Administration</h1>
|
||||
<dl class="stats">
|
||||
<dt>Files</dt><dd>{{.Count}}{{if .Anonymous}} <em>({{.Anonymous}} anonymous)</em>{{end}}</dd>
|
||||
<dt>Stored</dt><dd>{{.Total}}{{if .Quota}} of {{.Quota}} ({{.QuotaPct}}%){{end}}</dd>
|
||||
{{if .FreeDisk}}<dt>Free disk</dt><dd>{{.FreeDisk}}</dd>{{end}}
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Files</h2>
|
||||
{{if not .Objects}}
|
||||
<p class="hint">Nothing stored right now.</p>
|
||||
{{else}}
|
||||
<div class="tablewrap">
|
||||
<table class="admin">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="?sort=name">Name</a></th>
|
||||
<th><a href="?sort=name">Filename</a></th>
|
||||
<th class="num"><a href="?sort=size">Size</a></th>
|
||||
<th><a href="?sort=owner">Owner</a></th>
|
||||
<th><a href="?sort=created">Uploaded</a></th>
|
||||
<th><a href="?sort=expires">Expires</a></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Objects}}
|
||||
<tr>
|
||||
<td class="mono"><a href="{{$.Base}}i/{{.ID}}">{{.ID}}</a>{{if .Vanity}} <em title="custom name">★</em>{{end}}</td>
|
||||
<td class="wrap">{{.Filename}}</td>
|
||||
<td class="num">{{.Size}}</td>
|
||||
<td>{{if .Owner}}{{.Owner}}{{else}}<em>anonymous</em>{{end}}</td>
|
||||
<td class="mono small">{{.Created}}</td>
|
||||
<td class="mono small">{{.Expires}}</td>
|
||||
<td>
|
||||
<form method="post" action="{{$.Base}}api/d/{{.ID}}/delete">
|
||||
<input type="hidden" name="from" value="admin">
|
||||
<button type="submit" class="danger small"
|
||||
data-confirm="Delete {{.Filename}}?">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Tokens</h2>
|
||||
<p class="hint">
|
||||
Tokens are minted and revoked with <code>send token</code> on the server.
|
||||
They are deliberately not manageable from here: nothing that hands out
|
||||
credentials should be reachable over the network.
|
||||
</p>
|
||||
{{if .Tokens}}
|
||||
<div class="tablewrap">
|
||||
<table class="admin">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>Max size</th><th>Max lifetime</th><th>Vanity</th><th>Admin</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Tokens}}
|
||||
<tr>
|
||||
<td>{{.Name}}</td>
|
||||
<td>{{.MaxSize}}</td>
|
||||
<td>{{.MaxExpiry}}</td>
|
||||
<td>{{if .Vanity}}yes{{else}}no{{end}}</td>
|
||||
<td>{{if .Admin}}yes{{else}}no{{end}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{end}}
|
||||
</section>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user