more pwa stuff
This commit is contained in:
BIN
public/assets/images/192x192.png
Normal file
BIN
public/assets/images/192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
public/assets/images/512x512.png
Normal file
BIN
public/assets/images/512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -11,6 +11,16 @@
|
||||
"src": "/public/assets/images/android-chrome-144x144.png",
|
||||
"sizes": "144x144",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/public/assets/images/192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/public/assets/images/512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#daeedd",
|
||||
|
||||
@@ -30,16 +30,17 @@ self.addEventListener("fetch", event => {
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then(response => cache(event.request, response))
|
||||
.catch(function() {
|
||||
return caches.match(event.request);
|
||||
})
|
||||
.catch(() => caches.match(event.request))
|
||||
);
|
||||
});
|
||||
|
||||
function cache(request, response) {
|
||||
//console.log(response.type === "error" || response.type === "opaque", request);
|
||||
if (response.type === "error" || response.type === "opaque") {
|
||||
return response;
|
||||
if (
|
||||
response.type === "error" ||
|
||||
!(response.url.includes("http:") && response.url.includes("https:")) ||
|
||||
response.url == ""
|
||||
) {
|
||||
return Promise.resolve(response);
|
||||
}
|
||||
|
||||
return caches.open(CACHE_NAME).then(cache => {
|
||||
|
||||
@@ -52,11 +52,13 @@
|
||||
</html>
|
||||
|
||||
<style>
|
||||
noscript {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
noscript {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background-color: #dbeede;
|
||||
font-size: 1.5rem;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user