mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-06 23:12:22 +02:00
14 lines
539 B
JavaScript
14 lines
539 B
JavaScript
// Runs inside a browser via Playwright evaluate; parsing does not execute code.
|
|
function extractThemeBootstrap(html) {
|
|
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
const matches = Array.from(doc.querySelectorAll('script:not([src])'))
|
|
.map(script => script.textContent)
|
|
.filter(code => code.includes('Apply font early'));
|
|
if (matches.length !== 1) {
|
|
throw new Error(`Expected one early theme bootstrap, found ${matches.length}`);
|
|
}
|
|
return matches[0];
|
|
}
|
|
|
|
module.exports = { extractThemeBootstrap };
|