diff --git a/.github/workflows/deploy_gh_pages.yml b/.github/workflows/deploy_gh_pages.yml
new file mode 100644
index 0000000..27dcd1a
--- /dev/null
+++ b/.github/workflows/deploy_gh_pages.yml
@@ -0,0 +1,50 @@
+name: Deploy to GitHub Pages
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ build_site:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+
+ - name: Install dependencies
+ run: npm ci
+
+ - name: build
+ env:
+ BASE_PATH: '/${{ github.event.repository.name }}'
+ run: |
+ npm run build
+
+ - name: Upload Artifacts
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: 'build/'
+
+ deploy:
+ needs: build_site
+ runs-on: ubuntu-latest
+
+ permissions:
+ pages: write
+ id-token: write
+
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+
+ steps:
+ - name: Deploy
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts
index 77ab0a0..a3d1578 100644
--- a/src/routes/+layout.ts
+++ b/src/routes/+layout.ts
@@ -1 +1 @@
-export const ssr = true;
+export const ssr = false;
diff --git a/src/service-worker.ts b/src/service-worker.ts
new file mode 100644
index 0000000..68d8d28
--- /dev/null
+++ b/src/service-worker.ts
@@ -0,0 +1,75 @@
+///
+///
+///
+///
+
+declare let self: ServiceWorkerGlobalScope;
+
+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());
+});
+
+self.addEventListener("fetch", (event: FetchEvent) => {
+ const url = new URL(event.request.url);
+ // ignore POST requests etc
+ if (event.request.method !== "GET") return;
+ // ignore oauth pages
+ if (url.pathname.startsWith("/oauth")) return;
+
+ async function respond() {
+ const cache = await caches.open(CACHE);
+
+ // `build`/`files` can always be served from the cache
+ if (ASSETS.includes(url.pathname)) {
+ return cache.match(url.pathname);
+ }
+
+ // for everything else, try the network first, but
+ // fall back to the cache if we're offline
+ try {
+ const response = await fetch(event.request);
+
+ if (response.status === 200) {
+ cache.put(event.request, response.clone());
+ }
+
+ return response;
+ } catch {
+ return cache.match(event.request);
+ }
+ }
+
+ event.respondWith(
+ (async () => {
+ const resp = await respond();
+ return resp ? resp : new Response(undefined, { status: 404 });
+ })(),
+ );
+});
diff --git a/svelte.config.js b/svelte.config.js
index fe26f61..4932f24 100644
--- a/svelte.config.js
+++ b/svelte.config.js
@@ -1,4 +1,4 @@
-import adapter from '@sveltejs/adapter-vercel';
+import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
@@ -11,7 +11,9 @@ const config = {
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
- adapter: adapter()
+ adapter: adapter({
+ fallback: 'index.html'
+ })
}
};