2026-10-01 23:40:12 -04:00
const { chromium } = require ( 'playwright' ) ;
2026-10-06 09:41:27 -04:00
if ( ! process . env . DF _SESSION _COOKIE ) { console . error ( 'DF_SESSION_COOKIE env var not set — grab the dragonflight.sid cookie value from your browser devtools, export it, rerun.' ) ; process . exit ( 1 ) ; }
2026-10-01 23:40:12 -04:00
( async ( ) => {
const browser = await chromium . launch ( { headless : true } ) ;
const context = await browser . newContext ( { viewport : { width : 1920 , height : 1080 } } ) ;
await context . addCookies ( [ {
name : 'dragonflight.sid' ,
2026-10-06 09:41:27 -04:00
value : process . env . DF _SESSION _COOKIE ,
2026-10-01 23:40:12 -04:00
domain : 'mediacmdr.com' ,
path : '/' ,
httpOnly : true ,
secure : true
} ] ) ;
const page = await context . newPage ( ) ;
await page . goto ( 'https://mediacmdr.com/' , { waitUntil : 'networkidle' } ) ;
// Navigate to Library
await page . evaluate ( ( ) => {
const items = Array . from ( document . querySelectorAll ( '.nav-item' ) ) ;
const target = items . find ( i => i . innerText . trim ( ) . startsWith ( 'Library' ) ) ;
if ( target ) target . click ( ) ;
} ) ;
await page . waitForTimeout ( 4000 ) ;
// Check what's rendered in Library
const info = await page . evaluate ( ( ) => {
return {
text : document . body . innerText . slice ( 0 , 1500 ) ,
buttons : Array . from ( document . querySelectorAll ( 'button' ) ) . map ( b => b . innerText . trim ( ) ) . filter ( Boolean ) ,
cards : Array . from ( document . querySelectorAll ( '.card, .asset-card, .grid-item, tr' ) ) . map ( c => c . innerText . slice ( 0 , 100 ) ) ,
projectSelector : document . querySelector ( 'select' ) ? . outerHTML
} ;
} ) ;
console . log ( 'Library inspection:' , JSON . stringify ( info , null , 2 ) ) ;
// Check Applications page
await page . evaluate ( ( ) => {
const items = Array . from ( document . querySelectorAll ( '.nav-item' ) ) ;
const target = items . find ( i => i . innerText . trim ( ) . startsWith ( 'Applications' ) ) ;
if ( target ) target . click ( ) ;
} ) ;
await page . waitForTimeout ( 3000 ) ;
const appsInfo = await page . evaluate ( ( ) => {
return {
text : document . body . innerText . slice ( 0 , 2000 ) ,
links : Array . from ( document . querySelectorAll ( 'a, button' ) ) . map ( el => ( { text : el . innerText . trim ( ) , href : el . getAttribute ( 'href' ) , onclick : el . getAttribute ( 'onclick' ) } ) ) . filter ( e => e . text )
} ;
} ) ;
console . log ( '\nApplications inspection:' , JSON . stringify ( appsInfo , null , 2 ) ) ;
await browser . close ( ) ;
} ) ( ) ;