# Selah.

Your worship songs. Offline. No ads. An installable web app for iPhone, Android, Mac and Windows that plays the
songs you own from the device's own storage, with lock screen, Control Center and media key controls. Design and build spec: [docs/SPEC.md](docs/SPEC.md).

## Develop

```bash
npm install
npm run dev        # http://localhost:5173/selah/
npm test
npm run build
```

In development, importing works in any browser. In production, Safari (iPhone and Mac) only imports in the
installed app, because it keeps separate storage; Chrome and Edge import in the tab too.

Layouts: phone under 600 px, tablet 600–1023 px, laptop 1024 px and up (sidebar, player bar, shortcuts:
Space, ← →, Shift ← →, ⌘K / Ctrl K, Esc, ⌘, / Ctrl ,). Drop files or folders anywhere to add them.

## Deploy (Cloudflare)

Push to `main`: `.github/workflows/deploy.yml` tests, builds with `SELAH_BASE=/`, deploys the app to the
Cloudflare Pages project `selah` (custom domain `selah.okoro.me`) and the lookup Worker in `worker/`
(`selah-api.okoro.me`). It needs the secrets `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`, and the
variables `VITE_LOOKUP_URL` (the Worker) and `VITE_HELPER_URL` (your Selah helper), which are baked in.

The installed app keeps its songs per address, so keep `selah.okoro.me` for good.

## Online lookups (optional)

`worker/` is a Cloudflare Worker for "Find tags and cover online", deployed with the app. To deploy it by
hand, check `CONTACT`, `ALLOWED_ORIGIN` and the route in `worker/wrangler.toml`, then `npx wrangler deploy`
from `worker/`. Put its address in Settings ›
Online lookups (or in `VITE_LOOKUP_URL`). The Selah helper can do the same job.

## Adding songs from links (optional)

Run the Selah helper on your computer or home server; see [server/README.md](server/README.md). It
gives each person their own access code and takes turns between them.

## Test on your iPhone

Service workers need HTTPS, so test from the deployed address (or a tunnel), not `vite --host`.
Run the checklists in docs/SPEC.md › Testing on your iPhone, including the laptops and Android list for
milestone 7.
