Keep search results with thumbnails until cleared in Settings; add stale-while-revalidate search and longer asset caching

This commit is contained in:
Claude
2026-10-01 22:04:51 +00:00
parent 61a8f63385
commit 14e2307a92
6 changed files with 273 additions and 58 deletions

View File

@@ -56,6 +56,14 @@ JSON shapes mirror the Tauri Rust bridge exactly — don't change one side alone
extras, `.mode-name`) are in the shared markup and hidden by default.
- Now-playing tiles are `[svg.ti][span.tl]`; change state text with `setTile(btn, label)`, never `textContent`.
## Saved searches + caching notes
- `SearchLibrary` (app.js, localStorage `ytpSearchLibrary`, ≤150 queries × 50 results incl. thumbnail URLs) keeps
every search. The search box's recent list and its "Clear this list" only touch `ytpRecentSearches`; results are
deleted ONLY in Settings → Saved searches (select + delete, or clear all). Thumbnails are warmed into the SW
`ytplayer-thumbs` cache (`THUMB_CACHE_MAX` 2500). Browse view: `{type:'savedSearches'}`.
- `/api/search`: 10 min fresh cache, then stale-while-revalidate up to 6 h (answers instantly, refreshes in the
background); identical concurrent searches share one fetch (`fetchSearch`). `/fonts` and `/icons` are cached 30 days.
## Server media cache (`server/media-cache.js`)
- Every played (`/api/streams`, LOW priority, ≤ `MEDIA_AUTO_MAX_SECONDS`, default 3 h) or saved
(`/api/download`, HIGH, ≤ 3 h) video gets ONE copy: `$MEDIA_DIR/<id>.<gen>.mp4`