diff --git a/static/images/mt-icon-512.png b/static/images/mt-icon-512.png new file mode 100644 index 000000000..7a57f9064 Binary files /dev/null and b/static/images/mt-icon-512.png differ diff --git a/static/index.html b/static/index.html index 930336461..29b766bc5 100644 --- a/static/index.html +++ b/static/index.html @@ -54,6 +54,7 @@ crossorigin="anonymous" referrerpolicy="no-referrer" /> + +
diff --git a/static/manifest.json b/static/manifest.json new file mode 100644 index 000000000..02426b748 --- /dev/null +++ b/static/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "MT", + "name": "Monkeytype", + "start_url": "/", + "icons": [ + { + "src": "/images/mt-icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "background_color": "#323437", + "display": "standalone", + "theme_color": "#323437" +} diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 000000000..900572a4d --- /dev/null +++ b/static/sw.js @@ -0,0 +1,15 @@ +self.addEventListener("install", function (event) { + event.waitUntil( + caches.open("sw-cache").then(function (cache) { + return cache.add("index.html"); + }) + ); +}); + +self.addEventListener("fetch", function (event) { + event.respondWith( + caches.match(event.request).then(function (response) { + return response || fetch(event.request); + }) + ); +});