Collect discovered video metadata and recommend videos from listening history

This commit is contained in:
Jonathan Sykes
2026-10-03 07:16:51 +08:00
parent 343eb53d89
commit 5154ef5f75
16 changed files with 963 additions and 24 deletions

View File

@@ -60,6 +60,7 @@ const SHELL = [
'/refresh.css',
'/theme-glass.css',
'/theme-classic.css',
'/recommendations.css',
'/flag-ui.js',
'/export.js',
'/async-guard.js',
@@ -203,6 +204,12 @@ self.addEventListener('fetch', (e) => {
// The admin page is online-only and must never be served from a cache.
if (url.pathname === '/admin' || url.pathname.startsWith('/admin.')) return;
// Catalog artwork uses the same offline image cache as YouTube artwork.
if (url.origin === self.location.origin && /^\/api\/catalog\/[\w-]{11}\/thumbnail$/.test(url.pathname)) {
e.respondWith(thumbnail(request));
return;
}
// API calls and binary downloads → network only, no caching
if (url.pathname.startsWith('/api/')) {
e.respondWith(fetch(request));