camoucore 0.3.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -3
- package/dist/camoufox/__main__.d.ts +10 -0
- package/dist/camoufox/__main__.js +1175 -0
- package/dist/camoufox/__version__.d.ts +31 -0
- package/dist/camoufox/__version__.js +32 -0
- package/dist/camoufox/_humanize_playwright.d.ts +54 -0
- package/dist/camoufox/_humanize_playwright.js +429 -0
- package/dist/camoufox/addons.d.ts +21 -0
- package/dist/camoufox/addons.js +56 -0
- package/dist/camoufox/async_api.d.ts +9 -0
- package/dist/camoufox/async_api.js +9 -0
- package/dist/camoufox/browser-pin.d.ts +46 -0
- package/dist/camoufox/browser-pin.js +96 -0
- package/dist/camoufox/cli.d.ts +7 -0
- package/dist/camoufox/cli.js +20 -0
- package/dist/camoufox/coherence.d.ts +141 -0
- package/dist/camoufox/coherence.js +708 -0
- package/dist/camoufox/data-files/browser-pin.json +7 -0
- package/dist/camoufox/data-files/essential-fonts.json +5 -0
- package/dist/camoufox/data-files/fingerprint-presets-v150.json +14544 -0
- package/dist/camoufox/data-files/fingerprint-presets.json +5192 -0
- package/dist/camoufox/data-files/font-bases.json +1887 -0
- package/dist/camoufox/data-files/font-groups.json +716 -0
- package/dist/camoufox/data-files/fonts.json +240 -0
- package/dist/camoufox/data-files/fpgen.yml +44 -0
- package/dist/camoufox/data-files/launcher-constants.json +66 -0
- package/dist/camoufox/data-files/media-devices.json +148 -0
- package/dist/camoufox/data-files/repos.yml +40 -0
- package/dist/camoufox/data-files/voice-manifests.json +1864 -0
- package/dist/camoufox/data-files/voice-uris.json +188 -0
- package/dist/camoufox/data-files/warnings.yml +132 -0
- package/dist/camoufox/display_profile.d.ts +17 -0
- package/dist/camoufox/display_profile.js +72 -0
- package/dist/camoufox/driver_defaults.d.ts +25 -0
- package/dist/camoufox/driver_defaults.js +114 -0
- package/dist/camoufox/exceptions.d.ts +78 -0
- package/dist/camoufox/exceptions.js +135 -0
- package/dist/camoufox/fingerprints.d.ts +341 -0
- package/dist/camoufox/fingerprints.js +1682 -0
- package/dist/camoufox/gpudisplay.d.ts +158 -0
- package/dist/camoufox/gpudisplay.js +695 -0
- package/dist/camoufox/host_rendering.d.ts +38 -0
- package/dist/camoufox/host_rendering.js +180 -0
- package/dist/camoufox/humanize.d.ts +89 -0
- package/dist/camoufox/humanize.js +143 -0
- package/dist/camoufox/index.d.ts +21 -0
- package/dist/camoufox/index.js +21 -0
- package/dist/camoufox/ip.d.ts +45 -0
- package/dist/camoufox/ip.js +114 -0
- package/dist/camoufox/multiversion.d.ts +131 -0
- package/dist/camoufox/multiversion.js +489 -0
- package/dist/camoufox/node-floor.d.ts +5 -0
- package/dist/camoufox/node-floor.js +17 -0
- package/dist/camoufox/paths.d.ts +45 -0
- package/dist/camoufox/paths.js +59 -0
- package/dist/camoufox/pkgman.d.ts +331 -0
- package/dist/camoufox/pkgman.js +972 -0
- package/dist/camoufox/product.d.ts +8 -0
- package/dist/camoufox/product.js +8 -0
- package/dist/camoufox/pycompat.d.ts +97 -0
- package/dist/camoufox/pycompat.js +458 -0
- package/dist/camoufox/server.d.ts +36 -0
- package/dist/camoufox/server.js +82 -0
- package/dist/camoufox/sync_api.d.ts +77 -0
- package/dist/camoufox/sync_api.js +194 -0
- package/dist/camoufox/utils.d.ts +515 -0
- package/dist/camoufox/utils.js +1995 -0
- package/dist/camoufox/warnings.d.ts +16 -0
- package/dist/camoufox/warnings.js +65 -0
- package/dist/camoufox/webgl.d.ts +52 -0
- package/dist/camoufox/webgl.js +264 -0
- package/dist/camouwolf/__main__.d.ts +10 -0
- package/dist/camouwolf/__main__.js +1180 -0
- package/dist/camouwolf/__version__.d.ts +31 -0
- package/dist/camouwolf/__version__.js +32 -0
- package/dist/camouwolf/_humanize_playwright.d.ts +53 -0
- package/dist/camouwolf/_humanize_playwright.js +427 -0
- package/dist/camouwolf/addons.d.ts +42 -0
- package/dist/camouwolf/addons.js +113 -0
- package/dist/camouwolf/async_api.d.ts +9 -0
- package/dist/camouwolf/async_api.js +9 -0
- package/dist/camouwolf/browser-pin.d.ts +46 -0
- package/dist/camouwolf/browser-pin.js +96 -0
- package/dist/camouwolf/cli.d.ts +7 -0
- package/dist/camouwolf/cli.js +20 -0
- package/dist/camouwolf/clienthints.d.ts +61 -0
- package/dist/camouwolf/clienthints.js +176 -0
- package/dist/camouwolf/coherence.d.ts +152 -0
- package/dist/camouwolf/coherence.js +554 -0
- package/dist/camouwolf/data-files/browser-pin.json +7 -0
- package/dist/camouwolf/data-files/camouwolf.defaults.json +118 -0
- package/dist/camouwolf/data-files/data/bundle-fonts.json +1983 -0
- package/dist/camouwolf/data-files/data/chrome-languages.json +517 -0
- package/dist/camouwolf/data-files/data/properties.json +321 -0
- package/dist/camouwolf/data-files/data/system-colors.json +35 -0
- package/dist/camouwolf/data-files/data/ubo.json +6 -0
- package/dist/camouwolf/data-files/fpgen.yml +41 -0
- package/dist/camouwolf/data-files/launcher-constants.json +26 -0
- package/dist/camouwolf/data-files/repos.yml +23 -0
- package/dist/camouwolf/data-files/warnings.yml +96 -0
- package/dist/camouwolf/driver_defaults.d.ts +25 -0
- package/dist/camouwolf/driver_defaults.js +114 -0
- package/dist/camouwolf/exceptions.d.ts +95 -0
- package/dist/camouwolf/exceptions.js +150 -0
- package/dist/camouwolf/fingerprints.d.ts +227 -0
- package/dist/camouwolf/fingerprints.js +753 -0
- package/dist/camouwolf/gpudisplay.d.ts +171 -0
- package/dist/camouwolf/gpudisplay.js +711 -0
- package/dist/camouwolf/host_rendering.d.ts +18 -0
- package/dist/camouwolf/host_rendering.js +114 -0
- package/dist/camouwolf/humanize.d.ts +84 -0
- package/dist/camouwolf/humanize.js +128 -0
- package/dist/camouwolf/index.d.ts +22 -0
- package/dist/camouwolf/index.js +21 -0
- package/dist/camouwolf/multiversion.d.ts +131 -0
- package/dist/camouwolf/multiversion.js +491 -0
- package/dist/camouwolf/node-floor.d.ts +5 -0
- package/dist/camouwolf/node-floor.js +17 -0
- package/dist/camouwolf/paths.d.ts +34 -0
- package/dist/camouwolf/paths.js +58 -0
- package/dist/camouwolf/pkgman.d.ts +331 -0
- package/dist/camouwolf/pkgman.js +972 -0
- package/dist/camouwolf/product.d.ts +3 -0
- package/dist/camouwolf/product.js +3 -0
- package/dist/camouwolf/pycompat.d.ts +92 -0
- package/dist/camouwolf/pycompat.js +461 -0
- package/dist/camouwolf/server.d.ts +36 -0
- package/dist/camouwolf/server.js +81 -0
- package/dist/camouwolf/switches.d.ts +77 -0
- package/dist/camouwolf/switches.js +222 -0
- package/dist/camouwolf/sync_api.d.ts +84 -0
- package/dist/camouwolf/sync_api.js +173 -0
- package/dist/camouwolf/utils.d.ts +644 -0
- package/dist/camouwolf/utils.js +2057 -0
- package/dist/camouwolf/warnings.d.ts +14 -0
- package/dist/camouwolf/warnings.js +59 -0
- package/dist/camouwolf/webgl.d.ts +41 -0
- package/dist/camouwolf/webgl.js +198 -0
- package/dist/data.d.ts +1 -1
- package/dist/data.js +3 -3
- package/dist/download.js +1 -1
- package/dist/exceptions.d.ts +1 -1
- package/dist/exceptions.js +1 -1
- package/dist/geolocation.js +1 -1
- package/dist/host.js +1 -1
- package/dist/ip.js +1 -1
- package/dist/locales.js +1 -1
- package/dist/mcp/cli.d.ts +15 -0
- package/dist/mcp/cli.js +108 -0
- package/dist/mcp/index.d.ts +8 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/main.d.ts +2 -0
- package/dist/mcp/main.js +8 -0
- package/dist/mcp/secrets.d.ts +50 -0
- package/dist/mcp/secrets.js +193 -0
- package/dist/mcp/server.d.ts +48 -0
- package/dist/mcp/server.js +653 -0
- package/dist/mcp/tree.d.ts +10 -0
- package/dist/mcp/tree.js +36 -0
- package/dist/passthrough.d.ts +1 -1
- package/dist/product.js +1 -1
- package/dist/settings.js +1 -1
- package/dist/telemetry.d.ts +0 -1
- package/dist/telemetry.js +5 -4
- package/dist/virtdisplay.d.ts +1 -1
- package/dist/virtdisplay.js +1 -1
- package/dist/warnings.js +1 -1
- package/package.json +57 -13
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { hasDisplay, largestDisplay } from "../display.js";
|
|
2
|
+
import { getGeolocation } from "../geolocation.js";
|
|
3
|
+
import { type ProxyConfig, publicIP } from "../ip.js";
|
|
4
|
+
import { VirtualDisplay } from "../virtdisplay.js";
|
|
5
|
+
import { addDefaultAddons, confirmPaths, type DefaultAddon } from "./addons.js";
|
|
6
|
+
import { type DisplayProfileOption } from "./display_profile.js";
|
|
7
|
+
import { clampScreenToDisplay, clampWindowDimensions, clampWindowPosition, drawVoiceConfig, fixHardwareConcurrency, fixNavigatorArch, followBaselineProtection, fromFpgen, fromPreset, generateFingerprint, generateRandomFontSubset, generateRandomVoiceSubset, getRandomPreset, identitySalt, identitySeed, raiseScreenToModernFloor, Screen, setMediaDevicesDefaults } from "./fingerprints.js";
|
|
8
|
+
import { selectGpu } from "./gpudisplay.js";
|
|
9
|
+
import { type Gpu, hostGpu } from "./host_rendering.js";
|
|
10
|
+
import { type HumanizeSetting } from "./humanize.js";
|
|
11
|
+
import { publicIPv6 } from "./ip.js";
|
|
12
|
+
import { effectiveVersionMin, ensureBrowserProfileDir, ensureCamoufoxInstalled, getPath, launchPath, resolvedPlaywrightVersionStr, selectedLaunchPath } from "./pkgman.js";
|
|
13
|
+
type ListOrString = string | string[];
|
|
14
|
+
/** The value a persistent profile's prefs.js holds for `pref` (undefined when none). Mirrors Python's saved_pref. */
|
|
15
|
+
export declare function savedPref(profileDir: string | undefined, pref: string): unknown;
|
|
16
|
+
/** Write a toggle only when on, or to clear a persistent non-stock value. */
|
|
17
|
+
export declare function setTogglePref(prefs: Record<string, unknown>, pref: string, on: boolean, stock: unknown, toggled: unknown, profileDir: string | undefined): void;
|
|
18
|
+
export type TargetOS = "mac" | "win" | "lin";
|
|
19
|
+
type EnvVars = Record<string, string | number | boolean>;
|
|
20
|
+
/** The OS names Camoufox takes, by target_os key. */
|
|
21
|
+
declare const OS_NAMES: {
|
|
22
|
+
readonly win: "windows";
|
|
23
|
+
readonly mac: "macos";
|
|
24
|
+
readonly lin: "linux";
|
|
25
|
+
};
|
|
26
|
+
export type OsName = (typeof OS_NAMES)[TargetOS];
|
|
27
|
+
export declare const CACHE_PREFS: Record<string, any>;
|
|
28
|
+
export declare const PROXY_DOH_PREFS: Record<string, any>;
|
|
29
|
+
export declare const WINDOWS_BEHAVIOUR_PREFS: Record<string, any>;
|
|
30
|
+
/** The host OS in fonts.json / target_os terms ('mac', 'win', 'lin'). */
|
|
31
|
+
declare function hostOsKey(): TargetOS | null;
|
|
32
|
+
/** shutil.disk_usage(path).total */
|
|
33
|
+
declare function diskTotal(p: string): number;
|
|
34
|
+
/**
|
|
35
|
+
* Half the capacity of the disk a stock Firefox profile would live on, in KB.
|
|
36
|
+
*
|
|
37
|
+
* That is the number Gecko's own GetTemporaryStorageLimit() would compute on
|
|
38
|
+
* this machine, and it is what `dom.quotaManager.temporaryStorage.fixedLimit`
|
|
39
|
+
* takes. The disk a stock profile lives on, not the one Playwright's throwaway
|
|
40
|
+
* profile lands on: on a host whose temp directory is a tmpfs, that profile
|
|
41
|
+
* sits on a RAM-sized volume no real Firefox profile would.
|
|
42
|
+
*/
|
|
43
|
+
declare function stockProfileDiskCapacityKb(): number | null;
|
|
44
|
+
/**
|
|
45
|
+
* Injection points: everything launchOptions() reaches outside this module.
|
|
46
|
+
* Mirrors the names the Python tests monkeypatch on camoufox.utils.
|
|
47
|
+
*/
|
|
48
|
+
export declare const utilsDeps: {
|
|
49
|
+
osName: () => TargetOS;
|
|
50
|
+
installDir: () => string;
|
|
51
|
+
hostOsKey: typeof hostOsKey;
|
|
52
|
+
diskTotal: typeof diskTotal;
|
|
53
|
+
stockProfileDiskCapacityKb: typeof stockProfileDiskCapacityKb;
|
|
54
|
+
hasDisplay: typeof hasDisplay;
|
|
55
|
+
largestDisplay: typeof largestDisplay;
|
|
56
|
+
getScreenCons: (headless?: boolean) => Screen | null;
|
|
57
|
+
print: (line: string) => void;
|
|
58
|
+
ensureBrowserProfileDir: typeof ensureBrowserProfileDir;
|
|
59
|
+
ensureCamoufoxInstalled: typeof ensureCamoufoxInstalled;
|
|
60
|
+
addDefaultAddons: typeof addDefaultAddons;
|
|
61
|
+
confirmPaths: typeof confirmPaths;
|
|
62
|
+
installedVerStr: () => string;
|
|
63
|
+
effectiveVersionMin: typeof effectiveVersionMin;
|
|
64
|
+
resolvedPlaywrightVersionStr: typeof resolvedPlaywrightVersionStr;
|
|
65
|
+
getPath: typeof getPath;
|
|
66
|
+
launchPath: typeof launchPath;
|
|
67
|
+
selectedLaunchPath: typeof selectedLaunchPath;
|
|
68
|
+
identitySalt: typeof identitySalt;
|
|
69
|
+
identitySeed: typeof identitySeed;
|
|
70
|
+
generateFingerprint: (options: Parameters<typeof generateFingerprint>[0]) => Promise<Record<string, any>>;
|
|
71
|
+
fromFpgen: typeof fromFpgen;
|
|
72
|
+
fromPreset: typeof fromPreset;
|
|
73
|
+
getRandomPreset: typeof getRandomPreset;
|
|
74
|
+
fixNavigatorArch: typeof fixNavigatorArch;
|
|
75
|
+
fixHardwareConcurrency: typeof fixHardwareConcurrency;
|
|
76
|
+
followBaselineProtection: typeof followBaselineProtection;
|
|
77
|
+
clampScreenToDisplay: typeof clampScreenToDisplay;
|
|
78
|
+
clampWindowDimensions: typeof clampWindowDimensions;
|
|
79
|
+
clampWindowPosition: typeof clampWindowPosition;
|
|
80
|
+
raiseScreenToModernFloor: typeof raiseScreenToModernFloor;
|
|
81
|
+
generateRandomFontSubset: typeof generateRandomFontSubset;
|
|
82
|
+
generateRandomVoiceSubset: typeof generateRandomVoiceSubset;
|
|
83
|
+
drawVoiceConfig: typeof drawVoiceConfig;
|
|
84
|
+
setMediaDevicesDefaults: typeof setMediaDevicesDefaults;
|
|
85
|
+
hostGpu: typeof hostGpu;
|
|
86
|
+
selectGpu: typeof selectGpu;
|
|
87
|
+
firefoxGpus: (targetOs: string) => Promise<[string, string][]>;
|
|
88
|
+
webglForGpu: (targetOs: string, vendor: string, renderer: string, seed?: import("python-random").Seed) => Promise<import("./webgl.js").WebGLData>;
|
|
89
|
+
sampleWebglForScreen: (targetOs: string, width?: number | null | undefined, height?: number | null | undefined, seed?: import("python-random").Seed, cores?: number | null | undefined, cpu?: Record<string, any> | null | undefined) => Promise<import("./webgl.js").WebGLData>;
|
|
90
|
+
publicIp: typeof publicIP;
|
|
91
|
+
publicIpv6: typeof publicIPv6;
|
|
92
|
+
getGeolocation: typeof getGeolocation;
|
|
93
|
+
validateConfig: (config: Record<string, any>, p?: string | null) => void;
|
|
94
|
+
getEnvVars: (config: Record<string, any>, uaOs: string, p?: string | null) => EnvVars;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* json.dumps(value, ensure_ascii=True, separators=(',', ':')): compact, every
|
|
98
|
+
* non-ASCII (and DEL) character \u-escaped, floats in Python's repr.
|
|
99
|
+
*/
|
|
100
|
+
export declare function pyJsonDumpsAscii(value: unknown): string;
|
|
101
|
+
/**
|
|
102
|
+
* orjson.dumps(config): compact, UTF-8, insertion order. JavaScript has one
|
|
103
|
+
* number type, so the Python int/float split is carried the way pycompat
|
|
104
|
+
* carries it: a safe-integer number is an int, a bigint is an int beyond
|
|
105
|
+
* 2**53, a PyFloat is an integral float, and any other number is a float.
|
|
106
|
+
*/
|
|
107
|
+
export declare function configJson(value: unknown): string;
|
|
108
|
+
/**
|
|
109
|
+
* Warn when a caller's own binary is older than their Playwright needs.
|
|
110
|
+
*
|
|
111
|
+
* A managed install below the floor is simply upgraded (pkgman resolves it),
|
|
112
|
+
* but `executable_path` deliberately bypasses that. That leaves the one
|
|
113
|
+
* pairing nothing checks: an old build driven by Playwright >= 1.61, which
|
|
114
|
+
* sends viewport fields the older Juggler schema rejects. Warns rather than
|
|
115
|
+
* raises: the default no-viewport path still works on an old build. A build
|
|
116
|
+
* with no version.json beside it tells us nothing, so it is left alone.
|
|
117
|
+
*/
|
|
118
|
+
export declare function warnIfExecutablePredatesPlaywright(executablePath?: string | null): void;
|
|
119
|
+
/**
|
|
120
|
+
* Pass the launcher's Firefox prefs to browser/settings/camoufox.cfg, which applies them
|
|
121
|
+
* at STARTUP (CAMOU_PREFS_1..N, chunked like CAMOU_CONFIG).
|
|
122
|
+
*
|
|
123
|
+
* Playwright's non-persistent launch writes no user.js: firefoxUserPrefs only
|
|
124
|
+
* reach the browser at runtime, through juggler's Browser.enable, after
|
|
125
|
+
* startup. Anything Gecko reads during startup therefore raced or never
|
|
126
|
+
* applied.
|
|
127
|
+
*/
|
|
128
|
+
export declare function getPrefEnvVars(prefs: Record<string, any>): Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the environment variables for Camoufox: the chunked CAMOU_CONFIG, plus
|
|
131
|
+
* the Linux fontconfig pointer.
|
|
132
|
+
*
|
|
133
|
+
* `executablePath` is the caller's own executable, when they supplied one. The
|
|
134
|
+
* bundled fontconfig is read from beside that binary rather than from the
|
|
135
|
+
* managed install, the same way loadProperties() treats properties.json.
|
|
136
|
+
*/
|
|
137
|
+
export declare function getEnvVars(configMap: Record<string, any>, userAgentOs: string, executablePath?: string | null): EnvVars;
|
|
138
|
+
/** True when CAMOUFOX_STRICT_CONFIG asks validateConfig to reject unknown keys. */
|
|
139
|
+
export declare function strictConfig(): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Validates the config map against the build's properties.json, and lifts a
|
|
142
|
+
* numeric value below its declared `min` up to it.
|
|
143
|
+
*
|
|
144
|
+
* A key the build does not declare is reported and skipped, so a newer library
|
|
145
|
+
* still launches an older build. With CAMOUFOX_STRICT_CONFIG=1 it throws
|
|
146
|
+
* UnknownProperty instead: CI sets it against the newest release, so the
|
|
147
|
+
* launcher cannot ship a writer for a key no released browser reads.
|
|
148
|
+
*/
|
|
149
|
+
export declare function validateConfig(configMap: Record<string, any>, executablePath?: string | null): void;
|
|
150
|
+
/**
|
|
151
|
+
* Validates the type of the value. (Python's bool is an int, so a boolean
|
|
152
|
+
* passes the numeric checks there, and here.)
|
|
153
|
+
*/
|
|
154
|
+
export declare function validateType(value: any, expectedType: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Validates that every `voices` entry is a complete voice object.
|
|
157
|
+
*/
|
|
158
|
+
export declare function validateVoices(voices: any): void;
|
|
159
|
+
/**
|
|
160
|
+
* Validates a `voices:speechd` grid: {"languages": [[name, lang], ...],
|
|
161
|
+
* "variants": [name, ...]}, the shape MaskConfig::MSpeechdVoices() expands.
|
|
162
|
+
*/
|
|
163
|
+
export declare function validateSpeechdVoices(grid: any): void;
|
|
164
|
+
/**
|
|
165
|
+
* Gets the OS from the config if the user agent is set, otherwise returns the
|
|
166
|
+
* OS of the current system.
|
|
167
|
+
*/
|
|
168
|
+
export declare function getTargetOs(config: Record<string, any>): TargetOS;
|
|
169
|
+
/**
|
|
170
|
+
* Determines the OS from the user agent string.
|
|
171
|
+
*/
|
|
172
|
+
export declare function determineUaOs(userAgent: string): TargetOS;
|
|
173
|
+
/**
|
|
174
|
+
* Determines a sane viewport size for Camoufox if being ran in headful mode.
|
|
175
|
+
*
|
|
176
|
+
* Bounds are CSS pixels, the unit Firefox lays its windows out in -- see
|
|
177
|
+
* display.ts for why that differs from the monitor's physical size.
|
|
178
|
+
*/
|
|
179
|
+
export declare function getScreenCons(headless?: boolean): Screen | null;
|
|
180
|
+
/**
|
|
181
|
+
* general.cpu_identity for the identity's CPU: 0 compute as the host, 1 Intel
|
|
182
|
+
* x86, 2 AMD x86, 3 ARM64 (every ARM64 CPU computes alike).
|
|
183
|
+
*/
|
|
184
|
+
export declare function cpuIdentityPref(config: Record<string, any>): number;
|
|
185
|
+
/**
|
|
186
|
+
* media.libvpx.realtime_only: Firefox builds libvpx realtime-only for Windows
|
|
187
|
+
* and Linux on ARM64 (not macOS), which changes the WebCodecs VP8/VP9 encoders'
|
|
188
|
+
* output and rejects quality-mode VP8 outright.
|
|
189
|
+
*/
|
|
190
|
+
export declare function vpxRealtimeOnly(config: Record<string, any>, targetOs: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The OSes a machine with this CPU can run, among those asked for, as
|
|
193
|
+
* utils._os_for_cpu. Throws ValueError when the CPU is malformed or none of
|
|
194
|
+
* them can. With no OS asked for, only OSes with a GPU fpgen recorded beside
|
|
195
|
+
* such a CPU are drawn: an ARM identity is a Mac, or Linux rendering with
|
|
196
|
+
* llvmpipe, until Windows-on-ARM or Linux-on-ARM GPUs are recorded.
|
|
197
|
+
*/
|
|
198
|
+
export declare function osForCpu(cpu: unknown, osValue: ListOrString | null | undefined): Promise<ListOrString>;
|
|
199
|
+
/**
|
|
200
|
+
* Checks if the target OS is valid.
|
|
201
|
+
*/
|
|
202
|
+
export declare function checkValidOs(osValue: ListOrString): void;
|
|
203
|
+
/**
|
|
204
|
+
* Merges new keys/values from the source into the target, given that the key
|
|
205
|
+
* does not exist in the target.
|
|
206
|
+
*/
|
|
207
|
+
export declare function mergeInto(target: Record<string, any>, source: Record<string, any>): void;
|
|
208
|
+
/**
|
|
209
|
+
* Sets a new key/value into the target, given that the key does not exist.
|
|
210
|
+
*/
|
|
211
|
+
export declare function setInto(target: Record<string, any>, key: string, value: any): void;
|
|
212
|
+
/**
|
|
213
|
+
* Checks if a domain is set in the config.
|
|
214
|
+
*/
|
|
215
|
+
export declare function isDomainSet(config: Record<string, any>, ...properties: string[]): boolean;
|
|
216
|
+
/** The host of a SOCKS5 proxy, or null when `proxy` is not one. */
|
|
217
|
+
/** Whether a Playwright proxy server is an HTTP(S) proxy (a bare host:port is one), which carries no UDP. */
|
|
218
|
+
export declare function proxyCarriesNoUdp(server: string): boolean;
|
|
219
|
+
export declare function socks5Host(proxy: ProxyConfig | undefined | null): string | null;
|
|
220
|
+
/**
|
|
221
|
+
* Who resolves the names a proxied browser visits (docs/proxy-dns.md).
|
|
222
|
+
*
|
|
223
|
+
* "exit", the default: the proxy is given names. "doh", behind a SOCKS5 proxy
|
|
224
|
+
* only: the browser, by DoH through the proxy, as a Firefox at the exit
|
|
225
|
+
* resolves its own; it gets HTTPS records, so it sends ECH where that Firefox
|
|
226
|
+
* does, and the proxy is given addresses. Starting HTTP/3 on them also needs
|
|
227
|
+
* the browser half that carries HTTP/3 over SOCKS5, which no released
|
|
228
|
+
* Camoufox has yet. An HTTP proxy is always given names.
|
|
229
|
+
*/
|
|
230
|
+
export declare function applyProxyDns(proxyDns: string | undefined | null, proxy: ProxyConfig | undefined | null, config: Record<string, any>, firefoxUserPrefs: Record<string, any>, exitLookedUp: boolean): Promise<void>;
|
|
231
|
+
/** The CAMOU_CONFIG chunks of a set of launch options, reassembled in order. */
|
|
232
|
+
export declare function camouConfigBlob(fromOptions: Record<string, any>): string;
|
|
233
|
+
/** The OS of the identity these launch options claim, the host's when they
|
|
234
|
+
* claim no user agent. */
|
|
235
|
+
export declare function launchOs(fromOptions: Record<string, any>): OsName;
|
|
236
|
+
/**
|
|
237
|
+
* The core count the browser must be pinned to for these launch options, or
|
|
238
|
+
* null: the identity's navigator.hardwareConcurrency when this host can honour
|
|
239
|
+
* it (see cpu_affinity), so a page measuring parallelism sees the reported
|
|
240
|
+
* number.
|
|
241
|
+
*/
|
|
242
|
+
export declare function pinnedCoreCount(fromOptions: Record<string, any>): number | null;
|
|
243
|
+
/**
|
|
244
|
+
* PID of the process that will spawn the browser (its children inherit the
|
|
245
|
+
* CPU affinity set on it). Python's driver is a separate Node process;
|
|
246
|
+
* playwright-core runs in this one.
|
|
247
|
+
*/
|
|
248
|
+
export declare function driverPid(): number;
|
|
249
|
+
/**
|
|
250
|
+
* Whether the CAMOU_CONFIG in a set of launch options spoofs any window
|
|
251
|
+
* dimension. The config is chunked across CAMOU_CONFIG_<n> env vars, so
|
|
252
|
+
* reassemble it in index order before looking.
|
|
253
|
+
*/
|
|
254
|
+
export declare function spoofsWindowDimensions(fromOptions: Record<string, any>): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* Playwright emulates four media features on every context it creates, whether
|
|
257
|
+
* or not the caller asked: `colorScheme` defaults to "light" and reducedMotion /
|
|
258
|
+
* forcedColors / contrast to their no-preference values. That is an override,
|
|
259
|
+
* not a passthrough -- the page then reports it whatever the host is set to. The
|
|
260
|
+
* JS API's `null` (Python's "no-override") is Playwright's own opt-out: it sends
|
|
261
|
+
* no emulation at all and the browser answers from the host.
|
|
262
|
+
*/
|
|
263
|
+
export declare const STOCK_MEDIA_DEFAULTS: {
|
|
264
|
+
readonly colorScheme: null;
|
|
265
|
+
readonly reducedMotion: null;
|
|
266
|
+
readonly forcedColors: null;
|
|
267
|
+
readonly contrast: null;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Default newPage()/newContext() to the host's own media features.
|
|
271
|
+
*
|
|
272
|
+
* Explicit colorScheme / reducedMotion / forcedColors / contrast from the caller
|
|
273
|
+
* always wins; this only replaces Playwright's silent defaults.
|
|
274
|
+
*/
|
|
275
|
+
export declare function attachStockMediaDefaults<T>(target: T): T;
|
|
276
|
+
/**
|
|
277
|
+
* Let newContext()/newPage() of `target` take a SOCKS5 proxy with a username
|
|
278
|
+
* and password (python/camoucore/src/camoucore/camoufox/utils.py attach_socks5_auth).
|
|
279
|
+
*
|
|
280
|
+
* Playwright refuses one ("Browser does not support socks5 proxy
|
|
281
|
+
* authentication"). The context is made with the proxy alone, and an init
|
|
282
|
+
* script hands Juggler the credentials before newContext() resolves
|
|
283
|
+
* (socks5Auth, proxyAuthInitScript). Playwright's newPage() makes its context
|
|
284
|
+
* through newContext(), so it is covered too.
|
|
285
|
+
*/
|
|
286
|
+
export declare function attachSocks5Auth<T>(target: T): T;
|
|
287
|
+
/**
|
|
288
|
+
* Warn when newPage()/newContext() asks for isMobile: Camoufox only has desktop
|
|
289
|
+
* identities, and Juggler ignores the option (TargetRegistry.js).
|
|
290
|
+
*/
|
|
291
|
+
export declare function attachDesktopOnlyWarning<T>(target: T): T;
|
|
292
|
+
/**
|
|
293
|
+
* Warn when a browser launched without a proxy gets a context proxy: the
|
|
294
|
+
* browser's own traffic (the push connection every context shares) then takes
|
|
295
|
+
* the first proxied context's proxy for the browser's life
|
|
296
|
+
* (TargetRegistry.getProxyInfo).
|
|
297
|
+
*/
|
|
298
|
+
export declare function attachSharedTrafficWarning<T>(target: T): T;
|
|
299
|
+
/** The machine a browser's contexts must claim: its OS and, if hardware, its GPU. */
|
|
300
|
+
export type HostIdentity = [TargetOS | null, Gpu | null];
|
|
301
|
+
/**
|
|
302
|
+
* Whether the canvas is covered, and the host GPU the identity claims.
|
|
303
|
+
*
|
|
304
|
+
* The canvas renders on the host, so the identity claims the host's GPU when it
|
|
305
|
+
* can: on the host's OS, with no GPU named, a GPU or software renderer fpgen has
|
|
306
|
+
* recorded there. With WebGL off no GPU is claimed. Any other identity
|
|
307
|
+
* contradicts the pixels, so the canvas is covered unless the caller chose
|
|
308
|
+
* canvas_noise: false.
|
|
309
|
+
*/
|
|
310
|
+
export declare function planRendering(targetOs: string | null, canvasNoise: boolean | null | undefined, namedGpu: boolean, webglDisabled: boolean, probe: () => Promise<Gpu | null>): Promise<[boolean, Gpu | null]>;
|
|
311
|
+
/**
|
|
312
|
+
* For a launch without the canvas placeholder, the machine its contexts must
|
|
313
|
+
* claim: the host's OS, and the host GPU it claims (planRendering). Only for
|
|
314
|
+
* the default `canvasNoise` (undefined); a caller who chose it, or built the
|
|
315
|
+
* options, keeps their contexts as they ask. Read before the launch, so a
|
|
316
|
+
* failed probe leaves no browser behind.
|
|
317
|
+
*/
|
|
318
|
+
export declare function hostIdentity(fromOptions: Record<string, any>, canvasNoise: boolean | undefined): Promise<HostIdentity | null>;
|
|
319
|
+
/**
|
|
320
|
+
* The OS and GPU a new context on `browser` claims (null: drawn).
|
|
321
|
+
*
|
|
322
|
+
* On a browser without the canvas placeholder they are the host's, since the
|
|
323
|
+
* canvas renders there; asking for anything else throws.
|
|
324
|
+
*/
|
|
325
|
+
export declare function contextIdentity(browser: any, os: string | undefined, preset: Record<string, any> | undefined): [string | undefined, Gpu | null];
|
|
326
|
+
/**
|
|
327
|
+
* Normalise a context-options object onto the JS API's `viewport: null`,
|
|
328
|
+
* defaulting to it when the caller expressed no preference. Playwright-Python
|
|
329
|
+
* takes `no_viewport=True`; a caller-supplied `noViewport` is accepted and
|
|
330
|
+
* translated.
|
|
331
|
+
*/
|
|
332
|
+
export declare function applyNoViewport(opts: Record<string, any>): Record<string, any>;
|
|
333
|
+
/**
|
|
334
|
+
* Default newPage()/newContext() to no viewport.
|
|
335
|
+
*
|
|
336
|
+
* Playwright applies a 1280x720 viewport by default, which makes Juggler ask
|
|
337
|
+
* the content window to become 1280x720 (TargetRegistry.updateViewportSize).
|
|
338
|
+
* When Camoufox is pinning the window to a spoofed size, that request can
|
|
339
|
+
* never be satisfied, and awaitViewportDimensions has no timeout -- so the
|
|
340
|
+
* second newPage() hangs forever (daijro/camoufox#666). An explicit viewport
|
|
341
|
+
* from the caller always wins.
|
|
342
|
+
*/
|
|
343
|
+
export declare function attachNoViewportDefault<T>(target: T): T;
|
|
344
|
+
/** The headless modes NewBrowser and launchServer accept. */
|
|
345
|
+
export type Headless = boolean | "virtual" | "virtual-gpu";
|
|
346
|
+
/** The options of the display headless="virtual-gpu" starts. */
|
|
347
|
+
export interface GpuDisplayOptions {
|
|
348
|
+
/** The GPU for headless="virtual-gpu": an index, a render or card node, a
|
|
349
|
+
* PCI address, vendor:device ids or a vendor name. Defaults to
|
|
350
|
+
* $CAMOUFOX_GPU, or the host's only GPU. */
|
|
351
|
+
gpu?: string | number;
|
|
352
|
+
/** Fail the launch (the default) when the browser on the GPU display does
|
|
353
|
+
* not render on the GPU; false warns instead. */
|
|
354
|
+
require_gpu?: boolean;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Start the display headless="virtual" or "virtual-gpu" asks for.
|
|
358
|
+
*
|
|
359
|
+
* Takes the display's own options out of `options` and points the launch at
|
|
360
|
+
* the display. Returns the display, or null, and the headless value to launch
|
|
361
|
+
* with.
|
|
362
|
+
*/
|
|
363
|
+
export declare function startVirtualDisplay(headless: Headless | undefined, debug: boolean | undefined, options: LaunchOptions & GpuDisplayOptions): Promise<[VirtualDisplay | null, boolean | undefined]>;
|
|
364
|
+
/**
|
|
365
|
+
* Attaches the virtual display to the browser's cleanup, and on a GPU display
|
|
366
|
+
* checks the browser renders on the GPU. (Python has an async and a sync
|
|
367
|
+
* variant; playwright-core has one API.)
|
|
368
|
+
*/
|
|
369
|
+
export declare function attachVirtualDisplay<T>(browser: T, virtualDisplay?: VirtualDisplay | null): Promise<T>;
|
|
370
|
+
/**
|
|
371
|
+
* The Firefox version of the build about to launch: the named executable's own
|
|
372
|
+
* application.ini, or the installed release. A named executable without one
|
|
373
|
+
* throws, since claiming another build's version would leak in the UA.
|
|
374
|
+
*/
|
|
375
|
+
export declare function resolveVerstr(executablePath?: string | null): string;
|
|
376
|
+
/** A bound on the screen a generated fingerprint may claim. */
|
|
377
|
+
type ScreenConstraint = Screen | {
|
|
378
|
+
min_width?: number;
|
|
379
|
+
max_width?: number;
|
|
380
|
+
min_height?: number;
|
|
381
|
+
max_height?: number;
|
|
382
|
+
minWidth?: number;
|
|
383
|
+
maxWidth?: number;
|
|
384
|
+
minHeight?: number;
|
|
385
|
+
maxHeight?: number;
|
|
386
|
+
};
|
|
387
|
+
export interface LaunchOptions {
|
|
388
|
+
/** Camoufox properties to use.
|
|
389
|
+
* (read https://github.com/daijro/camoufox/blob/main/README.md) */
|
|
390
|
+
config?: Record<string, any>;
|
|
391
|
+
/** Operating system to use for the fingerprint generation. Can be
|
|
392
|
+
* "windows", "macos", "linux", or a list to randomly choose from. */
|
|
393
|
+
os?: ListOrString;
|
|
394
|
+
/** Whether to block all images. */
|
|
395
|
+
block_images?: boolean;
|
|
396
|
+
/** Whether to block WebRTC entirely. */
|
|
397
|
+
block_webrtc?: boolean;
|
|
398
|
+
/** Whether to block WebGL. To prevent leaks, only use this for special cases. */
|
|
399
|
+
block_webgl?: boolean;
|
|
400
|
+
/** Disables the Cross-Origin-Opener-Policy, allowing elements in cross-origin
|
|
401
|
+
* iframes, such as the Turnstile checkbox, to be clicked. */
|
|
402
|
+
disable_coop?: boolean;
|
|
403
|
+
/** Use a specific WebGL vendor/renderer pair, as [vendor, renderer]. */
|
|
404
|
+
webgl_config?: [string, string];
|
|
405
|
+
/** The CPU the identity computes as: { arch: "x86" or "arm", manufacturer },
|
|
406
|
+
* either key optional (a manufacturer implies its arch). Firefox never
|
|
407
|
+
* reports it, but canvas pixels, Web Audio samples, encoded Opus,
|
|
408
|
+
* relaxed-SIMD wasm and NaN signs differ between x86-64 and ARM64, and
|
|
409
|
+
* canvas and Opus between Intel and AMD; the browser computes them as the
|
|
410
|
+
* claimed CPU does. Manufacturers per OS: macos x86 intel, arm apple;
|
|
411
|
+
* windows x86 intel or amd, arm qualcomm; linux x86 intel or amd, arm
|
|
412
|
+
* apple, qualcomm, broadcom, nvidia, ampere, rockchip, mediatek, amlogic or
|
|
413
|
+
* allwinner. A pair no machine on the OS has (an AMD Mac, an Apple x86 CPU),
|
|
414
|
+
* or one the GPU contradicts (an Apple GPU on x86, an Intel iGPU on AMD),
|
|
415
|
+
* throws ValueError. Without `os`, the OS is drawn among those with a
|
|
416
|
+
* recorded GPU for the CPU. By default the CPU follows the GPU (Apple GPU:
|
|
417
|
+
* Apple ARM; Intel iGPU or Intel Mac: Intel; Radeon iGPU: AMD) and a core
|
|
418
|
+
* count only Intel ships, otherwise x86 drawn 81% Intel, as among
|
|
419
|
+
* Firefox's x86 users. */
|
|
420
|
+
cpu?: {
|
|
421
|
+
arch?: "x86" | "arm";
|
|
422
|
+
manufacturer?: string;
|
|
423
|
+
};
|
|
424
|
+
/** Calculate longitude, latitude, timezone, country, & locale based on the IP
|
|
425
|
+
* address. Pass the target IP address to use, or `true` to find it. */
|
|
426
|
+
geoip?: string | boolean;
|
|
427
|
+
/** Name of the GeoIP database to use (e.g. "GeoIP AIO by daijro"). */
|
|
428
|
+
geoip_db?: string;
|
|
429
|
+
/** Driver-side humanization per channel, `{ mouse, keyboard, scroll, seed }` of myuri() or raw(); `true` is myuri() on every channel, and a channel the object omits is myuri(). The browser never humanizes input itself. */
|
|
430
|
+
humanize?: HumanizeSetting;
|
|
431
|
+
/** Locale(s) to use. The first listed locale is used for the Intl API. */
|
|
432
|
+
locale?: string | string[];
|
|
433
|
+
/** List of Firefox addons to use (paths to extracted addons). */
|
|
434
|
+
addons?: string[];
|
|
435
|
+
/** Fonts to load into Camoufox (in addition to the target `os`'s). */
|
|
436
|
+
fonts?: string[];
|
|
437
|
+
/** If enabled, OS-specific system fonts will not be passed to Camoufox. */
|
|
438
|
+
custom_fonts_only?: boolean;
|
|
439
|
+
/** Default addons to exclude. */
|
|
440
|
+
exclude_addons?: DefaultAddon[];
|
|
441
|
+
/** Constrains the screen dimensions of the generated fingerprint. */
|
|
442
|
+
screen?: ScreenConstraint;
|
|
443
|
+
/** Set a fixed window size instead of generating a random one. */
|
|
444
|
+
window?: [number, number];
|
|
445
|
+
/** Use a custom fpgen fingerprint. */
|
|
446
|
+
fingerprint?: Record<string, any>;
|
|
447
|
+
/** Opt into real fingerprint presets: `true` for a random bundled preset,
|
|
448
|
+
* or a preset object. */
|
|
449
|
+
fingerprint_preset?: boolean | Record<string, any>;
|
|
450
|
+
/** Firefox version to use. Defaults to the current Camoufox version. */
|
|
451
|
+
ff_version?: number;
|
|
452
|
+
/** Whether to run the browser in headless mode. Defaults to false.
|
|
453
|
+
* `true` is Firefox's own headless mode and starts no display; only
|
|
454
|
+
* `"virtual"` and `"virtual-gpu"` (Camoufox, NewBrowser and launchServer)
|
|
455
|
+
* start one. launchOptions() alone starts no display. */
|
|
456
|
+
headless?: boolean;
|
|
457
|
+
/** Whether to enable running scripts in the main world ("mw:" prefix). */
|
|
458
|
+
main_world_eval?: boolean;
|
|
459
|
+
/** Whether to allow addons to open new tabs. Defaults to false. */
|
|
460
|
+
allow_addon_new_tab?: boolean;
|
|
461
|
+
/** Custom Camoufox browser executable path. */
|
|
462
|
+
executable_path?: string;
|
|
463
|
+
/** Select a specific installed browser version ("official/beta.20",
|
|
464
|
+
* "beta.20", "134.0.2-beta.20"). Never downloaded. Defaults to the paired build. */
|
|
465
|
+
browser?: string;
|
|
466
|
+
/** Firefox user preferences to set. */
|
|
467
|
+
firefox_user_prefs?: Record<string, any>;
|
|
468
|
+
/** Proxy to use for the browser. */
|
|
469
|
+
proxy?: ProxyConfig;
|
|
470
|
+
/**
|
|
471
|
+
* Who resolves names behind a SOCKS5 proxy: "exit" (default), the proxy;
|
|
472
|
+
* "doh", the browser, by DoH through the proxy. "doh" needs a browser that
|
|
473
|
+
* carries HTTP/3 over SOCKS5, which no released Camoufox does yet. See
|
|
474
|
+
* docs/proxy-dns.md.
|
|
475
|
+
*/
|
|
476
|
+
proxy_dns?: "doh" | "exit";
|
|
477
|
+
/** Cache previous pages, requests, etc (uses more memory). */
|
|
478
|
+
enable_cache?: boolean;
|
|
479
|
+
/** Arguments to pass to the browser. */
|
|
480
|
+
args?: string[];
|
|
481
|
+
/** Environment variables to set. Defaults to a copy of process.env. */
|
|
482
|
+
env?: EnvVars;
|
|
483
|
+
/** Suppress leak warnings for options you are deliberately overriding. */
|
|
484
|
+
i_know_what_im_doing?: boolean;
|
|
485
|
+
/** Prints the config being sent to Camoufox. */
|
|
486
|
+
debug?: boolean;
|
|
487
|
+
/** Virtual display number, e.g. ":99". Handled by Camoufox, NewBrowser and launchServer. */
|
|
488
|
+
virtual_display?: string;
|
|
489
|
+
/** Pin the browser to navigator.hardwareConcurrency cores (Linux/Windows).
|
|
490
|
+
* OFF by default -- it costs real CPU and serializes concurrent launches. */
|
|
491
|
+
pin_cpu_cores?: boolean;
|
|
492
|
+
/** Replace canvas and WebGL readback with random data, as
|
|
493
|
+
* privacy.resistFingerprinting does in LibreWolf, Tor Browser and Mullvad
|
|
494
|
+
* Browser. Stock Firefox does not, so it warns. By default (undefined) the
|
|
495
|
+
* identity on the host's OS claims the GPU the host renders with, uncovered;
|
|
496
|
+
* it is on whenever the identity claims another OS or another GPU
|
|
497
|
+
* (webgl_config, a preset's, or a host GPU fpgen never recorded), whose
|
|
498
|
+
* canvas would otherwise show the host. */
|
|
499
|
+
canvas_noise?: boolean | null;
|
|
500
|
+
/** The display's ICC colour profile, which ICC-tagged images are converted
|
|
501
|
+
* to (a page reads it from their decoded pixels): ICC bytes or a path, e.g.
|
|
502
|
+
* one recorded with GetICMProfileW on a real machine. Default (undefined or
|
|
503
|
+
* false): the browser's own, the host display's as stock Firefox uses. */
|
|
504
|
+
display_profile?: DisplayProfileOption;
|
|
505
|
+
/** Additional Firefox launch options, passed straight through to Playwright. */
|
|
506
|
+
[key: string]: any;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Builds the Playwright Firefox launch options for Camoufox.
|
|
510
|
+
*
|
|
511
|
+
* Accepts all Playwright Firefox launch options, along with the Camoufox ones
|
|
512
|
+
* documented on {@link LaunchOptions}.
|
|
513
|
+
*/
|
|
514
|
+
export declare function launchOptions(options?: LaunchOptions): Promise<Record<string, any>>;
|
|
515
|
+
export {};
|