Add files page
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
{{define "content"}}
|
||||
{{if .NeedsToken}}
|
||||
<section class="card">
|
||||
<h1>Files</h1>
|
||||
<p class="hint">
|
||||
Uploads are recorded against the token that made them, so this page needs
|
||||
one to have anything to show. Log in and it lists the files you uploaded,
|
||||
with what is left of their lifetime.
|
||||
</p>
|
||||
<p class="hint">
|
||||
An upload made without a token belongs to nobody and cannot be listed here.
|
||||
The link and the delete token handed out at the time are the only way back
|
||||
to it.
|
||||
</p>
|
||||
<p class="actions"><a class="button" href="{{.Base}}login?next=files">Log in</a></p>
|
||||
</section>
|
||||
{{else}}
|
||||
|
||||
<section class="card">
|
||||
<h1>{{if .Admin}}All files{{else}}Your files{{end}}</h1>
|
||||
<dl class="stats">
|
||||
<dt>Files</dt><dd>{{.Count}}{{if .Anonymous}} <em>({{.Anonymous}} anonymous)</em>{{end}}</dd>
|
||||
{{if .Admin}}
|
||||
<dt>Stored</dt><dd>{{.Total}}{{if .Quota}} of {{.Quota}} ({{.QuotaPct}}%){{end}}</dd>
|
||||
{{if .FreeDisk}}<dt>Free disk</dt><dd>{{.FreeDisk}}</dd>{{end}}
|
||||
{{else}}
|
||||
<dt>Uploaded as</dt><dd>{{.User}}</dd>
|
||||
<dt>Holding</dt><dd>{{.Listed}}</dd>
|
||||
{{end}}
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>{{if .Admin}}Every upload{{else}}Uploaded with your token{{end}}</h2>
|
||||
{{if not .Objects}}
|
||||
<p class="hint">
|
||||
{{if .Admin}}Nothing stored right now.{{else}}You have not uploaded anything that is still here. Files you upload while logged in show up on this page until they expire.{{end}}
|
||||
</p>
|
||||
{{else}}
|
||||
<table class="admin files">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><a href="?sort=name">File</a></th>
|
||||
<th class="num"><a href="?sort=size">Size</a></th>
|
||||
{{if .Admin}}<th><a href="?sort=owner">Owner</a></th>{{end}}
|
||||
<th><a href="?sort=created">Uploaded</a></th>
|
||||
<th><a href="?sort=expires">Expires</a></th>
|
||||
<th><span class="visually-hidden">Actions</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{range .Objects}}
|
||||
<tr>
|
||||
<td data-label="File" class="filecell">
|
||||
<a href="{{$.Base}}i/{{.ID}}">{{.Filename}}</a>
|
||||
<span class="id mono">{{.ID}}{{if .Vanity}} <em title="vanity name">★</em>{{end}}</span>
|
||||
</td>
|
||||
<td data-label="Size" class="num nowrap">{{.Size}}</td>
|
||||
{{if $.Admin}}<td data-label="Owner">{{if .Owner}}{{.Owner}}{{else}}<em>anonymous</em>{{end}}</td>{{end}}
|
||||
<td data-label="Uploaded" class="nowrap" title="{{.Created}}">{{.CreatedAgo}}</td>
|
||||
<td data-label="Expires" class="nowrap" title="{{.Expires}}">{{.ExpiresIn}}</td>
|
||||
<td class="actions-cell">
|
||||
<form method="post" action="{{$.Base}}d/{{.ID}}/delete">
|
||||
<input type="hidden" name="from" value="files">
|
||||
<button type="submit" class="danger small"
|
||||
data-confirm="Delete {{.Filename}}? This cannot be undone.">Delete</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
{{if .Admin}}
|
||||
<section class="card">
|
||||
<h2>Tokens</h2>
|
||||
<p class="hint">
|
||||
Tokens are minted, rotated and revoked with <code>./uncensored-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}}
|
||||
<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 data-label="Name">{{.Name}}</td>
|
||||
<td data-label="Max size" class="nowrap">{{.MaxSize}}</td>
|
||||
<td data-label="Max lifetime" class="nowrap">{{.MaxExpiry}}</td>
|
||||
<td data-label="Vanity">{{if .Vanity}}yes{{else}}no{{end}}</td>
|
||||
<td data-label="Admin">{{if .Admin}}yes{{else}}no{{end}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{end}}
|
||||
</section>
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user