Files
bulubulu/docs/ARCHITECTURE.md
T

2.7 KiB

Architecture

The application has one Android app module and no backend service.

  • MainActivity renders Compose, collects lifecycle-aware state and coordinates overlay focus restoration.
  • AppViewModel owns feed pagination/cache, cancellable detail/playback requests, visible-screen QR polling and serialized account transitions.
  • AuthRepository uses the official web QR flow with an isolated in-memory attempt. Only a verified active attempt can atomically replace the durable account session.
  • BiliHttpClient validates official HTTPS API destinations, scopes cookies per network hop, bounds response sizes and propagates coroutine cancellation to OkHttp calls.
  • SessionStore encrypts cookies with an Android Keystore AES-GCM key and writes an atomic file in noBackupFilesDir.
  • ContentRepository retrieves official catalogue/details/playback responses; WbiSigner caches official signing material; pure ContentJson parsing separates format and entitlement checks from transport.
  • SearchRepository uses official category search and the shared first-party session; pure SearchJson parses highlights, content identifiers, rights badges and bounded pagination. SearchController owns draft/submitted queries, category, deduplicated pages and cancellable requests. A generation guard also rejects non-cooperative late responses after a new query, category, clear, close or logout. It keeps no durable history.
  • BulubuluHome, dialogs and TvAction own TV layout/focus. Home stays composed beneath overlays, with focus/clicks disabled while inactive.
  • SearchScreen uses the device IME and the existing card components. It stays composed beneath details/player and restores result focus independently of Home.
  • PlayerScreen creates and releases Media3 with the composable lifecycle, merges separate AVC/AAC tracks and handles D-pad/media keys. CDN requests never receive account cookies.
  • PlaybackQualitySwitcher owns manual quality changes and commits the selected label only when the replacement source is ready. It preserves position/play intent, rejects overlapping requests and attempts the original source once after failure. playbackMediaSource shares HTTP identity, backup CDN handling and track merging between initial playback and changes. QualityDialog scrolls to and focuses the current actual track; one ExoPlayer is retained throughout the screen lifecycle.

There is no analytics, self-update service, local media scanning or private server. Login credentials and signed playback URLs must never appear in application logs or raw error messages. Account entitlements and region/DRM restrictions remain server-controlled. Tests use fake sessions in isolated storage and do not require a real account.