diff --git a/.claude/commands/release.md b/.claude/commands/release.md index ffb3688..9420ac8 100644 --- a/.claude/commands/release.md +++ b/.claude/commands/release.md @@ -51,7 +51,7 @@ If no argument provided, default to `patch`. 11. **Deploy to VPS** by running: ``` - ssh 10.0.0.1 'cd ~/src/next.orly.dev && git stash && git pull origin main && export PATH=$PATH:~/go/bin && CGO_ENABLED=0 go build -o ~/.local/bin/next.orly.dev && sudo systemctl restart orly && ~/.local/bin/next.orly.dev version' + ssh relay.orly.dev 'cd ~/src/next.orly.dev && git stash && git pull origin main && export PATH=$PATH:~/go/bin && CGO_ENABLED=0 go build -o ~/.local/bin/next.orly.dev && sudo systemctl restart orly && ~/.local/bin/next.orly.dev version' ``` 12. **Report completion** with the new version and commit hash diff --git a/app/web/dist/index.html b/app/web/dist/index.html index 2fdb886..b5e088c 100644 --- a/app/web/dist/index.html +++ b/app/web/dist/index.html @@ -24,6 +24,11 @@ + + + + + @@ -31,4 +36,9 @@ + diff --git a/app/web/public/icon-192.png b/app/web/public/icon-192.png new file mode 100644 index 0000000..3b75fbc Binary files /dev/null and b/app/web/public/icon-192.png differ diff --git a/app/web/public/icon-512.png b/app/web/public/icon-512.png new file mode 100644 index 0000000..76bd5ac Binary files /dev/null and b/app/web/public/icon-512.png differ diff --git a/app/web/public/index.html b/app/web/public/index.html index 2fdb886..b5e088c 100644 --- a/app/web/public/index.html +++ b/app/web/public/index.html @@ -24,6 +24,11 @@ + + + + + @@ -31,4 +36,9 @@ + diff --git a/app/web/public/manifest.json b/app/web/public/manifest.json new file mode 100644 index 0000000..054b041 --- /dev/null +++ b/app/web/public/manifest.json @@ -0,0 +1,22 @@ +{ + "name": "ORLY Nostr Relay", + "short_name": "ORLY", + "description": "High-performance Nostr relay", + "display": "standalone", + "start_url": "/", + "scope": "/", + "theme_color": "#000000", + "background_color": "#000000", + "icons": [ + { + "src": "/icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/app/web/public/sw.js b/app/web/public/sw.js new file mode 100644 index 0000000..e04e6af --- /dev/null +++ b/app/web/public/sw.js @@ -0,0 +1,95 @@ +const CACHE_VERSION = 'orly-v1'; +const STATIC_ASSETS = [ + '/', + '/index.html', + '/bundle.js', + '/bundle.css', + '/global.css', + '/favicon.png', + '/icon-192.png', + '/icon-512.png', + '/orly.png' +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_VERSION).then((cache) => { + return cache.addAll(STATIC_ASSETS); + }) + ); + self.skipWaiting(); +}); + +self.addEventListener('activate', (event) => { + event.waitUntil( + caches.keys().then((cacheNames) => { + return Promise.all( + cacheNames + .filter((name) => name !== CACHE_VERSION) + .map((name) => caches.delete(name)) + ); + }) + ); + self.clients.claim(); +}); + +self.addEventListener('fetch', (event) => { + const url = new URL(event.request.url); + + // Skip WebSocket requests + if (url.protocol === 'ws:' || url.protocol === 'wss:') { + return; + } + + // Skip non-GET requests + if (event.request.method !== 'GET') { + return; + } + + // API calls: network-first with cache fallback + if (url.pathname.startsWith('/api/')) { + event.respondWith( + fetch(event.request) + .then((response) => { + if (response.ok) { + const clone = response.clone(); + caches.open(CACHE_VERSION).then((cache) => { + cache.put(event.request, clone); + }); + } + return response; + }) + .catch(() => { + return caches.match(event.request); + }) + ); + return; + } + + // Static assets: cache-first with network fallback + event.respondWith( + caches.match(event.request).then((cached) => { + if (cached) { + // Update cache in background + fetch(event.request).then((response) => { + if (response.ok) { + caches.open(CACHE_VERSION).then((cache) => { + cache.put(event.request, response); + }); + } + }).catch(() => {}); + return cached; + } + + return fetch(event.request).then((response) => { + if (response.ok) { + const clone = response.clone(); + caches.open(CACHE_VERSION).then((cache) => { + cache.put(event.request, clone); + }); + } + return response; + }); + }) + ); +}); diff --git a/app/web/rollup.config.js b/app/web/rollup.config.js index 4a33b62..eb21a62 100644 --- a/app/web/rollup.config.js +++ b/app/web/rollup.config.js @@ -84,7 +84,11 @@ export default { { src: 'public/global.css', dest: 'dist' }, { src: 'public/favicon.png', dest: 'dist' }, { src: 'public/orly.png', dest: 'dist' }, - { src: 'public/orly-favicon.png', dest: 'dist' } + { src: 'public/orly-favicon.png', dest: 'dist' }, + { src: 'public/manifest.json', dest: 'dist' }, + { src: 'public/sw.js', dest: 'dist' }, + { src: 'public/icon-192.png', dest: 'dist' }, + { src: 'public/icon-512.png', dest: 'dist' } ] }), ], diff --git a/pkg/version/version b/pkg/version/version index 3170957..2fd8c6a 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.43.0 +v0.43.1