mirror of
https://fastgit.cc/https://github.com/anomalyco/opencode
synced 2026-04-21 05:10:58 +08:00
Include serverID in relay event payloads and prefer server+session matching in mobile notification handling so taps reliably open the correct context and stale state is refreshed.
APN Relay
Minimal APNs relay for OpenCode mobile background notifications.
What it does
- Registers iOS device tokens for a shared secret.
- Receives OpenCode event posts (
complete,permission,error). - Sends APNs notifications to mapped devices.
- Stores delivery rows in PlanetScale.
Routes
GET /healthGET /(simple dashboard)POST /v1/device/registerPOST /v1/device/unregisterPOST /v1/event
Environment
Use .env.example as a starting point.
DATABASE_HOSTDATABASE_USERNAMEDATABASE_PASSWORDAPNS_TEAM_IDAPNS_KEY_IDAPNS_PRIVATE_KEYAPNS_DEFAULT_BUNDLE_ID
Run locally
bun install
bun run src/index.ts
Docker
Build from this directory:
docker build -t apn-relay .
docker run --rm -p 8787:8787 --env-file .env apn-relay