Yokan / rebuild
Course 1 8624561

TRACKERS_EXTENDED.md

docs/features/TRACKERS_EXTENDED.md

documentation / design asset92 lines
1# Extended trackers and enhanced server tracking23Animetail parity rows T1–T13 (stages 11 and 12). All adapters, sign-in flows, stored state and4synchronization are shared Kotlin (`services/tracking`), compiled for Android, iOS, desktop and web.5Every integration uses credentials the user enters; no client IDs, secrets or API keys are bundled.6Protocols follow the pinned Animetail adapters (commit `d0eab5d6`) and the providers' documentation;7they are tested at the HTTP boundary with Ktor `MockEngine` fixtures, not against live accounts.89## Providers1011| Provider | Sync id | Media | Sign-in | `id:` lookup | Remote unbind |12|---|---|---|---|---|---|13| MangaUpdates | 10 | manga/novel | username + password → session token (`PUT /v1/account/login`) | series id | list delete |14| Shikimori | 11 | anime, manga/novel | own OAuth app: client id/secret + authorization code → access/refresh token | numeric id | `DELETE user_rates/{id}` |15| Bangumi | 12 | anime, manga/novel | personal access token, or own OAuth app code exchange (refreshable) | subject id | none (API has no delete) |16| Hikka | 13 | anime, manga/novel | own client reference/secret + request reference → secret (`auth` header, expires) | slug | `DELETE /watch/{slug}` or `/read/{type}/{slug}` |17| MangaBaka | 14 | manga/novel | personal access token (`mb-…`, `x-api-key`) | series id | `DELETE /v1/my/library/{id}` |18| TMDB | 15 | anime-type entries (movies, TV) | own v3 API key → request token approved in browser → session | `id:N`, `id:tv/N`, `id:movie/N` | watchlist and rating removed |19| Komga | 20 | manga | server URL + API key (`X-API-Key`) or username/password (Basic) | server item id | — |20| Kavita | 21 | manga | server URL + API key → plugin JWT (re-authenticates once on 401) | series id | — |21| Suwayomi | 22 | manga | server URL + optional Basic credentials | manga id | — |22| Jellyfin | 23 | anime | server URL + username/password → access token (`AuthenticateByName`) | item id | — |2324Settings → Tracking lists every tracker (except the metadata server tracker). Trackers with their25own sign-in open a credentials dialog showing the provider's rejection message; the original26AniList/Kitsu/MAL/SIMKL/Trakt token dialog is unchanged. Manage trackers covers all signed-in27trackers. Local scores of the new trackers use 0–10 and are converted to each provider's scale28(MangaBaka 0–100, TMDB 0.5–10). Tracks, credentials (`DbTrackPreference.oauth` + JSON29`TrackerCredentials` in `prefs`) and the auto-bind preference go through the existing backup,30sync and library tracker filter/grouping/score paths keyed by sync id; credentials are only31exported with sensitive backups. The tracker library (ranking browse) keeps its Mangayomi providers.3233## Remote synchronization3435The repository stores every local change first, then notifies `TrackerAccounts`, which runs the36remote call in the profile scope (serialized, failures logged without touching local state):3738- **Bind** (detail tracking search result or `id:`): fetch the provider's list entry or create it39  (PlanToRead/PlanToWatch when nothing is read locally). An existing remote entry's status, progress40  and score are adopted.41- **Edit** (Manage trackers): progress, status and score are pushed; the provider's response is stored.42- **Reading**: with *Update progress after reading* on, marking chapters/episodes read pushes progress.43  Local progress never moves backwards on marking read.44- **Detail open**: bound remote trackers are refreshed. "Smart sync": the higher of local and remote45  progress wins and local progress the provider is behind on is pushed.46- **Unbind**: a dialog offers *Unbind locally* or *Also remove from service*.4748The original five adapters keep their local-only bind/update behavior; they gained `id:` lookup.4950## Enhanced (server) tracking — Komga, Kavita, Suwayomi, Jellyfin5152Animetail `EnhancedTracker` semantics (`accept(source)`, `match(entry)`, auto-bind, two-way sync):5354- `accept`: the source name contains the provider name (Suwayomi also *Tachidesk*), or the source's55  base/API URL host equals the configured server host. Yokan cannot read extension class names or56  extension credentials, so the server is entered in the tracker's own sign-in.57- `match`: the server item id is parsed from the title's source link (Mihon/Aniyomi and Mangayomi58  shapes: Komga `/api/v1/series|readlists/<id>`, Kavita `/Series/<id>` or `seriesId=`, Suwayomi59  `/manga/<id>`, Jellyfin `/Items/<id>` or `Id=`) and fetched from the configured server.60- Adding a title to the library binds every signed-in server tracker that accepts its source.61  The detail tracking search resolves the title's own entry instead of searching.62- Progress is a chapter/episode **number**: the last chapter of the continuous read run is pushed63  (Komga `read-progress/tachiyomi`, Kavita `mark-chapter-until-as-read`, Suwayomi chapter64  `markPrevRead`, Jellyfin `UserPlayedItems` for each episode up to it). Remote progress marks local65  chapters/episodes with numbers up to it read.6667## Automatic binding when adding to the library6869*Track when adding to library* (off by default, `features.tracking.autoBindOnAdd`): for every70signed-in tracker that supports the media type, the title's name is searched and bound only when71exactly one result has the same normalized title (letters/digits, case-insensitive). Ambiguous or72missing matches bind nothing. Server trackers always auto-bind as above.7374## Platform blockers7576- **OAuth redirects** use the existing `yokan://tracker/<provider>` path: Android delivers the77  callback into the dialog. Desktop, iOS and web have no `yokan://` dispatcher, so the user pastes the78  authorization code or the callback URL from the browser address bar (Shikimori, Bangumi OAuth,79  Hikka). TMDB needs no paste: approve in the browser, then Save.80- **Web (CORS, checked 2026-10-18 with preflight requests):** Shikimori (`shikimori.io`; `shikimori.one`81  redirects there), Bangumi API, MangaBaka API and TMDB allow any origin. Bangumi's OAuth token endpoint82  sends no CORS headers, so web users must use a personal access token. Hikka's API returns no83  `Access-Control-Allow-Origin` for other origins: Hikka cannot work in the browser. MangaUpdates84  answered 403 to every request from the verification host (edge filtering), so its browser CORS85  behavior is unverified. Self-hosted servers must enable CORS for the Yokan origin and allow the86  `Authorization`, `X-API-Key` or `X-Emby-*` headers; an HTTPS page cannot reach `http://` LAN servers.87  Browsers ignore the `User-Agent` header the adapters send.88- **Images**: Komga/Suwayomi/Jellyfin cover URLs need the server to serve images without auth;89  Kavita covers are omitted so the API key never lands in a stored URL.90- Suwayomi uses the REST v1 API (deprecated upstream in favor of GraphQL); servers in UI-login or91  cookie auth modes are not supported. Jellyfin uses the current `/Items/{id}?userId=` and92  `/UserPlayedItems/{id}` routes (10.9+).93

Search chapters, reference and source filenames.