3.7 KiB
3.7 KiB
Architecture
The application has one Android app module and no backend service.
MainActivityrenders Compose, collects lifecycle-aware state and coordinates overlay focus restoration.AppViewModelowns feed pagination/cache, cancellable detail/playback requests, visible-screen QR polling and serialized account transitions.AuthRepositoryuses the official web QR flow with an isolated in-memory attempt. Only a verified active attempt can atomically replace the durable account session.BiliHttpClientvalidates official HTTPS API destinations, scopes cookies per network hop, bounds response sizes and propagates coroutine cancellation to OkHttp calls.SessionStoreencrypts cookies with an Android Keystore AES-GCM key and writes an atomic file innoBackupFilesDir.ContentRepositoryretrieves official catalogue/details/playback responses;WbiSignercaches official signing material; pureContentJsonparsing separates format and entitlement checks from transport.SearchRepositoryuses official category search and the shared first-party session; pureSearchJsonparses highlights, content identifiers, rights badges and bounded pagination.SearchControllerowns 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.FavoriteRepositoryreads official account folders, archive memberships and paginated resources, and submits explicit membership diffs. Account-bound requests capture a cookie epoch, require matching UID/SESSDATA and API-scoped CSRF for writes, and disable redirects and connection retries.FavoriteJsonvalidates membership completeness and filters invalid or unsupported resources.FavoriteLibraryControllerowns the selected folder and deduplicated pagination.FavoriteActionControllerseparates the player's draft selections from confirmed server membership; only Save writes. Both cancel and reject late results after account/folder/video changes. Uncertain writes require an authoritative reload before retry. Logout clears the library; it has no durable cache.BulubuluHome, dialogs andTvActionown TV layout/focus. Home stays composed beneath overlays, with focus/clicks disabled while inactive.SearchScreenuses the device IME and the existing card components. It stays composed beneath details/player and restores result focus independently of Home.PlayerScreencreates and releases Media3 with the composable lifecycle, merges separate AVC/AAC tracks and handles D-pad/media keys. CDN requests never receive account cookies.PlaybackQualitySwitcherowns 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.playbackMediaSourceshares HTTP identity, backup CDN handling and track merging between initial playback and changes.QualityDialogscrolls to and focuses the current actual track; one ExoPlayer is retained throughout the screen lifecycle.FavoriteDialogprovides multiple folder choices and explicit Save/Close actions.PlayerScreenrestores its favorite action after the dialog regains the parent window's focus; opening or saving favorites does not recreate the player or media source.
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.