13 lines
1.0 KiB
JavaScript
13 lines
1.0 KiB
JavaScript
// Authorized target/catalog reads only; compare two independent adapters for restart identity.
|
|||
|
|
import { writeFile } from 'node:fs/promises';
|
||
|
|
import { liveClient } from './live_ma_preflight.mjs';
|
||
|
|
try {
|
||
|
|
const {client}=await liveClient();const target=await client.verifyTarget();const catalog=await client.catalog();
|
||
|
|
const restarted=await liveClient();const after=await restarted.client.catalog();
|
||
|
|
const ids=items=>items.map(c=>c.id).sort().join(',');
|
||
|
|
const report={checked_at:new Date().toISOString(),target,playlists:catalog.filter(c=>c.kind==='playlist').length,
|
||
|
|
radios:catalog.filter(c=>c.kind==='radio').length,sanitized:catalog.every(c=>Object.keys(c).sort().join(',')==='id,kind,name,provider'),
|
||
|
|
independent_adapter_ids_match:ids(catalog)===ids(after)};
|
||
|
|
await writeFile('evidence/ma-adapter.json',JSON.stringify(report,null,2)+'\n');console.log(JSON.stringify(report,null,2));
|
||
|
|
if(!report.independent_adapter_ids_match)process.exitCode=1;
|
||
|
|
}catch{console.error('MA adapter verification failed (details withheld)');process.exitCode=1;}
|