Add files page

This commit is contained in:
2026-09-13 11:28:17 +02:00
parent ab0e1b47d8
commit 30826f3671
7 changed files with 247 additions and 81 deletions
@@ -1,24 +1,48 @@
{{define "content"}}
{{if .NeedsToken}}
<section class="card">
<h1>Administration</h1>
<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>
<dt>Stored</dt><dd>{{.Total}}{{if .Quota}} of {{.Quota}} ({{.QuotaPct}}%){{end}}</dd>
{{if .FreeDisk}}<dt>Free disk</dt><dd>{{.FreeDisk}}</dd>{{end}}
{{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>Files</h2>
<h2>{{if .Admin}}Every upload{{else}}Uploaded with your token{{end}}</h2>
{{if not .Objects}}
<p class="hint">Nothing stored right now.</p>
<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>
<th><a href="?sort=owner">Owner</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>
@@ -32,12 +56,12 @@
<span class="id mono">{{.ID}}{{if .Vanity}} <em title="vanity name">★</em>{{end}}</span>
</td>
<td data-label="Size" class="num nowrap">{{.Size}}</td>
<td data-label="Owner">{{if .Owner}}{{.Owner}}{{else}}<em>anonymous</em>{{end}}</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="admin">
<input type="hidden" name="from" value="files">
<button type="submit" class="danger small"
data-confirm="Delete {{.Filename}}? This cannot be undone.">Delete</button>
</form>
@@ -49,6 +73,7 @@
{{end}}
</section>
{{if .Admin}}
<section class="card">
<h2>Tokens</h2>
<p class="hint">
@@ -76,3 +101,6 @@
{{end}}
</section>
{{end}}
{{end}}
{{end}}
+1 -1
View File
@@ -12,7 +12,7 @@
<a class="brand" href="{{.Base}}">Uncensored&nbsp;Send</a>
<nav>
{{if .User}}
{{if .Admin}}<a href="{{.Base}}admin">Administration</a>{{end}}
<a href="{{.Base}}files">{{if .Admin}}All files{{else}}Your files{{end}}</a>
<span class="who">{{.User}}</span>
<form method="post" action="{{.Base}}logout"><button type="submit" class="link">Log out</button></form>
{{else}}