appstore: consume the F-Droid repos from static.maproj.org
- Commit
20ffa6dd0377e1231ef08dfc7caf2969bf21562d- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-25 23:53 UTC (10 days ago)
- Parents
9745831
MODERN_APPS and PROPRIETARY repo URLs now point at static.maproj.org (legacy origin URLs kept as named constants). ensureDefaultRepos explicitly deletes rows/records keyed by either legacy origin URL so the next sync cleanly re-imports under the static URLs — no double-added repos and no stale origin APK/icon URLs. Verified: :appstore:testDevUnitTest green (AppModelsTest covers the static URLs and legacy constants; CatalogSyncPruneTest proves legacy-keyed state is pruned to exactly the current repos). :appstore:lint errors are from other agents' in-flight detectors on untouched files.
Diff
appstore/AGENTS.md
diff --git a/appstore/AGENTS.md b/appstore/AGENTS.mdindex d976048b25..ada007bcf0 100644--- a/appstore/AGENTS.md+++ b/appstore/AGENTS.md@@ -17,6 +17,7 @@ _Install: ./install appstore (dev by default)._ - Install pipeline: `InstallCoordinator` → `SessionInstaller` → `InstallStatusReceiver`, verified by `InstallVerifier` (APK certs, signed-jar index, source stamps) before the system installer sees anything - `UpdateCheckWorker` background checks; outdated-target-API apps refused, not hidden **Architecture / data-flow:** `ui/` home/search/detail/library/updates/sources/trust → `util/AppStoreViewModel` (+ per-area `*Ops`, `AppStoreUiContract`) → `data/` providers per source (`*Repository`, Play/F-Droid/Accrescent clients) + `data/installer/` + `data/security/`; `domain/SearchRanking` is pure ranking.+**Repo addresses:** our own F-Droid-format repos are consumed from the static R2 bucket — `DefaultRepos.MODERN_APPS` = `https://static.maproj.org/fdroid/repo`, `DefaultRepos.PROPRIETARY` = `https://static.maproj.org/proprietary/repo` (same signed indexes/APKs the server publishes on every build; signing fingerprint pinned as before). The legacy origin addresses (`maproj.org/fdroid/repo`, `maproj.org/proprietary/repo`) keep serving external F-Droid clients and are named only as `LEGACY_*_ORIGIN_URL` constants: stored repo records and cached rows are keyed by URL, so `CatalogRepository.ensureDefaultRepos` prunes rows written under the old addresses and the next sync re-imports under the static ones (no double-added repos). **Entry points + reading order:** `MainActivity.kt` → `ui/HomePage.kt` → `util/AppStoreViewModel.kt` → `data/CatalogRepository.kt` → `data/installer/InstallCoordinator.kt` → `data/security/InstallVerifier.kt`. **Gotchas:** - `util/` is NOT a closed package root — don't add more files there
appstore/src/main/java/com/vayunmathur/appstore/data/AppModels.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/AppModels.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/AppModels.ktindex e8cd73687c..28d4488b3b 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/AppModels.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/AppModels.kt@@ -254,7 +254,7 @@ object DefaultRepos { ) val MODERN_APPS = RepoDescriptor(- url = "https://maproj.org/fdroid/repo",+ url = "https://static.maproj.org/fdroid/repo", displayName = "Modern Apps", pinnedFingerprint = "176fcb2525573e5be8e1cb3a496dd97b137e81ca5b887a1d32cb894b4e5717b4",@@ -263,7 +263,7 @@ object DefaultRepos { ) val PROPRIETARY = RepoDescriptor(- url = "https://maproj.org/proprietary/repo",+ url = "https://static.maproj.org/proprietary/repo", displayName = "Proprietary", pinnedFingerprint = "176fcb2525573e5be8e1cb3a496dd97b137e81ca5b887a1d32cb894b4e5717b4",@@ -284,6 +284,20 @@ object DefaultRepos { /** Cache key written by the retired GitHub releases provider. */ const val LEGACY_MODERN_APPS_REPO_KEY = "https://github.com/vayun-mathur/Modern-Apps"++ /**+ * Origin repo URLs used before the repos' canonical home moved to the+ * static R2 bucket. The server keeps serving identical signed bytes at+ * these addresses for external F-Droid clients; this store keys its+ * repo records and cached rows by URL, so rows written under an old+ * address are pruned and re-imported under the new one (see+ * [CatalogRepository.ensureDefaultRepos]). The signed indexes still+ * name the legacy address as the repo address — this client pins the+ * signing fingerprint and does not key trust on that field, so the+ * same signed index validates from the new location.+ */+ const val LEGACY_MODERN_APPS_ORIGIN_URL = "https://maproj.org/fdroid/repo"+ const val LEGACY_PROPRIETARY_ORIGIN_URL = "https://maproj.org/proprietary/repo" } /** The Modern-Apps monorepo's project page. */
appstore/src/main/java/com/vayunmathur/appstore/data/CatalogRepository.kt
diff --git a/appstore/src/main/java/com/vayunmathur/appstore/data/CatalogRepository.kt b/appstore/src/main/java/com/vayunmathur/appstore/data/CatalogRepository.ktindex ed0c08600c..32d4bba1e5 100644--- a/appstore/src/main/java/com/vayunmathur/appstore/data/CatalogRepository.kt+++ b/appstore/src/main/java/com/vayunmathur/appstore/data/CatalogRepository.kt@@ -305,6 +305,19 @@ class CatalogRepository( // The retired GitHub provider never inserted a RepoEntity, so pruning rows cannot // discover its pseudo-key. This cleanup is cheap, idempotent, and safe to retain. db.cachedAppDao().deleteByRepo(DefaultRepos.LEGACY_MODERN_APPS_REPO_KEY)++ // Repo-URL migration: rows are keyed by repo URL, so anything cached+ // under the pre-static origin addresses (including the absolute APK /+ // icon URLs inside cached rows) must go before the next sync imports+ // the same repos under their static addresses — otherwise the store+ // would double-add the repos and keep serving stale origin URLs.+ // The generic prune above already drops their RepoEntity rows; these+ // deletes make the intent explicit and cover rows whose RepoEntity+ // was already pruned by an earlier build.+ db.cachedAppDao().deleteByRepo(DefaultRepos.LEGACY_MODERN_APPS_ORIGIN_URL)+ db.cachedAppDao().deleteByRepo(DefaultRepos.LEGACY_PROPRIETARY_ORIGIN_URL)+ db.repoDao().deleteByUrl(DefaultRepos.LEGACY_MODERN_APPS_ORIGIN_URL)+ db.repoDao().deleteByUrl(DefaultRepos.LEGACY_PROPRIETARY_ORIGIN_URL) } private companion object {
appstore/src/test/java/com/vayunmathur/appstore/data/AppModelsTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/data/AppModelsTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/data/AppModelsTest.ktindex 1ea5d177b0..4d3ccf0f66 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/data/AppModelsTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/data/AppModelsTest.kt@@ -123,8 +123,20 @@ class AppModelsTest { } @Test- fun `only fdroid advertises a reproducibility feed`() {- assertTrue(DefaultRepos.FDROID.supportsReproducibilityFeed)+ fun `own repos are served from the static bucket, legacy origins kept for migration`() {+ assertEquals("https://static.maproj.org/fdroid/repo", DefaultRepos.MODERN_APPS.url)+ assertEquals("https://static.maproj.org/proprietary/repo", DefaultRepos.PROPRIETARY.url)+ // The pre-static addresses stay named so stored state keyed by them+ // can be pruned; neither is a current repo any more.+ assertEquals("https://maproj.org/fdroid/repo", DefaultRepos.LEGACY_MODERN_APPS_ORIGIN_URL)+ assertEquals("https://maproj.org/proprietary/repo", DefaultRepos.LEGACY_PROPRIETARY_ORIGIN_URL)+ val urls = DefaultRepos.ALL.mapTo(mutableSetOf()) { it.url }+ assertTrue(DefaultRepos.LEGACY_MODERN_APPS_ORIGIN_URL !in urls)+ assertTrue(DefaultRepos.LEGACY_PROPRIETARY_ORIGIN_URL !in urls)+ }++ @Test+ fun `only fdroid advertises a reproducibility feed`() { assertTrue(DefaultRepos.FDROID.supportsReproducibilityFeed) assertFalse(DefaultRepos.MODERN_APPS.supportsReproducibilityFeed) assertFalse(DefaultRepos.PROPRIETARY.supportsReproducibilityFeed) assertFalse(DefaultRepos.IZZY.supportsReproducibilityFeed)
appstore/src/test/java/com/vayunmathur/appstore/data/CatalogSyncPruneTest.kt
diff --git a/appstore/src/test/java/com/vayunmathur/appstore/data/CatalogSyncPruneTest.kt b/appstore/src/test/java/com/vayunmathur/appstore/data/CatalogSyncPruneTest.ktindex a4bab33c2d..41f59b3b69 100644--- a/appstore/src/test/java/com/vayunmathur/appstore/data/CatalogSyncPruneTest.kt+++ b/appstore/src/test/java/com/vayunmathur/appstore/data/CatalogSyncPruneTest.kt@@ -85,6 +85,35 @@ class CatalogSyncPruneTest { scope.cancel() } + @Test+ fun `sync migrates rows keyed by the legacy origin repo urls to the static urls`() = runTest {+ // State written by a build that addressed the repos at maproj.org:+ // repo records plus cached rows (their APK/icon URLs hang off the+ // old base too). The switch must not double-add or keep stale rows.+ for ((legacy, source) in listOf(+ DefaultRepos.LEGACY_MODERN_APPS_ORIGIN_URL to AppSource.MODERN_APPS,+ DefaultRepos.LEGACY_PROPRIETARY_ORIGIN_URL to AppSource.PROPRIETARY,+ )) {+ db.repoDao().upsert(RepoEntity(url = legacy, name = "Old $source"))+ db.cachedAppDao().upsert(+ UnifiedApp(+ packageName = "com.example.${source.name.lowercase()}",+ source = source,+ name = "Old $source app",+ repoUrl = legacy,+ apkUrl = "$legacy/com.example.apk",+ ).toEntity(),+ )+ }++ catalog.sync(emptySet())++ val repos = db.repoDao().all()+ assertEquals(DefaultRepos.ALL.mapTo(mutableSetOf()) { it.url }, repos.mapTo(mutableSetOf()) { it.url })+ assertTrue(db.cachedAppDao().all().isEmpty(), "rows keyed by legacy repo URLs survived")+ scope.cancel()+ }+ @Test fun `sync with every source enabled reports each in progress order`() = runTest { val steps = mutableListOf<SyncStep>()