Fix broken initial page load by excluding our own JavaScript. Also return 404 on error.
This commit is contained in:
parent
f670087097
commit
e6fc8a8b13
|
@ -77,7 +77,9 @@ self.addEventListener('fetch', (event) => {
|
||||||
// If this isn't an IPFS URL, bail.
|
// If this isn't an IPFS URL, bail.
|
||||||
if (!multihash.startsWith('/ipfs/')) {
|
if (!multihash.startsWith('/ipfs/')) {
|
||||||
console.log('not a valid IPFS hash:', multihash)
|
console.log('not a valid IPFS hash:', multihash)
|
||||||
event.respondWith(not_found_response())
|
if (multihash != '/bundle.js' && multihash != '/fetcher.js') {
|
||||||
|
event.respondWith(not_found_response())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +117,7 @@ self.addEventListener('fetch', (event) => {
|
||||||
return not_found_response()
|
return not_found_response()
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
return not_found_response()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Reference in New Issue