summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-11-11 23:03:41 -0500
committerOwen Jacobson <owen@grimoire.ca>2024-11-11 23:03:41 -0500
commitc6c46436558f5058eccdb9b793ed02fc1640a80d (patch)
tree997a94e320aa3ade7caafa23cd01c2d653dcd331
parenta0fc6434cb1f65b558a0a94c5cdddf5d79d15206 (diff)
parentd5199183bc8114dc78adb19f66b09f1e61c67f1b (diff)
Merge remote-tracking branch 'origin/prop/pwa'
-rw-r--r--ui/app.html1
-rw-r--r--ui/lib/assets/logo.pngbin137101 -> 92469 bytes
-rw-r--r--ui/service-worker.js54
-rw-r--r--ui/static/apple-touch-icon-precomposed.pngbin0 -> 92469 bytes
-rw-r--r--ui/static/apple-touch-icon.pngbin0 -> 92469 bytes
-rw-r--r--ui/static/favicon.icobin0 -> 92469 bytes
-rw-r--r--ui/static/favicon.pngbin137101 -> 92469 bytes
-rw-r--r--ui/static/manifest.json43
8 files changed, 98 insertions, 0 deletions
diff --git a/ui/app.html b/ui/app.html
index 10525fe..5e7d92b 100644
--- a/ui/app.html
+++ b/ui/app.html
@@ -4,6 +4,7 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
+ <link rel="manifest" href="%sveltekit.assets%/manifest.json" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover" data-theme="skeleton">
diff --git a/ui/lib/assets/logo.png b/ui/lib/assets/logo.png
index 5df6b4e..4b35d9b 100644
--- a/ui/lib/assets/logo.png
+++ b/ui/lib/assets/logo.png
Binary files differ
diff --git a/ui/service-worker.js b/ui/service-worker.js
new file mode 100644
index 0000000..e2143b3
--- /dev/null
+++ b/ui/service-worker.js
@@ -0,0 +1,54 @@
+/// <reference types="@sveltejs/kit" />
+/// <reference no-default-lib="true"/>
+/// <reference lib="esnext" />
+/// <reference lib="webworker" />
+
+// Because of this line, this service worker won't run in dev mode in Firefox.
+// Only Safari, Edge, Chrome can run it at the moment, because only they
+// support modules in service workers.
+//
+// That's okay! If you run `tools/run` with PILCROW_DEV unset, you will get the
+// bundled version, and can work on it. Or just use Safari.
+import { build, files, version } from '$service-worker';
+
+// Create a unique cache name for this deployment
+const CACHE = `cache-${version}`;
+
+const ASSETS = [
+ ...build, // the app itself
+ ...files // everything in `static`
+];
+
+self.addEventListener('install', (event) => {
+ // Create a new cache and add all files to it
+ async function addFilesToCache() {
+ const cache = await caches.open(CACHE);
+ await cache.addAll(ASSETS);
+ }
+
+ event.waitUntil(addFilesToCache());
+});
+
+self.addEventListener('activate', (event) => {
+ // Remove previous cached data from disk
+ async function deleteOldCaches() {
+ for (const key of await caches.keys()) {
+ if (key !== CACHE) await caches.delete(key);
+ }
+ }
+
+ event.waitUntil(deleteOldCaches());
+});
+
+// The simplest possible use of the caches above:
+async function cacheFirst(request) {
+ const responseFromCache = await caches.match(request);
+ if (responseFromCache) {
+ return responseFromCache;
+ }
+ return fetch(request);
+};
+
+self.addEventListener("fetch", (event) => {
+ event.respondWith(cacheFirst(event.request));
+});
diff --git a/ui/static/apple-touch-icon-precomposed.png b/ui/static/apple-touch-icon-precomposed.png
new file mode 100644
index 0000000..4b35d9b
--- /dev/null
+++ b/ui/static/apple-touch-icon-precomposed.png
Binary files differ
diff --git a/ui/static/apple-touch-icon.png b/ui/static/apple-touch-icon.png
new file mode 100644
index 0000000..4b35d9b
--- /dev/null
+++ b/ui/static/apple-touch-icon.png
Binary files differ
diff --git a/ui/static/favicon.ico b/ui/static/favicon.ico
new file mode 100644
index 0000000..4b35d9b
--- /dev/null
+++ b/ui/static/favicon.ico
Binary files differ
diff --git a/ui/static/favicon.png b/ui/static/favicon.png
index 5df6b4e..4b35d9b 100644
--- a/ui/static/favicon.png
+++ b/ui/static/favicon.png
Binary files differ
diff --git a/ui/static/manifest.json b/ui/static/manifest.json
new file mode 100644
index 0000000..29e3e90
--- /dev/null
+++ b/ui/static/manifest.json
@@ -0,0 +1,43 @@
+{
+ "name": "Pilcrow",
+ "short_name": "Pilcrow",
+ "start_url": "/",
+ "display": "standalone",
+ "background_color": "#fdfdfd",
+ "theme_color": "#db4938",
+ "orientation": "portrait-primary",
+ "icons": [
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "72x72"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "96x96"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png","sizes": "128x128"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "144x144"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "152x152"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "192x192"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "384x384"
+ },
+ {
+ "src": "/favicon.png",
+ "type": "image/png", "sizes": "512x512"
+ }
+ ]
+}