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

@@ -10,6 +10,10 @@ const boxLink = document.querySelector("#upload-box-link");
const shareButton = document.querySelector("#upload-share-button");
const overallProgressBar = document.querySelector(".upload-overall-bar");
const overallProgressPercent = document.querySelector(".upload-overall-percent");
const retentionSelect = document.querySelector("#upload-retention");
const passwordEnabled = document.querySelector("#upload-password-enabled");
const passwordInput = document.querySelector("#upload-password");
const zipEnabled = document.querySelector("#upload-zip-enabled");
let selectedFiles = [];
let statusTimer = null;
@@ -194,6 +198,9 @@ async function createBox() {
"Content-Type": "application/json",
},
body: JSON.stringify({
retention_key: retentionSelect ? retentionSelect.value : "10s",
password: passwordEnabled && passwordEnabled.checked && passwordInput ? passwordInput.value : "",
allow_zip: !zipEnabled || zipEnabled.checked,
files: selectedFiles.map((selectedFile) => ({
name: selectedFile.file.name,
size: selectedFile.file.size,
@@ -307,6 +314,18 @@ if (fileInput) {
});
}
if (passwordEnabled && passwordInput) {
passwordEnabled.addEventListener("change", () => {
passwordInput.disabled = !passwordEnabled.checked;
if (!passwordEnabled.checked) {
passwordInput.value = "";
return;
}
passwordInput.focus();
});
}
if (fileInput && dropzone) {
dropzone.addEventListener("dragover", (event) => {
event.preventDefault();
@@ -340,6 +359,12 @@ if (uploadForm) {
return;
}
if (passwordEnabled && passwordEnabled.checked && passwordInput && !passwordInput.value.trim()) {
updateStatus("Enter password");
passwordInput.focus();
return;
}
let completedCount = 0;
const totalCount = selectedFiles.length;
const statusPrefix = () => `${completedCount}/${totalCount}`;