aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-09 23:05:09 -0800
committerAdam Soltys <[email protected]>2022-11-09 23:05:09 -0800
commit055aaea3d02995614b044f66c4a72d68385b1463 (patch)
tree084da06fc774a9e875108cabc682dd5a7f764503
parent64284b65214f049f62c4ac7b123a64a164ecc5bf (diff)
downloadcoinos-ui-055aaea3d02995614b044f66c4a72d68385b1463.tar.gz
coinos-ui-055aaea3d02995614b044f66c4a72d68385b1463.zip
manifest and service worker
-rw-r--r--src/app.html15
-rw-r--r--static/manifest.json17
-rw-r--r--static/manifest.webmanifest2
-rw-r--r--static/service-worker.js7
4 files changed, 23 insertions, 18 deletions
diff --git a/src/app.html b/src/app.html
index 42e791f7..b3325f4c 100644
--- a/src/app.html
+++ b/src/app.html
@@ -6,9 +6,24 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="An easy bitcoin web wallet" />
<meta name="keywords" content="open source bitcoin lightning web wallet" />
+ <link rel="manifest" href="manifest.webmanifest" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
</body>
+ <script>
+ if ('serviceWorker' in navigator) {
+ navigator.serviceWorker.register('/service-worker.js').then(
+ function (registration) {
+ console.log('Service worker registration succeeded:', registration);
+ },
+ function (error) {
+ console.log('Service worker registration failed:', error);
+ }
+ );
+ } else {
+ console.log('Service workers are not supported.');
+ }
+ </script>
</html>
diff --git a/static/manifest.json b/static/manifest.json
deleted file mode 100644
index 3ce34fb8..00000000
--- a/static/manifest.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "short_name": "coinos",
- "name": "coinos",
- "icons": [
- {
- "src": "/icons/coinos.png",
- "type": "image/webp",
- "sizes": "1024x1024",
- "purpose": "any maskable"
- }
- ],
- "start_url": "/",
- "background_color": "#000000",
- "display": "standalone",
- "scope": "/",
- "theme_color": "#000000"
-}
diff --git a/static/manifest.webmanifest b/static/manifest.webmanifest
index f77d93c7..edd56cd7 100644
--- a/static/manifest.webmanifest
+++ b/static/manifest.webmanifest
@@ -1,7 +1,7 @@
{
"theme_color": "#fff",
"background_color": "#000",
- "display": "fullscreen",
+ "display": "standalone",
"scope": "/",
"start_url": "/",
"name": "Coinos",
diff --git a/static/service-worker.js b/static/service-worker.js
new file mode 100644
index 00000000..7952231d
--- /dev/null
+++ b/static/service-worker.js
@@ -0,0 +1,7 @@
+self.addEventListener('fetch', function(event) {
+ event.respondWith(
+ caches.match(event.request).then(function(response) {
+ return response || fetch(event.request);
+ })
+ );
+});