Files

24 lines
798 B
Go

package browser
// Keep Chromium's native fingerprint intact. The launch arguments already
// disable AutomationControlled; this only removes well-known automation
// globals and never patches input events or hardware properties.
// stealthTemplate 用于本次流程后续判断的stealthTemplate
const stealthTemplate = `
(() => {
try {
Object.defineProperty(Navigator.prototype, 'webdriver', {
configurable: true,
get: () => undefined,
});
} catch (_) {}
for (const key of [
'__playwright', '__pw_manual', '__PW_inspect', '__pw_original',
'webdriver', '__webdriver_script_fn', '__webdriver_evaluate',
'__webdriver_unwrapped', '__driver_evaluate'
]) {
try { delete window[key]; } catch (_) {}
}
})();
`