diff --git a/scripts/mirror.js b/scripts/mirror.js index 2541fd9..f217857 100644 --- a/scripts/mirror.js +++ b/scripts/mirror.js @@ -104,7 +104,8 @@ async function main() { const browser = await chromium.launch({ headless: true }); const ctx = await browser.newContext({ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', - viewport: { width: 1440, height: 900 }, + viewport: { width: 1600, height: 900 }, + deviceScaleFactor: 2, }); await ctx.addCookies([{ name: 'MoodleSession', @@ -115,71 +116,42 @@ async function main() { sameSite: 'None', }]); - const resources = new Map(); const page = await ctx.newPage(); - - page.on('response', async (resp) => { - const rurl = resp.url(); - if (!rurl.startsWith('http')) return; - try { - const buf = await resp.body(); - const ct = resp.headers()['content-type'] || ''; - if (buf && buf.length > 0) resources.set(rurl, { buf, ct }); - } catch (e) { /* redirect/204/etc */ } - }); - await page.goto(targetUrl, { waitUntil: 'networkidle', timeout: 90000 }); console.log(`[mirror] networkidle reached. extra settle…`); await page.waitForTimeout(4000); - // Re-inline all CSS into + +
+