Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / uniflix / AGENTS.md

AGENTS.md4.7 KiBRenderedCodeRaw
1# AGENTS.md — uniflix/ (':uniflix')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `uniflix/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install uniflix (dev by default)._
6<!-- last-reviewed: 2026-10-23 -->
7- Gradle: :uniflix / dir: uniflix/
8- Package roots present: ui, data, domain, platform
9- Entry files: MainActivity.kt, Route.kt, Navigation.kt
10- Deps: :library:network, :library:image, :library:room, media3 exoplayer/hls, datastore-preferences, quickjs-kt, chicory-runtime
11- Metadata: metadata_data/uniflix.md (present)
12- Rust: no / screenshotTest: no (previews pending)
13
14## Overview
15**Purpose:** TMDB catalog browser (trending/top-rated/search, watchlist, lists,
16resume) with playback supplied by user-installed Stremio-style URL addons. Ships
17with no provider and no secrets — with zero addons the app is catalog-only and
18Watch/Detail link to the addon manager.
19**Key features:**
20- Addon manager: add-by-URL, enable/disable, default star, priority ordering, per-addon settings, error badges
21- `StreamProvider` is the single player-facing contract; `PluginRegistry` resolves default-first then priority fallbacks
22- Pure-HTTP addon protocol subset: `manifest.json` + `GET {base}/stream/{type}/{id}.json` with `tmdb:` ids
23- Installable JS plugins (`.js` import): QuickJS runtime + generic host (`__ufetch` via NetworkClient, `__uwasm_*` via Chicory, `__uaesgcm_open`, `__urand`); sync-only contract, WASM travels inside the plugin file
24**Architecture / data-flow:** `ui/` (Home→Detail→Watch, AddonsScreen/AddonDetailScreen) → `platform/` (`DetailViewModel` resolves via `RegistryFactory.AllInstalled`, `AddonsViewModel` owns install/order toggles + `addJsPlugin`) -> (`data/` (`AddonStreamProvider` HTTP impl, `JsStreamProvider`/`JsPluginEngine` JS impl, `UniflixRepository` over Room v3 `AddonEntity` with `kind`/`jsSource`) with pure `domain/` (`AddonManifest` validation, `JsPluginManifest` parsing, `PluginRegistry` ordering). `Navigation`: TMDB-key onboarding gate (`reset()` not `add()`); `Addons` + `AddonDetail(dbId)` routes.
25**Entry points + reading order:** `Route` (`Onboarding` / `Home` / `Addons` / `Detail` / `Watch`) → `MainActivity.kt` → `Navigation.kt` → `platform/AddonsViewModel.kt` + `platform/DetailViewModel.kt` → `domain/PluginRegistry.kt` + `data/AddonStreamProvider.kt`.
26**Gotchas:**
27- Manifest `resources` accepts Stremio string-or-object forms; only `stream` for movie/series validates
28- URL addons enforce HTTPS except loopback/private (dev); remote `http://` is rejected as `InsecureUrl`
29- `UniflixDatabase` v1→v2 migration adds `AddonEntity`; v2→v3 adds `kind`/`jsSource`; default addon id lives in DataStore, ordering in Room priority
30- Private `personal/uniflix_strem/` keeps the native Strem provider + hardcoded TMDB key — never copy those into `uniflix/`
31
32## Key files
33### Root — entry + navigation
34- com/vayunmathur/uniflix/MainActivity.kt
35- com/vayunmathur/uniflix/Navigation.kt
36- com/vayunmathur/uniflix/Route.kt
37### domain/ — pure addon protocol + resolution order (no Android)
38- com/vayunmathur/uniflix/domain/StreamProvider.kt — player contract both plugin kinds implement
39- com/vayunmathur/uniflix/domain/PluginRegistry.kt — default-first, priority fallback ordering
40- com/vayunmathur/uniflix/domain/AddonManifest.kt — manifest parse + validate
41- com/vayunmathur/uniflix/domain/AddonModels.kt — tmdb: id mapping, stream→VideoSource
42- com/vayunmathur/uniflix/domain/JsPluginManifest.kt — JS plugin header + wasm section parse
43### data/ — HTTP provider, JS engine, Room, prefs
44- com/vayunmathur/uniflix/data/AddonStreamProvider.kt — URL addon as StreamProvider
45- com/vayunmathur/uniflix/data/JsPluginEngine.kt — QuickJS + Chicory host, sync-only contract
46- com/vayunmathur/uniflix/data/JsStreamProvider.kt — JS plugin as StreamProvider
47- com/vayunmathur/uniflix/data/AddonEntity.kt — installed-addon entity + DAO
48- com/vayunmathur/uniflix/data/UniflixDatabase.kt — Room v3 + Migration(1,2) + Migration(2,3)
49- com/vayunmathur/uniflix/data/UniflixRepository.kt — singleton incl. addon flows
50- com/vayunmathur/uniflix/data/AddonPrefs.kt — default addon id (DataStore)
51- com/vayunmathur/uniflix/data/TmdbKeyStore.kt — user key only, no default
52### platform/ — ViewModels
53- com/vayunmathur/uniflix/platform/DetailViewModel.kt — registry injection + RegistryFactory
54- com/vayunmathur/uniflix/platform/AddonsViewModel.kt — manager state
55### ui/ — catalog + manager
56- com/vayunmathur/uniflix/ui/AddonsScreen.kt — manager list
57- com/vayunmathur/uniflix/ui/AddonDetailScreen.kt — per-addon settings
58- com/vayunmathur/uniflix/ui/dialogs/AddAddonDialog.kt — add-by-URL
59
60## Verify (this module only)
61```
62./gradlew :uniflix:compileDevKotlin
63./gradlew :uniflix:lint
64./gradlew :uniflix:checkMetadata
65```