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

Modern-Apps.git / web / AGENTS.md

AGENTS.md5.3 KiBRenderedCodeRaw
1# AGENTS.md — web/ (':web')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `web/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install web (dev by default)._
6<!-- last-reviewed: 2026-10-16 -->
7- Gradle: :web / dir: web/
8- Package roots present: ui, data, domain, platform
9- Entry files: MainActivity.kt, Route.kt, Navigation.kt
10- Deps: :library:room, :library:image, :library:network
11- Metadata: metadata_data/web.md (present)
12- Rust: yes / screenshotTest: yes
13
14## Overview
15**Purpose:** Privacy browser — WebView with bundled-filter Shields (ad/tracker blocking), fingerprint randomization, per-site controls, PWA install, private tabs. User-host browsing pins `TrustBundle.SYSTEM` (deliberate exception to the narrowest-bundle rule).
16**Key features:**
17- Shields engine (`platform/shields/`: request filter, WebView clients, JS injection, service-worker client) over the Rust core (`shields/ShieldsNative`) with `domain/shields/` URL cleaning; per-site panel + fingerprint controls
18- Tabs with thumbnails, bookmarks/history/downloads, installed-site PWAs in a standalone `PwaActivity`, desktop-mode toggle
19- LAN safety policy (`domain/LanPolicy`, `LocalNetwork`) + per-site permissions/storage (`WebPermissions`, permission sheets)
20**Architecture / data-flow:** `ui/` chrome (omnibox, menu, tab switcher, panels) → `platform/WebViewModel` (+ split `Permissions`/`SiteData` helpers, `BrowserState`) → `data/WebRepository` over Room (bookmarks/history/tabs/favicons) + `platform/shields/ShieldsEngine` on the network path; `platform/ContentFilters` + `ThumbnailCapture` + `WindowLauncher` support.
21**Entry points + reading order:** `Route` → `MainActivity.kt` → `Navigation.kt` → `ui/BrowserPage.kt` → `platform/WebViewModel.kt` → `platform/shields/ShieldsEngine.kt` → `domain/shields/UrlCleaner.kt`.
22**Gotchas:**
23- `SYSTEM` trust bundle is intentional here (arbitrary user hosts) — do NOT "fix" it to a narrower bundle
24- Shields filtering runs on the request path — regressions break all browsing; test with Shields on AND off
25- PWA windows run outside the browser chrome (`PwaActivity` + `PwaHelper`); window-launch bugs live there, not in `BrowserPage`
26
27## Key files
28### Root — entry + navigation
29- com/vayunmathur/web/MainActivity.kt
30- com/vayunmathur/web/Navigation.kt
31- com/vayunmathur/web/Route.kt
32### data/ — Room (bookmarks/history/tabs/permissions)
33- com/vayunmathur/web/data/WebDatabase.kt
34- com/vayunmathur/web/data/WebRepository.kt
35- com/vayunmathur/web/data/Bookmark.kt
36- com/vayunmathur/web/data/HistoryEntry.kt
37- com/vayunmathur/web/data/InstalledSite.kt
38- com/vayunmathur/web/data/TabThumbnailStore.kt
39- com/vayunmathur/web/data/FaviconStore.kt
40- com/vayunmathur/web/data/ShieldSetting.kt
41- com/vayunmathur/web/data/SitePermission.kt
42### domain/ + domain/shields/ — pure LAN policy + shields rules (no Android)
43- com/vayunmathur/web/domain/LanPolicy.kt
44- com/vayunmathur/web/domain/LocalNetwork.kt
45- com/vayunmathur/web/domain/ShieldsSettings.kt
46- com/vayunmathur/web/domain/shields/UrlCleaner.kt
47- com/vayunmathur/web/domain/shields/ResourceTypes.kt
48### platform/ + platform/shields/ — ViewModel, PWA, permissions, engine
49- com/vayunmathur/web/platform/WebViewModel.kt
50- com/vayunmathur/web/platform/WebViewModelFactory.kt
51- com/vayunmathur/web/platform/WebViewModelPermissions.kt
52- com/vayunmathur/web/platform/WebViewModelSiteData.kt
53- com/vayunmathur/web/platform/BrowserState.kt
54- com/vayunmathur/web/platform/ContentFilters.kt
55- com/vayunmathur/web/platform/WebPermissions.kt
56- com/vayunmathur/web/platform/PermissionPrompt.kt
57- com/vayunmathur/web/platform/ExternalIntents.kt
58- com/vayunmathur/web/platform/PwaActivity.kt
59- com/vayunmathur/web/platform/PwaHelper.kt
60- com/vayunmathur/web/platform/WindowLauncher.kt
61- com/vayunmathur/web/platform/ThumbnailCapture.kt
62- com/vayunmathur/web/platform/shields/ShieldsEngine.kt
63- com/vayunmathur/web/platform/shields/ShieldsRequestFilter.kt
64- com/vayunmathur/web/platform/shields/ShieldsWebViewClient.kt
65- com/vayunmathur/web/platform/shields/ShieldsServiceWorkerClient.kt
66- com/vayunmathur/web/platform/shields/ShieldsInjection.kt
67- com/vayunmathur/web/platform/shields/InetHostResolver.kt
68### shields/ — Rust bridge
69- com/vayunmathur/web/shields/ShieldsNative.kt — JNI bridge into the filter core
70### ui/ + ui/components/ — chrome, tabs, panels, settings
71- com/vayunmathur/web/ui/BrowserPage.kt
72- com/vayunmathur/web/ui/BrowserChrome.kt
73- com/vayunmathur/web/ui/BrowserOmnibox.kt
74- com/vayunmathur/web/ui/BrowserOmniboxEditor.kt
75- com/vayunmathur/web/ui/BrowserMenu.kt
76- com/vayunmathur/web/ui/BrowserOverlays.kt
77- com/vayunmathur/web/ui/WebViewBrowser.kt
78- com/vayunmathur/web/ui/WebViewClients.kt
79- com/vayunmathur/web/ui/WebViewSettings.kt
80- com/vayunmathur/web/ui/TabSwitcher.kt
81- com/vayunmathur/web/ui/LinkContextMenu.kt
82- com/vayunmathur/web/ui/BookmarksPage.kt
83- com/vayunmathur/web/ui/HistoryPage.kt
84- com/vayunmathur/web/ui/DownloadsPage.kt
85- com/vayunmathur/web/ui/InstalledSitesPage.kt
86- com/vayunmathur/web/ui/PermissionSheets.kt
87- com/vayunmathur/web/ui/SettingsPage.kt
88- com/vayunmathur/web/ui/ShieldsPanel.kt
89- com/vayunmathur/web/ui/components/SiteIcon.kt
90- com/vayunmathur/web/ui/components/TabTile.kt
91
92## Verify (this module only)
93```
94./gradlew :web:compileDevKotlin
95./gradlew :web:lint
96./gradlew :web:checkMetadata
97```