@@ -8,6 +8,7 @@ import * as schema from "../schema";
88import { appSources , apps , proprietaryApps , tags } from "../schema" ;
99import { alternativeMappings } from "./data/alternatives" ;
1010import { appOverrides } from "./data/app-overrides" ;
11+ import { thirdPartyFdroidRepos } from "./data/fdroid-repos" ;
1112import { proprietaryApps as proprietaryAppSeeds } from "./data/proprietary-apps" ;
1213import { fdroidAntiFeatureMap , fdroidCategoryMap , tagSeeds } from "./data/tags" ;
1314import { webApps as webAppSeeds } from "./data/web-apps" ;
@@ -31,6 +32,7 @@ const db = drizzle(client, { schema });
3132const stats = {
3233 fdroidParsed : 0 ,
3334 izzyParsed : 0 ,
35+ thirdPartyParsed : 0 ,
3436 obtainiumParsed : 0 ,
3537 uniqueApps : 0 ,
3638 mergedSources : 0 ,
@@ -69,6 +71,20 @@ function parseAllSources(): ParsedApp[] {
6971 console . warn ( "IzzyOnDroid index not found — run seed:fetch first" ) ;
7072 }
7173
74+ for ( const repo of thirdPartyFdroidRepos ) {
75+ const repoPath = path . join ( CACHE_DIR , repo . cacheFile ) ;
76+ if ( ! fs . existsSync ( repoPath ) ) {
77+ console . warn ( `${ repo . name } index not found — run seed:fetch first` ) ;
78+ continue ;
79+ }
80+ console . log ( `Parsing ${ repo . name } repo index...` ) ;
81+ const repoIndex = JSON . parse ( fs . readFileSync ( repoPath , "utf-8" ) ) ;
82+ const repoApps = parseFDroidIndex ( repoIndex , repo ) ;
83+ stats . thirdPartyParsed += repoApps . length ;
84+ console . log ( ` ${ repoApps . length } apps parsed` ) ;
85+ allApps . push ( ...repoApps ) ;
86+ }
87+
7288 const obtainiumDir = path . join ( CACHE_DIR , "obtainium" ) ;
7389 if ( fs . existsSync ( obtainiumDir ) ) {
7490 console . log ( "Parsing Obtainium configs..." ) ;
@@ -142,7 +158,14 @@ async function upsertApps(dedupedApps: ParsedApp[]) {
142158 license = COALESCE(excluded.license, apps.license),
143159 website_url = COALESCE(excluded.website_url, apps.website_url),
144160 repository_url = COALESCE(excluded.repository_url, apps.repository_url),
145- updated_at = excluded.updated_at` ,
161+ updated_at = CASE WHEN
162+ apps.name IS NOT excluded.name
163+ OR COALESCE(excluded.description, apps.description) IS NOT apps.description
164+ OR COALESCE(excluded.icon_url, apps.icon_url) IS NOT apps.icon_url
165+ OR COALESCE(excluded.license, apps.license) IS NOT apps.license
166+ OR COALESCE(excluded.website_url, apps.website_url) IS NOT apps.website_url
167+ OR COALESCE(excluded.repository_url, apps.repository_url) IS NOT apps.repository_url
168+ THEN excluded.updated_at ELSE apps.updated_at END` ,
146169 args : [
147170 appId ,
148171 parsed . name ,
@@ -306,7 +329,14 @@ async function upsertProprietaryApps() {
306329 ON CONFLICT (slug) DO UPDATE SET
307330 name = excluded.name, description = excluded.description,
308331 icon_url = excluded.icon_url, website_url = excluded.website_url,
309- package_name = excluded.package_name, updated_at = excluded.updated_at` ,
332+ package_name = excluded.package_name,
333+ updated_at = CASE WHEN
334+ proprietary_apps.name IS NOT excluded.name
335+ OR proprietary_apps.description IS NOT excluded.description
336+ OR proprietary_apps.icon_url IS NOT excluded.icon_url
337+ OR proprietary_apps.website_url IS NOT excluded.website_url
338+ OR proprietary_apps.package_name IS NOT excluded.package_name
339+ THEN excluded.updated_at ELSE proprietary_apps.updated_at END` ,
310340 args : [
311341 propId ,
312342 seed . name ,
@@ -368,7 +398,12 @@ async function upsertWebApps() {
368398 description = COALESCE(excluded.description, apps.description),
369399 website_url = COALESCE(excluded.website_url, apps.website_url),
370400 repository_url = COALESCE(excluded.repository_url, apps.repository_url),
371- updated_at = excluded.updated_at` ,
401+ updated_at = CASE WHEN
402+ apps.name IS NOT excluded.name
403+ OR COALESCE(excluded.description, apps.description) IS NOT apps.description
404+ OR COALESCE(excluded.website_url, apps.website_url) IS NOT apps.website_url
405+ OR COALESCE(excluded.repository_url, apps.repository_url) IS NOT apps.repository_url
406+ THEN excluded.updated_at ELSE apps.updated_at END` ,
372407 args : [
373408 generateId ( ) ,
374409 seed . name ,
@@ -505,7 +540,7 @@ async function main() {
505540 console . log ( `\n${ "═" . repeat ( 50 ) } ` ) ;
506541 console . log ( "Import complete:" ) ;
507542 console . log (
508- ` Parsed: ${ stats . fdroidParsed } F-Droid | ${ stats . izzyParsed } Izzy | ${ stats . obtainiumParsed } Obtainium` ,
543+ ` Parsed: ${ stats . fdroidParsed } F-Droid | ${ stats . izzyParsed } Izzy | ${ stats . thirdPartyParsed } third-party repos | ${ stats . obtainiumParsed } Obtainium` ,
509544 ) ;
510545 console . log (
511546 ` Deduped: ${ stats . uniqueApps } unique (${ stats . mergedSources } merged)` ,
0 commit comments