max total storage usage implemented!

code may be a bit messy but....

also implemented a storage usage stat (that can be toggled in .env) that
shows on the home page, you can also enable the total limit to show as
well

eventually i need to implement clearing old unfinished uploads both on
startup, admin actions, and cleaning up on upload failure
This commit is contained in:
2026-12-05 16:24:57 -05:00
parent a1ebd905df
commit c5636c9160
8 changed files with 269 additions and 87 deletions
+6 -1
View File
@@ -28,6 +28,11 @@
<label for="type-file">file</label>
<input type="radio" name="upload-type" id="type-paste" />
<label for="type-paste">paste</label>
{{if or .StorageUsage .StorageLimit}}
<span class="muted" style="margin-left: auto; width: fit-content;">
{{.StorageUsage}}{{if .StorageLimit}} / {{.StorageLimit}}{{end}} used
</span>
{{end}}
<div class="file-panel">
<form id="upload-file-form" action="/upload?return=html" method="post" enctype="multipart/form-data">
<label class="muted" for="file-expiry">expiry</label>
@@ -44,7 +49,7 @@
<input id="upload-file" data-max-size="{{.FileMaxSizeBytes}}" type="file" required name="file" />
<div class="submit-container">
<button id="upload-file-button" type="submit" class="btn">upload file</button>
<span id="upload-file-message"></span>
<span id="upload-file-message"></span>
<span class="muted">max {{.FileMaxSize}}</span>
</div>
</form>