From 54a25f669f861ddf9057a765af27594c3759de93 Mon Sep 17 00:00:00 2001 From: Gavyn Caldwell Date: Sat, 4 Jul 2026 21:13:00 -0600 Subject: [PATCH] handle new Obtainium repo layout for community configs The upstream apps.obtainium.imranr.dev repo moved app configs from data/apps/*.json to public/data/apps/{simple,complex}/*.json, which made the parser silently return 0 configs. Resolve the apps dir from both candidate locations and read JSON files recursively. Claude-Session: https://claude.ai/code/session_019KKBeXoo8rQv8oRiA6GJnv --- db/seed/parsers/obtainium.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/db/seed/parsers/obtainium.ts b/db/seed/parsers/obtainium.ts index a060ef9..75e2231 100644 --- a/db/seed/parsers/obtainium.ts +++ b/db/seed/parsers/obtainium.ts @@ -65,14 +65,21 @@ function resolveSourceType(url: string): SourceType { } export function parseObtainiumConfigs(cacheDir: string): ParsedApp[] { - const appsDir = path.join(cacheDir, "data", "apps"); - if (!fs.existsSync(appsDir)) { - console.warn(`Obtainium apps directory not found: ${appsDir}`); + // The upstream repo moved configs from data/apps/*.json to + // public/data/apps/{simple,complex}/*.json — support both layouts. + const appsDir = [ + path.join(cacheDir, "public", "data", "apps"), + path.join(cacheDir, "data", "apps"), + ].find((dir) => fs.existsSync(dir)); + if (!appsDir) { + console.warn(`Obtainium apps directory not found under: ${cacheDir}`); return []; } const apps: ParsedApp[] = []; - const files = fs.readdirSync(appsDir).filter((f) => f.endsWith(".json")); + const files = fs + .readdirSync(appsDir, { recursive: true, encoding: "utf-8" }) + .filter((f) => f.endsWith(".json")); for (const file of files) { try { @@ -110,7 +117,7 @@ export function parseObtainiumConfigs(cacheDir: string): ParsedApp[] { apps.push({ packageName: primary.id, - name: primary.name || settings?.appName || file.replace(".json", ""), + name: primary.name || settings?.appName || path.basename(file, ".json"), description: config.description?.en || config.description?.["en-US"] ||