feat(boxstore): add retention options and box deletion support

Introduce configurable retention options and default selection, store
retention when creating manifests, and add a helper to delete box
directories to enable expiring/cleanup workflows. Update login and upload
styles (new login layout, taller upload window) to support the new UI.feat(boxstore): add retention options and box deletion support

Introduce configurable retention options and default selection, store
retention when creating manifests, and add a helper to delete box
directories to enable expiring/cleanup workflows. Update login and upload
styles (new login layout, taller upload window) to support the new UI.
This commit is contained in:
2026-04-27 18:18:53 +03:00
parent 2f37958c31
commit 041a9798a7
13 changed files with 654 additions and 22 deletions

View File

@@ -32,7 +32,9 @@
<div class="box-toolbar">
<a class="win98-button box-toolbar-button" href="/">Upload</a>
<a class="win98-button box-toolbar-button" href="{{ .DownloadAll }}">Download Zip</a>
{{ if .DownloadAll }}
<a class="win98-button box-toolbar-button" href="{{ .DownloadAll }}">Download Zip</a>
{{ end }}
</div>
<div class="box-address">
@@ -40,6 +42,13 @@
<code>/box/{{ .BoxID }}</code>
</div>
{{ if .RetentionLabel }}
<div class="box-meta">
<span>Retention</span>
<span>{{ .RetentionLabel }}</span>
</div>
{{ end }}
<div class="win98-panel box-panel" data-box-id="{{ .BoxID }}" data-poll-ms="{{ .PollMS }}">
{{ if .Files }}
<div class="box-file-grid" aria-label="Uploaded files">

60
templates/box_login.html Normal file
View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WarpBox Login - {{ .BoxID }}</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/static/css/app.css">
<link rel="stylesheet" href="/static/css/window.css">
<link rel="stylesheet" href="/static/css/login.css">
</head>
<body>
<main>
<section class="win98-window login-window" aria-labelledby="login-window-title">
<header class="win98-titlebar login-titlebar">
<h1 id="login-window-title">Enter Network Password</h1>
<div class="win98-window-controls" aria-hidden="true">
<span class="win98-control">_</span>
<span class="win98-control"></span>
<span class="win98-control">×</span>
</div>
</header>
<form class="login-form" action="/box/{{ .BoxID }}/login" method="post">
<div class="win98-panel login-panel">
<div class="login-alert" role="alert">
<img src="/static/img/icons/Windows Icons - PNG/ole2.dll_14_DEFICON.png" alt="" aria-hidden="true">
<p>This WarpBox folder is password protected. Enter the password to view and download its files.</p>
</div>
<label class="login-row" for="box-user">
<span>User name</span>
<input id="box-user" class="login-input" type="text" value="{{ .BoxUser }}" readonly>
</label>
<label class="login-row" for="box-password">
<span>Password</span>
<input id="box-password" class="login-input" type="password" name="password" autocomplete="current-password" autofocus>
</label>
{{ if .ErrorMessage }}
<p class="login-error">{{ .ErrorMessage }}</p>
{{ end }}
</div>
<footer class="login-actions">
<button class="win98-button" type="submit">OK</button>
<a class="win98-button" href="/">Cancel</a>
</footer>
<div class="win98-statusbar login-statusbar">
<span>Protected folder</span>
<span>WarpBox</span>
</div>
</form>
</section>
</main>
</body>
</html>

View File

@@ -39,6 +39,27 @@
<input id="file-upload" class="upload-input" type="file" name="files" multiple>
<fieldset class="upload-options">
<legend>Box options</legend>
<label class="upload-option-row" for="upload-retention">
<span>Keep files</span>
<select id="upload-retention" class="upload-select" name="retention">
{{ range .RetentionOptions }}
<option value="{{ .Key }}" {{ if eq .Key $.DefaultRetention }}selected{{ end }}>{{ .Label }}</option>
{{ end }}
</select>
</label>
<label class="upload-check-row" for="upload-password-enabled">
<input id="upload-password-enabled" type="checkbox">
<span>Password protect this box</span>
</label>
<input id="upload-password" class="upload-text-input" type="password" autocomplete="new-password" placeholder="Password" disabled>
<label class="upload-check-row" for="upload-zip-enabled">
<input id="upload-zip-enabled" type="checkbox" checked>
<span>Allow Download Zip</span>
</label>
</fieldset>
<div class="upload-details">
<span class="upload-detail-label">Selected Files</span>
<span id="upload-file-count" class="upload-file-count">0 files</span>