eoka 0.6.0

Stealth browser automation for Rust. Puppeteer/Playwright alternative with anti-bot bypass.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

if (document.fonts && document.fonts.check) {
    const origCheck = document.fonts.check.bind(document.fonts);
    const claimedFonts = new Set(__EOKA_FONTS__.map(f => f.toLowerCase()));
    const genericFonts = new Set(__EOKA_GENERIC_FONTS__);
    const familyAllowed = (family) =>
        claimedFonts.has(family.toLowerCase()) || genericFonts.has(family.toLowerCase());

    document.fonts.check = _eoka_mark(function check(font, text) {
        if (typeof font !== 'string' || font === '') return origCheck(font, text);
        const sizeMatch = font.match(/(?:\d+(?:\.\d+)?(?:px|pt|em|rem|ex|ch|vh|vw|%)|[xx]-?small|medium|[xx]-?large)\s*(.*)$/i);
        const familyList = sizeMatch ? sizeMatch[1] : font;
        if (!familyList.trim()) return origCheck(font, text);
        const families = familyList.split(',').map(f => f.trim().replace(/^['"]|['"]$/g, ''));
        if (!families.length || families.some(f => !f)) return origCheck(font, text);
        return families.every(familyAllowed);
    }, 'check');
}