Catalog collection reads gzipped search responses; admin lyrics jobs resume once their table exists
This commit is contained in:
@@ -87,7 +87,11 @@ export function registerCatalogRoutes(app, { resolveListener = async (c, name, f
|
||||
const discovery = c.req.method === 'GET' && !/^\/api\/admin\/(analytics|metadata|collections)(\/|$)/.test(path) && !path.startsWith('/api/catalog/') && path !== '/api/recommendations';
|
||||
try {
|
||||
if (discovery && c.res.headers.get('content-type')?.includes('application/json')) {
|
||||
const result = await c.res.clone().json();
|
||||
// /api/search answers gzipped; read the body decompressed.
|
||||
const res = c.res.clone();
|
||||
const result = res.headers.get('content-encoding') === 'gzip'
|
||||
? JSON.parse(new TextDecoder().decode(Bun.gunzipSync(new Uint8Array(await res.arrayBuffer()))))
|
||||
: await res.json();
|
||||
if (typeof result.data === 'string') { try { result.data = JSON.parse(result.data); } catch { /* invalid profile */ } }
|
||||
await ingest(extractCards(result), path.includes('search') ? 'search-cache' : path.includes('channel') ? 'channel' : path.includes('streams') ? 'streams' : 'playlist');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user