feat: update service worker cache version and bypass proxy API routes

This commit is contained in:
kuekhaoyang
2025-11-23 18:31:27 +08:00
parent c187fa6615
commit 79f2928172
+6 -1
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = 'video-cache-v1';
const CACHE_NAME = 'video-cache-v2';
self.addEventListener('install', (event) => {
self.skipWaiting();
@@ -21,6 +21,11 @@ self.addEventListener('activate', (event) => {
self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url);
// Skip proxy API routes - they handle their own caching and URL rewriting
if (url.pathname.startsWith('/api/proxy')) {
return; // Let the request pass through without Service Worker intervention
}
// Intercept HLS manifest files (.m3u8)
if (url.pathname.endsWith('.m3u8')) {
event.respondWith(