gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit3251488a3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre3251488a/README.md

19.3 KB

  1. # tracker.worldapi.org
  2. The new tracker: a Hybriel app that will track the TV shows (and later movies) the creator
  3. follows and watches. **`CONCEPT.md` (the creator's) is the source of truth** — read it first;
  4. nothing is built that it does not describe. Built step by step, one ticket per step
  5. (tracker.worldapi.org#1, #2, …).
  6. **Built so far — step 1 (ticket #1)**: the shell. The header carries the ident login (an
  7. identity selector, like calendar/gitoria) and sign-out; the homepage itself stays empty. No
  8. design carried over from the old app.
  9. **Step 2 (ticket #2)**: the old tracker's MongoDB export is now in `storage/mpackdb/` (new
  10. mpackdb ids, every reference re-pointed) — see "Data" and `STATUS.md`. Nothing is shown in the
  11. UI yet; the homepage still renders empty. That is a later step, from the creator.
  12. **Step 4 (ticket #4)**: the show page, `/shows/:slug` (`components/show.hl`) — poster, title,
  13. genre pills, plot, cast (as described in "What it does (step 4)" below), every season with its
  14. episodes, and the watch check (episode and season, season bulk-toggles its episodes).
  15. **Step 5 (ticket #5)**: `/unwatched` (`components/unwatched.hl`) — every already-released,
  16. unwatched episode of a show the signed-in user follows, newest release first (see "What it does
  17. (step 5)" below).
  18. **Step 6 (ticket #6)**: `/schedule` (`components/schedule.hl`) — every not-yet-released episode
  19. of a show the signed-in user follows, soonest first, no check icons (see "What it does (step 6)"
  20. below).
  21. **Step 7 (ticket #7)**: `/my/shows` (`components/myshows.hl`) — every show the signed-in user
  22. follows, newest follow first: small poster, title, last watched episode (`S08E35`) (see "What it
  23. does (step 7)" below). The homepage itself is still empty.
  24. Written in **Hybriel** on **hl:web**, same stack and conventions as `ident.worldapi.org`
  25. (vendored plugins/binary copied from there, see "Vendored Hybriel").
  26. ## Run (dev, Loreana)
  27. ```bash
  28. cd /media/STORAGE/projects/tracker.worldapi.org
  29. TRACKER_PORT=8700 setsid nohup ./bin/hybriel project.hl > server.log 2>&1 < /dev/null & echo $! > server.pid
  30. # stop: kill $(cat server.pid)
  31. ```
  32. * Config (env; the real environment outranks nothing here — there is no `.env` reader in
  33. project.hl, unlike ident's SMTP settings — set these in the shell or `docker-compose.yml`):
  34. | Variable | Default | |
  35. |---|---|---|
  36. | `TRACKER_PORT` | 45008 | |
  37. | `TRACKER_URL` | `http://127.0.0.1:<port>` | this app's own origin — the ident login button's `return=` is built from it |
  38. | `IDENT_URL` | `https://ident.worldapi.org` | |
  39. | `TRACKER_KEY` / `TRACKER_SECRET` | `''` | this app's API key + secret, from ident's `/apps` (register once, origin = `TRACKER_URL`) — **not set yet on Byrodin**: the first deploy (architect) registers the app in the live ident and puts these in `.env` next to `docker-compose.yml`, exactly like ident's own `.env` holds its SMTP settings |
  40. | `TRACKER_WATCH` | on | `0` = no dev watcher (the container) |
  41. | `TRACKER_STORAGE` | `./storage/mpackdb` | the `usersTable` directory |
  42. | `TRACKER_SESSIONS` | `./.sessions` (hl:web's own default) | this app's own session store |
  43. | `HL_HOST` (or `HOST`) | 0.0.0.0 | interface to bind; `127.0.0.1` on Byrodin |
  44. Without `TRACKER_KEY`/`TRACKER_SECRET`, `/` still renders (signed out, the selector and "Log
  45. in with ident" show in the header); a login attempt answers `'login is not set up on this
  46. server (TRACKER_KEY / TRACKER_SECRET missing)'` instead of exchanging a code — so the app is
  47. never a dead 500 while waiting for that one-time setup.
  48. ## What it does (step 1)
  49. * **Login, copied unchanged from calendar.worldapi.org** (rejected once for a centered
  50. sign-in and no header selector — architect, 2026-09-27): ident only, no own passwords
  51. (ident's login button flow, ident.worldapi.org README "How apps use ident"), the identity
  52. selector (`<ident-selector>`, ident's `/selector.js`) sits in the header
  53. (`components/main.hl`, `userBox`), a plain "Log in with ident" link beside it when signed
  54. out. Choosing an identity in the selector fires `ident-login` (one-time code); `login.js`
  55. (an external-component bridge, allowed per the creator: "login.js is correct, as thats for
  56. externals in general") hands the code to a hidden input, whose `change` calls the server
  57. face `trackerLogin` (`users.hl` `exchangeCode`, `POST <ident>/api/exchange` — nothing else:
  58. ident does not hand over a display name yet, ident#23 done / ident#11 on hold), which makes
  59. or finds this app's own user record (`usersTable`, `storage/mpackdb/users.db`) and sets
  60. `session.user = { id }`. `/login/callback` is the same exchange as a plain redirect (the
  61. login button's return URL) for a client that has no socket yet. "Log out" in the header
  62. calls `trackerLogOut`; ident's own login is untouched. This app's own session cookie is
  63. `trackersid` (cookies ignore ports, an own name keeps it apart from ident's `identsid` on
  64. the same dev host, hybriel#10/#17).
  65. * **The empty homepage** (`/`, `components/home.hl`): no content at all, signed in or out —
  66. the header alone carries the login state. Nothing else.
  67. * **One mpackdb table**: `storage/mpackdb/users.db` (`identity` → this app's user id — no
  68. display name, no other per-user data yet). Step 2 (tracker.worldapi.org#2, open) brings the
  69. old tracker's data across.
  70. ## What it does (step 4)
  71. `/shows/:slug` (`components/show.hl`, slug = the migrated `urlSegment`), read-only data from
  72. `shows.hl`, per-user watch state from `watches.hl` (both reused as-is by `/unwatched` and
  73. `/schedule`, tickets #5/#6 — "reuse, don't copy"):
  74. * **Header**: poster on the left (`/posters/<name>`, `project.hl` `posterRoute` — served from
  75. `storage/mpackdb/posters/`; the real poster files were never in the Mongo backup, see
  76. `DECISIONS.md` "tracker concept" — a placeholder SVG shows until a later TMDB step brings
  77. real ones back), title, genre pills (blue, link to `/genre/<slug>`) and the plot summary to
  78. its right, the cast below as comma-separated red links to `/person/<slug>`.
  79. * **Seasons**, latest first, the latest expanded and every other one collapsed to start; each
  80. row: a round check icon (a disc with a check, drawn in SVG/CSS, no icon font), the season
  81. title/number, its episode count. Its episodes (number + title, and their own check icon)
  82. show once expanded (click the row to toggle).
  83. * **The watch check** (signed-in only — signed out, no check icons show at all): clicking an
  84. episode's check toggles that one watch; clicking a season's check toggles the season's own
  85. watch AND every one of its episodes at once (`watches.hl` `setSeasonWatched`). Every click is
  86. a server round trip (`emit server showToggleEpisode` / `showToggleSeason` / `showRows` for
  87. collapse/expand) that rebuilds the row list server-side and reassigns it whole — a season has
  88. at most a few dozen episodes, cheap. A **Hybriel gap found here** (filed as hybriel#115,
  89. reported after this ticket's first attempt): a plain per-instance member function that calls
  90. an hl:mpackdb-backed import comes back `null` when called from inside an `on server` face,
  91. even though the very same call works as a member's own top-level initializer — the fix is to
  92. declare such helpers `static` (the same shape calendar.worldapi.org's `soonOf` already uses).
  93. `components/show.hl`'s own helpers (`buildRows`, `genreRowsOf`, …) are `static` for exactly
  94. this reason.
  95. * **Data fix**: `tools/relink-episode-seasons.hl`, a one-off idempotent tool that links every
  96. episode whose `season` was still null in the migrated data (36,194 of them, ticket #2) to its
  97. season by matching `(show, seasonNumber)` — never touches an episode whose season is already
  98. set, never runs `update()` on the live table (hybriel#113; it rebuilds a fresh episodes table
  99. and swaps the files over, the same rule `tools/migrate.hl` follows). Not run against the live
  100. data yet — the architect runs it (stop the container first, `storage/mpackdb` is not shared
  101. across processes, hybriel#21).
  102. ## What it does (step 5)
  103. `/unwatched` (`components/unwatched.hl`): every episode of a show the signed-in user follows
  104. (`follows.hl`, new) that is already released (`release` ≤ today) and not yet watched
  105. (`watches.hl` `isWatched`), newest release first. Creator: "/unwatched lists all unwatched
  106. episodes of shows followed in release date desc order"; "check icon is a disc with a check in
  107. it" — the SAME icon/class (`watches.hl` `watchClassOf`, moved there from `components/show.hl` so
  108. both pages share one definition instead of each declaring its own) and the same
  109. `setWatched`/`isWatched` watch logic as the show page (step 4), not copied.
  110. * Each row: check icon, the show's title (linking to `/shows/:slug`), "Ep `<number>` ·
  111. `<title>`", the release date.
  112. * A row only ever shows an unwatched episode, so a click always marks it watched (never toggles
  113. back, unlike the show page's checks) — the row leaves the list. Signed out: no rows, a
  114. "Sign in to see the shows you follow." message instead.
  115. * `follows.hl` (new): read-only per-user follow data (`followedShowIds`), kept apart from
  116. `shows.hl`/`watches.hl` the same way, for `/schedule` (ticket #6) to reuse.
  117. ## What it does (step 6)
  118. `/schedule` (`components/schedule.hl`): every episode of a show the signed-in user follows
  119. (`follows.hl`) that is NOT yet released (`release` > today), soonest first. Creator: "/schedule
  120. has a similar list without check icons for the upcoming episodes of shows followed" — same row
  121. layout as `/unwatched` (show title linking to `/shows/:slug`, "Ep `<number>` · `<title>`", the
  122. release date), minus the check icon and minus any click handling: the page is read-only, so it
  123. needs no `on server` face at all. Signed out: no rows, the same "Sign in to see the shows you
  124. follow." message as `/unwatched`.
  125. ## What it does (step 7)
  126. `/my/shows` (`components/myshows.hl`): every show the signed-in user follows, ordered by the
  127. follow's `at` (epoch ms), newest first. Creator: "trackers /my/shows that just ists the shows in
  128. desc order i followed them, small poster, title, last episode like s08e35". Read-only, no `on
  129. server` face (like `/schedule`).
  130. * Each row: a small poster (2.5rem wide, the same `/posters/<name>` route + placeholder as the show
  131. page; a show with no poster name at all gets `/posters/none`, i.e. the route's placeholder), the
  132. title linking to `/shows/<slug>`, and the **last watched episode** as `SxxEyy` (zero-padded to
  133. two digits) = the HIGHEST season/episode number the user has an episode watch for (architect's
  134. reading, in the ticket) — not the most recently watched one; season watches alone don't count.
  135. Nothing watched → no episode element at all.
  136. * Signed out: no rows, the same "Sign in to see the shows you follow." as `/unwatched`.
  137. * Cost: touches only the user's follows + episode watches (one `episodeById` fetch per watch),
  138. never all episodes of a followed show — 128 rows in ~0.2 s on a copy of the real data (STATUS.md).
  139. * Reuse: `follows.hl` `followsOfUser` (new — the whole follow record, `followedShowIds` now
  140. builds on it), `shows.hl` `episodeById` (new, one line), `showById`, `posterName`, `watches.hl`
  141. `watchesOfUser`.
  142. ## Test
  143. ```bash
  144. node tests/browser.mjs # THE GATE: this app's own server + its OWN ident (a copy of
  145. # ident's code without .env, codes to a mail sink — no live
  146. # ident, no real mail; tests/identkit.mjs, same as calendar's
  147. # gate) + a real headless Chrome: signed out (header shows the
  148. # selector + "Log in with ident", the page itself is empty) ->
  149. # sign in -> header shows "Log out", page still empty -> sign
  150. # out -> signed out again -> a reload stays signed out. Also
  151. # checks the header has no bottom border and filled buttons
  152. # (incl. the ident selector's) have none, while inverted ones
  153. # ("Log out") keep theirs.
  154. # tracker.worldapi.org#4: a fixture show (tests/seed-show.hl,
  155. # written into the gate's own storage before the server starts)
  156. # proves /shows/:slug — header renders, no checks signed out;
  157. # signed in, click an episode check (turns solid), click a
  158. # season check (itself AND its episodes turn solid, proven
  159. # after a reload — server-side, not just client state).
  160. # tracker.worldapi.org#5: the same fixture (now followed by the
  161. # test user) proves /unwatched — signed out, no rows; signed in,
  162. # only the two already-released episodes show, newest first, the
  163. # far-future one excluded; click a check, the row disappears
  164. # (proven server-side after a reload).
  165. # tracker.worldapi.org#6: the same fixture proves /schedule —
  166. # signed out, no rows; signed in, only the far-future episode
  167. # shows (the two already-released ones excluded), no check icons
  168. # at all, unaffected by any watch toggle on the other pages.
  169. # tracker.worldapi.org#7: the fixture now has a 2nd followed
  170. # show (followed later, no poster name, never watched) and
  171. # proves /my/shows — signed out, the sign-in message; signed
  172. # in, newest follow first, title links, loaded posters (the
  173. # placeholder), S01E02 after /unwatched's click, then S02E01
  174. # (highest, not most recent) after the show-page checks; the
  175. # unwatched show shows no episode.
  176. # 45 checks. Own servers :8700 (this app) / :8701 (ident copy);
  177. # own storage .scratch/gate-store; Chrome on 8702-8709.
  178. # Other ports (workers get 8720-8739):
  179. # TRACKER_GATE_PORT=8720 TRACKER_GATE_IDENT_PORT=8721 TRACKER_GATE_CHROME=8722-8726 node tests/browser.mjs
  180. ps -eo pid,args | grep [h]l-browser-tier # must print nothing afterwards
  181. ```
  182. ## Deploy (Byrodin)
  183. Target: `/CONTAINERS/projects/tracker.worldapi.org` on Byrodin, container
  184. `tracker.worldapi.org` (`docker-compose.yml`: debian:12-slim, host network,
  185. `HL_HOST=127.0.0.1`, `TRACKER_PORT=45008`, `TRACKER_WATCH=0`, the folder mounted at
  186. `/home/tracker`, `./bin/hybriel project.hl`), public https://tracker.worldapi.org/ via
  187. nginx (TLS ends there; no baseUrl/tls in the app, like ident/notes).
  188. * **First deploy: done by the architect** (folder, nginx vhost with WebSocket Upgrade
  189. headers, cert, DNS, **and registering this app in the live ident** — `/apps` → name +
  190. origin `https://tracker.worldapi.org` → the API key + secret go into `.env` next to
  191. `docker-compose.yml`, `TRACKER_KEY=… TRACKER_SECRET=…`).
  192. * **Later: `./deploy.sh`** on Loreana, in this folder: runs the gate (refuses on a failure;
  193. `--skip-tests` skips it LOUDLY), rsyncs the code to
  194. `[email protected]:/CONTAINERS/projects/tracker.worldapi.org` (never `storage/`,
  195. `.sessions/`, `.env`, `.scratch/`, `server.*`, logs — the preview is checked for them; no
  196. `--delete`), `docker compose up -d && docker compose restart` over `ssh -F /dev/null`,
  197. then waits for https://tracker.worldapi.org/ to answer 200.
  198. * `./deploy.sh --dry-run` = the gate + `rsync -n` + the commands it would run (no restart, no
  199. URL check). `--target DIR|HOST:DIR` and `--url URL` point it elsewhere (tested against a
  200. local directory, see STATUS.md).
  201. ## Data
  202. `storage/mpackdb/`: `users.db` (`identity` → this app's own user id, `users.hl`) plus, since
  203. step 2, the old tracker's data — `genres.db` (27), `persons.db` (15157), `shows.db` (9453),
  204. `seasons.db` (6430), `episodes.db` (231584), `follows.db` (128), `watches.db` (11692), all with
  205. fresh mpackdb ids and every reference re-pointed (`tools/migrate.hl`); the one old user is this
  206. app's user for ident short id `az5b2`. Counts and the referential-integrity proof:
  207. `STATUS.md` "ticket #2". Nothing of this is shown in the UI yet.
  208. ## Files
  209. | File | |
  210. |---|---|
  211. | `CONCEPT.md` | the creator's concept — do not edit |
  212. | `project.hl` | manifest: routes (`/login/callback`, `/login/failed`, `/login.js`, `/posters/:name`, `/shows/:slug`, `/unwatched`, `/schedule`, `/my/shows`, `/` component Home), the app's own session cookie |
  213. | `users.hl` | the ident exchange + the `usersTable`, copied from calendar.worldapi.org's `users.hl` |
  214. | `login.js` | bridge between `<ident-selector>`'s `ident-login` event and the shell, copied verbatim from calendar.worldapi.org |
  215. | `components/home.hl` | `/`: the empty homepage — no content, signed in or out |
  216. | `components/main.hl` | the shell (header: brand, `<ident-selector>`, log in / log out) |
  217. | `components/loginfailed.hl` | `/login/failed`: why a login didn't work |
  218. | `components/show.hl` | `/shows/:slug`: the show page (header, seasons, episodes, watch check) |
  219. | `components/unwatched.hl` | `/unwatched`: unwatched, already-released episodes of followed shows, newest first |
  220. | `components/schedule.hl` | `/schedule`: not-yet-released episodes of followed shows, soonest first, no checks |
  221. | `components/myshows.hl` | `/my/shows`: followed shows, newest follow first — small poster, title, last watched `SxxEyy` |
  222. | `shows.hl` | read-only data access (shows/seasons/episodes/genres/persons), reused by `/unwatched`/`/schedule`/`/my/shows` |
  223. | `follows.hl` | read-only per-user follow data (`followsOfUser`, `followedShowIds`), reused by `/unwatched`/`/schedule`/`/my/shows` |
  224. | `watches.hl` | per-user watch state (episode/season checks, the shared check-icon class `watchClassOf`), reused by `/unwatched`/`/schedule`/`/my/shows` |
  225. | `styles.hl` | all CSS (imports the tokens from `shared/tokens.hl`; accent green `#4ec9b0`) |
  226. | `shared/tokens.hl` | the WorldAPI tokens, vendored verbatim from `ident.worldapi.org/shared/tokens.hl` |
  227. | `tests/browser.mjs` | the gate (above) |
  228. | `tests/seed-show.hl` | writes the gate's fixture show (two seasons, three episodes) and, since ticket #5, a follow of it for the test user (#7: plus a 2nd, later-followed, never-watched show), before the server starts |
  229. | `tests/identkit.mjs` | starts a throwaway ident copy for the gate, copied from calendar.worldapi.org's `tests/` |
  230. | `tests/cdp.mjs`, `tests/ports.mjs` | the CDP browser driver, copied from `ident.worldapi.org/tests/` |
  231. | `docker-compose.yml`, `Dockerfile`, `deploy.sh` | Byrodin container; the deploy from Loreana (section "Deploy") |
  232. | `tools/migrate.hl` | one-off: old MongoDB export → `storage/mpackdb/` (step 2, idempotent, see `STATUS.md`) |
  233. | `tools/verify.hl` | one-off: proves the migrated data against a COPY of `storage/mpackdb/` (counts, zero dangling references, one show end to end) |
  234. | `tools/relink-episode-seasons.hl` | one-off: links episodes with no `season` (step 2 leftovers) by `(show, seasonNumber)` — not run against the live data yet, see "What it does (step 4)" |
  235. ## Vendored Hybriel
  236. `bin/hybriel` + `plugins/` copied verbatim from `ident.worldapi.org` (2026-09-27), sha256
  237. `9e5e95b33680eb68a016e9e48a76c9f92193fd2ffdbdf437c1aab1bda2731a0d` — hybriel master
  238. 837fe120 (ident's mission 036), the newest vendored+gated build available locally. No local
  239. patch. Re-vendor the same way: copy `bin/hybriel` + `plugins/` from a current worldapi app,
  240. run the gate.

Branches

Latest commits

  • 3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre
  • 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
  • 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
  • a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre
  • 05f407c5tracker: no border on any button except inverted ones (Log out, ident status and identities too); header brand weight 100mre
  • 17375427tracker#2: tools/migrate.hl + tools/verify.hl — old MongoDB data into mpackdb with new idsmre
  • 31aac936tracker#3: no border on the header and on filled buttons; inverted buttons keep theirsmre
  • 2ad9d29ctracker#1: login exactly like calendar (identity selector in the header, empty homepage)mre
  • 3691e176tracker#1: empty tracker with the ident login (state of 2026-09-27)mre