docs: Android app and API in the README; android.md as built

06ebb60 · gmorell · 2026-12-03 01:34

3 files +48 -4

Files changed

modified README.md
+17 −1
@@ -4,7 +4,7 @@ A small axum web application scaffold with:
4 4
5 5 - **axum** web stack with `minijinja` templates (embedded at build time, hot-reloaded from `templates/` in dev)
6 6 - **sea-orm + Postgres** with a `migration` crate (auto-migrates on boot)
7 −- **Auth**: Argon2 password hashing, cookie sessions, invite-only registration, email verification (mail through mail-prism), optional "Sign in with NEIAM" (OIDC), and bearer **API tokens** for scripts/mobile
7 +- **Auth**: Argon2 password hashing, cookie sessions, invite-only registration, email verification (mail through mail-prism), optional "Sign in with NEIAM" (OIDC), and per-device bearer tokens (hashed, 90-day sliding expiry) for the Android app and scripts
8 8 - **Tailwind + DaisyUI** front-end with a theme switcher (`just assets` to build)
9 9 - Prometheus metrics at `/metrics`, health check at `/healthz`
10 10 - A `Dockerfile` (assets → cargo → debian-slim) and `compose.yml` (Postgres + web)
@@ -120,6 +120,22 @@ Admin, auth, profile and the new-topic/edit forms are Classic only. See
120 120 `src/handlers/focus.rs` (modelled on pin_flip's focus mode and shared pages,
121 121 and cartosnap's shared-trip stepping).
122 122
123 +## Android app and API
124 +
125 +`android/` is the phone client (Kotlin + Compose): browse in Classic or Focus
126 +(the profile's Layout), read, reply, start topics, react, bookmark, watch,
127 +tags, search, notifications, profile. Pair it from **Devices** in the account
128 +menu, which shows a QR of `recourse://pair?base=…&token=…` once; the same page
129 +renames and revokes devices. Build with `just apk` (it finds a JDK 17–21 even
130 +when the system `java` is 25); see [`android/README.md`](android/README.md).
131 +
132 +It talks to `/api/v1` ([`docs/api.md`](docs/api.md)), bearer tokens only, with
133 +the web's visibility, trust, verification, view and read rules — the API calls
134 +the same code (`src/actions.rs` for writes). `just test-db` runs the API tests
135 +against a scratch database; `just fixtures` refreshes the responses the app's
136 +contract test decodes. The plan, and what came out differently, is
137 +[`docs/android.md`](docs/android.md).
138 +
123 139 ## Email verification
124 140
125 141 New accounts (registration through an invite) start **unverified**: they can
modified docs/android.md
+31 −3
@@ -7,8 +7,8 @@ one whose pairing flow this copies) and `../pin_flip/android` do. The server
7 7 half follows `../rosin_hunter_3000`: a bearer-only `/api/v1` nest with its own
8 8 JSON-401 middleware.
9 9
10 −Status: built (§6). §8 says where the result differs from the plan below,
11 −which is otherwise kept as it was written.
10 +Status: built, steps 1–5 (§6). §8 says where the result differs from the
11 +plan below, which is otherwise kept as it was written.
12 12
13 13 ## 1. Goals
14 14
@@ -212,4 +212,32 @@ party-slut §4 reads a sign-in code from an SMS. recourse has no code sign-in.
212 212
213 213 ## 8. As built
214 214
215 −See the bottom of this file once built.
215 +All five steps exist, server and app. What came out differently:
216 +
217 +- **Paths.** `src/api/mod.rs` is the route list; `docs/api.md` the reference.
218 + Marking all notifications read is `POST notifications/read`. Reading a
219 + removed topic is `410 removed` for non-staff (the web shows a tombstone).
220 +- **Malformed ids** answer in the envelope too (`ApiPath`, beside
221 + party-slut's `ApiJson`), and unknown `/api/v1` paths are JSON 404s.
222 +- **The web got stricter.** Moving the reaction, bookmark and watch toggles
223 + onto `crate::actions` gave them the visibility check they lacked: before,
224 + they acted on any post or category id, hidden or deleted.
225 +- **Tokens can't be re-shown.** movie_monster re-shows a token's QR from its
226 + list; hashing them (party-slut) makes that impossible, so a wiped phone is
227 + a revoke and a fresh pairing. The old "expires in N days" field is gone:
228 + device tokens slide instead.
229 +- **Classic topics don't page.** The reader always gets the list a topic was
230 + opened from, but only Focus lets a swipe move through it, matching the web
231 + (only Focus steps).
232 +- **Layout switching** is a toolbar button on the forum and category screens
233 + plus the profile control; both `PATCH /me`.
234 +- **Post bodies** are `HtmlCompat` over the server's `cooked`: links work,
235 + images and code blocks render plainly.
236 +- **Not verified on a device or emulator.** Everything is built and
237 + unit-tested — the API through the real router against Postgres
238 + (`just test-db`), the app's decoding against captured responses
239 + (`just fixtures`, `just apk-test`) — and the API was exercised end to end
240 + with curl against a seeded server, pairing from the Devices page. No AVD
241 + or system image is installed here, so the app itself has not been run.
242 +- **Launcher icon** is a placeholder adaptive icon until `ic_icon.toml` is
243 + exported with icon-studio (`android/README.md`, "Launcher icon").

Parents: 3b701d6