diff --git a/components/profile-modal.html b/components/profile-modal.html
index 559097ba..6cebbf32 100644
--- a/components/profile-modal.html
+++ b/components/profile-modal.html
@@ -993,6 +993,20 @@
class="grid-stack"
data-orientation="vertical"
>
+
+
+ Orphaned storage objects
+
+
+ Files in your bucket that no current video references — safe to
+ remove to reclaim space.
+
+
+
{
+ void this.handleDeleteOrphan(key);
+ }, true);
+
+ li.appendChild(label);
+ li.appendChild(del);
+ return li;
+ }
+
+ async handleDeleteOrphan(key) {
+ const r2Service = this.mainController.services?.r2Service;
+ if (!r2Service || typeof r2Service.deleteStorageKeys !== "function") {
+ return;
+ }
+ if (typeof window !== "undefined" && typeof window.confirm === "function") {
+ if (!window.confirm(`Permanently delete this file from your bucket?\n\n${key}`)) {
+ return;
+ }
+ }
+ let result;
+ try {
+ result = await r2Service.deleteStorageKeys({ keys: [key], pubkey: this.pubkey });
+ } catch (err) {
+ devLogger.warn("[myVideos] deleteStorageKeys failed:", err);
+ this.mainController.showError?.("Failed to delete the file. Please try again.");
+ return;
+ }
+ if (result?.ok && result.deleted?.length) {
+ this.mainController.showSuccess?.("Removed the orphaned file from your bucket.");
+ void this.populate({ forceFetch: false });
+ } else if (result?.reason === "storage-locked") {
+ this.mainController.showError?.("Unlock storage first, then delete the file.");
+ } else {
+ this.mainController.showError?.("Failed to delete the file. Please try again.");
+ }
+ }
+
buildSummary(rows) {
if (!rows.length) {
return "";
@@ -182,6 +303,9 @@ export class MyVideosController {
const li = document.createElement("li");
li.className = "card flex items-center gap-3 p-3 border border-border/60";
li.dataset.health = health.status;
+ if (typeof video.id === "string" && video.id) {
+ li.dataset.videoId = video.id;
+ }
li.appendChild(this.buildThumb(video));
@@ -199,6 +323,7 @@ export class MyVideosController {
const pill = document.createElement("span");
pill.className = `${PILL_BASE} ${PILL_BY_SEVERITY[health.severity] || PILL_BY_SEVERITY.info}`;
pill.textContent = health.label;
+ pill.dataset.role = "health-pill";
titleRow.appendChild(title);
titleRow.appendChild(pill);