Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ Direct messages are end-to-end encrypted.
or host immediately. Accounts add direct messages, a persistent identity, and
stats.
- End-to-end encrypted DMs (ECDH P-256 + AES-GCM); the server stores only
ciphertext it cannot read.
ciphertext it cannot read. Keys are per-device, with a passphrase-protected
backup to carry your history to another device.
- Use one account from several devices at once; messages reach all of them.

**Installable** — Beacon is a PWA: install it from the browser's address bar
for an app window and an offline shell.

---

Expand Down
33 changes: 17 additions & 16 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beacon Roadmap

Where the project stands and everything left to do. Updated 2026-07-03.
Where the project stands and everything left to do. Updated 2026-07-04.

## Done

Expand All @@ -27,28 +27,29 @@ Where the project stands and everything left to do. Updated 2026-07-03.
- **Cinema mode** — pure-CSS lights-down while playing.
- **Reliability** — P2P connections fail gracefully with a clear error + retry
(no more infinite spinner); shared playback control (anyone can pause/seek).
- **Deployed** — live on an Oracle Cloud free VM behind Caddy (HTTPS), systemd,
SQLite on a persistent path. See `deploy/DEPLOY.md`.
- **Multi-device** — one account can be connected from several devices at once;
DMs, offers, invites, and presence track all of them.
- **DM key backup** — passphrase-encrypted export/restore of the message key,
so history can move to a new device.
- **Installable PWA** — web manifest, app icon, and an offline app shell.
- **Hardening** — audited and patched: no email leakage, proxy-aware rate
limits, hostile-peer defenses in the P2P receiver (with regression tests),
clean dependency audit enforced in CI.
- **UI** — pared back from the templated look to a restrained, neutral theme;
all panels on the design tokens; own favicon.
- **Ops** — nightly SQLite backup script; CI runs typecheck, build, and audit.
- **Deployed** — live on an Oracle Cloud free VM behind Caddy (HTTPS + security
headers), systemd, SQLite on a persistent path. See `deploy/DEPLOY.md`.

## Remaining

### UI polish
- [ ] The inner FileShare, VideoFileSharing, and Voice panels still carry
pre-design-system blue/green accents.
- [ ] Replace the default Vite favicon with a real one.

### Connectivity
- [ ] Firefox + TURN: the free Metered relay gives Firefox zero relay
candidates (see QUESTIONS.md). Try another provider and verify on two
real devices on different networks.

### PWA
- [ ] Installable app: manifest, icons, offline shell ("add to home screen").
- [ ] (Optional, later) Tauri desktop wrapper from the same web code.
real devices on different networks. (Needs a provider account.)

### Smaller debt
- [ ] DM key backup (passphrase) + device-only delivery toggle (deferred from
the DM work).
- [ ] OPFS cleanup sweep for abandoned partial transfers.
- [ ] Device-only DM delivery toggle (deferred from the DM work).
- [ ] Swap the temporary hostname for a real (sub)domain when one is
available: edit the Caddyfile site line + ALLOWED_ORIGINS, reload Caddy.
- [ ] (Optional, later) Tauri desktop wrapper from the same web code.
3 changes: 3 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="apple-touch-icon" href="/app-icon.svg" />
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#10131A" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beacon</title>
<meta name="description" content="Watch videos in sync and send files directly between browsers." />
Expand Down
6 changes: 6 additions & 0 deletions client/public/app-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions client/public/manifest.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Beacon",
"short_name": "Beacon",
"description": "Watch videos in sync and send files directly between browsers.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#10131A",
"theme_color": "#10131A",
"icons": [
{
"src": "/app-icon.svg",
"type": "image/svg+xml",
"sizes": "any",
"purpose": "any maskable"
}
]
}
59 changes: 57 additions & 2 deletions client/public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,25 @@
const streams = new Map() // key -> { size, mime, clientId }
const MAX_WINDOW = 2 * 1024 * 1024 // cap each 206 response; browser follows up

self.addEventListener('install', () => self.skipWaiting())
self.addEventListener('activate', (event) => event.waitUntil(self.clients.claim()))
// App-shell cache, so an installed PWA opens offline. Bump the version to
// invalidate old entries on the next activate. Hashed build assets are
// immutable, so caching them is safe; the HTML shell is refreshed
// network-first below.
const SHELL_CACHE = 'beacon-shell-v1'
const SHELL_URLS = ['/', '/index.html', '/favicon.svg', '/manifest.webmanifest']

self.addEventListener('install', (event) => {
event.waitUntil(
caches.open(SHELL_CACHE).then((c) => c.addAll(SHELL_URLS)).catch(() => {}).then(() => self.skipWaiting()),
)
})
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.filter((k) => k !== SHELL_CACHE).map((k) => caches.delete(k))))
.then(() => self.clients.claim()),
)
})

self.addEventListener('message', (event) => {
const { t } = event.data ?? {}
Expand Down Expand Up @@ -41,6 +58,44 @@ async function fetchRangeFromClient(entry, key, start, end) {

self.addEventListener('fetch', (event) => {
const url = new URL(event.request.url)

// App-shell caching for same-origin GETs — but never the P2P stream, the
// API, or the socket transport, which must always hit the live server/peer.
if (
event.request.method === 'GET' &&
url.origin === self.location.origin &&
!url.pathname.startsWith('/p2p/') &&
!url.pathname.startsWith('/api/') &&
!url.pathname.startsWith('/socket.io/')
) {
if (event.request.mode === 'navigate') {
// Network-first for navigations so a fresh shell wins when online, with
// the cached shell as the offline fallback.
event.respondWith(
fetch(event.request).catch(() => caches.match('/index.html').then((r) => r ?? Response.error())),
)
return
}
// Cache-first only for content-hashed build assets — never media, and
// never a Range request (partial responses would corrupt the cache and
// break video seeking).
const isAsset = /\.(js|mjs|css|woff2?|svg|png|ico|webmanifest)$/.test(url.pathname)
if (isAsset && !event.request.headers.has('range')) {
event.respondWith(
caches.match(event.request).then((hit) =>
hit ?? fetch(event.request).then((res) => {
if (res.ok && res.type === 'basic') {
const copy = res.clone()
caches.open(SHELL_CACHE).then((c) => c.put(event.request, copy)).catch(() => {})
}
return res
}),
),
)
}
return
}

if (!url.pathname.startsWith('/p2p/')) return
const key = url.pathname.slice('/p2p/'.length)
const entry = streams.get(key)
Expand Down
11 changes: 10 additions & 1 deletion client/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,13 @@ ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
)

// Register the service worker so the app is installable and opens offline.
// It's the same worker that powers stream-while-downloading; registering it on
// load (rather than lazily on first stream) is what makes the PWA installable.
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js').catch(() => {})
})
}
Loading