mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Dont use the service worker cache as it interferes with the content security policy
If we use this, then the CSP can't set security policies as granularly, as almost everything will go through connect-src, like every time we get a fallback image it would go through fetch and connect-src would have to allow all https.
This commit is contained in:
parent
c9b178ca5c
commit
d120a6aa3d
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(request.url)
|
||||
if (requestUrl.pathname === '/share-target') {
|
||||
const shareRequest = handleShareTarget(request)
|
||||
return shareRequest
|
||||
}
|
||||
}
|
||||
})
|
||||
})()
|
||||
|
|
|
|||
Loading…
Reference in a new issue