Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

Commit

Permalink
feat: make tileboard installable as web apk (#822)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafał Chłodnicki <[email protected]>
  • Loading branch information
akloeckner and rchl authored Jun 19, 2022
1 parent 6f62173 commit a1dd248
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
Binary file modified favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,27 @@
<link rel="stylesheet" href="./styles/custom.css">

<script>
window.IN_INGRESS = false;
window.AUTH_TOKEN_OVERRIDE = null;
window.SERVER_URL_OVERRIDE = null;
window.REST_URL_OVERRIDE = null;
window.WS_URL_OVERRIDE = null;
</script>

<script>
// Source: https://developers.google.com/web/fundamentals/primers/service-workers
// License: https://www.apache.org/licenses/LICENSE-2.0
if (!window.IN_INGRESS && 'serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('./ServiceWorker.js', )
.catch(function(err) {
// Registration failed
console.log('ServiceWorker registration failed: ', err);
});
});
}
</script>

<% javascripts.forEach(javascript => { %><script src="./<%= javascript %>"></script><% }) %>
</head>

Expand Down
17 changes: 12 additions & 5 deletions manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"name": "TileBoard",
"icons": [{
"src": "favicon.png",
"sizes": "16x16 24x24 32x32 48x48 64x64 192x192",
"type": "image/png"
}],
"icons": [
{
"src": "favicon.svg",
"sizes": "16x16 24x24 32x32 48x48 64x64 192x192 256x256 512x512",
"type": "image/svg+xml"
},
{
"src": "favicon.png",
"sizes": "16x16 24x24 32x32 48x48 64x64 192x192 256x256 512x512",
"type": "image/png"
}
],
"display": "fullscreen"
}
2 changes: 2 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ const config = {
}),
copy([
{ files: './favicon.png', dest: `./${outDir}/` },
{ files: './favicon.svg', dest: `./${outDir}/` },
{ files: './scripts/ServiceWorker.js', dest: `./${outDir}/` },
{ files: './manifest.webmanifest', dest: `./${outDir}/` },
{ files: './images/*.*', dest: `./${outDir}/images/` },
]),
Expand Down
4 changes: 4 additions & 0 deletions scripts/ServiceWorker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Installable progressive web app requires fetch handler
self.addEventListener('fetch', function (event) {
event.respondWith(fetch(event.request));
});

0 comments on commit a1dd248

Please sign in to comment.