Merge pull request #2812 from omnivore-app/fix/web-service-worker-cache

Dont use the service worker cache as it interferes with the content security policy
This commit is contained in:
Jackson Harper 2023-09-30 14:06:49 +08:00 committed by GitHub
commit 4bda74db3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,23 +129,6 @@
})
}
function handleFetchRequest(ev) {
const request = ev.request
if (request.method === 'POST') {
const requestUrl = new URL(request.url)
if (requestUrl.pathname === '/share-target') {
const shareRequest = handleShareTarget(request)
return shareRequest
}
}
if (naviApi.onLine) {
return globalApi.fetch(request)
}
return fetchWithCacheBackup(request)
}
function handleOutdatedCache() {
return globalApi.caches.keys().then((cacheNames) => {
return Promise.all(
@ -181,8 +164,16 @@
if (ev.request.destination === 'script') {
return
}
if (ev.request.destination === 'image') {
return
}
const handler = handleFetchRequest(ev)
ev.respondWith(handler)
if (ev.request.method === 'POST') {
const requestUrl = new URL(ev.request.url)
if (requestUrl.pathname === '/share-target') {
const shareRequest = handleShareTarget(ev.request)
return shareRequest
}
}
})
})()