mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
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:
commit
4bda74db3f
1 changed files with 10 additions and 19 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
})
|
||||
})()
|
||||
|
|
|
|||
Loading…
Reference in a new issue