feat: wire up WEB-mode OPFS offline cache for PWA

The PWA conversion shipped sw.js, opfs.js, manifest and icons, but app.js
was never updated to use them — it still routed cache_* calls through the
native bridge (call('cache.list', ...)), which throws 'No native bridge
available' in a browser. That surfaced as 'Offline cache unavailable /
not available in this build' on the Saved videos and Settings pages.

- Add WEB mode detection (no Tauri/zero bridge present)
- Route cache_* through OPFS (opfsDownload/Status/List/Delete/Clear)
- Proxy downloads via /api/download so the browser never hits YouTube CDN
- Load fingerprint.js + opfs.js; add manifest link and PWA meta tags
- Relax CSP to allow blob: media/img and worker-src 'self' for the SW
This commit is contained in:
Jonathan Sykes
2026-06-30 08:37:45 +08:00
parent 847e99cd51
commit 84d6487125
4 changed files with 240 additions and 16 deletions

View File

@@ -1017,6 +1017,24 @@ input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
from { opacity: 1; transform: translateY(0); }
to { opacity: 0; transform: translateY(-8px); }
}
/* PWA update banner — persistent toast with inline action button */
.toast-update {
border-color: var(--accent);
display: flex;
align-items: center;
gap: 10px;
}
.toast-reload-btn {
background: var(--accent);
color: #fff;
border: none;
border-radius: 6px;
padding: 4px 10px;
font-size: 12.5px;
font-weight: 600;
cursor: pointer;
white-space: nowrap;
}
/* ===================== Keyboard shortcut overlay ===================== */
.shortcut-overlay {