ant0-browser 0.1.1 → 0.2.0-beta.2
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/README.md +112 -4
- package/dist/canvas.d.ts +55 -0
- package/dist/canvas.d.ts.map +1 -0
- package/dist/canvas.js +82 -0
- package/dist/canvas.js.map +1 -0
- package/dist/chromium-version.d.ts +3 -3
- package/dist/chromium-version.js +3 -3
- package/dist/claim-hints.d.ts +36 -0
- package/dist/claim-hints.d.ts.map +1 -0
- package/dist/claim-hints.js +9 -0
- package/dist/claim-hints.js.map +1 -0
- package/dist/cleanup.d.ts +35 -0
- package/dist/cleanup.d.ts.map +1 -0
- package/dist/cleanup.js +106 -0
- package/dist/cleanup.js.map +1 -0
- package/dist/content.d.ts +11 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +52 -0
- package/dist/content.js.map +1 -0
- package/dist/download.d.ts +2 -0
- package/dist/download.d.ts.map +1 -1
- package/dist/download.js +14 -6
- package/dist/download.js.map +1 -1
- package/dist/errors.d.ts +49 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +53 -0
- package/dist/errors.js.map +1 -0
- package/dist/fingerprint.d.ts +42 -37
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +124 -24
- package/dist/fingerprint.js.map +1 -1
- package/dist/fontpack.d.ts.map +1 -1
- package/dist/fontpack.js +2 -1
- package/dist/fontpack.js.map +1 -1
- package/dist/fonts.js +1 -1
- package/dist/fonts.js.map +1 -1
- package/dist/geoip.d.ts.map +1 -1
- package/dist/geoip.js +3 -2
- package/dist/geoip.js.map +1 -1
- package/dist/geometry.d.ts +4 -0
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +9 -3
- package/dist/geometry.js.map +1 -1
- package/dist/identity-persistence.d.ts +38 -1
- package/dist/identity-persistence.d.ts.map +1 -1
- package/dist/identity-persistence.js +90 -10
- package/dist/identity-persistence.js.map +1 -1
- package/dist/identity.d.ts +41 -3
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +199 -26
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +69 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +415 -218
- package/dist/index.js.map +1 -1
- package/dist/launch-ticket.d.ts +109 -5
- package/dist/launch-ticket.d.ts.map +1 -1
- package/dist/launch-ticket.js +327 -11
- package/dist/launch-ticket.js.map +1 -1
- package/dist/launchopts.d.ts +181 -48
- package/dist/launchopts.d.ts.map +1 -1
- package/dist/launchopts.js +470 -51
- package/dist/launchopts.js.map +1 -1
- package/dist/native/linux-x64/PRODUCT-LICENSE.txt +28 -0
- package/dist/native/linux-x64/ant0_runtime.node +0 -0
- package/dist/native/windows-x64/PRODUCT-LICENSE.txt +28 -0
- package/dist/native/windows-x64/ant0_runtime.node +0 -0
- package/dist/persona-migration.d.ts +3 -0
- package/dist/persona-migration.d.ts.map +1 -1
- package/dist/persona-migration.js +2 -0
- package/dist/persona-migration.js.map +1 -1
- package/dist/persona-profile-v2.d.ts +15 -1
- package/dist/persona-profile-v2.d.ts.map +1 -1
- package/dist/persona-profile-v2.js +35 -2
- package/dist/persona-profile-v2.js.map +1 -1
- package/dist/persona-profile-v4.d.ts +61 -0
- package/dist/persona-profile-v4.d.ts.map +1 -0
- package/dist/persona-profile-v4.js +79 -0
- package/dist/persona-profile-v4.js.map +1 -0
- package/dist/persona-rejected.d.ts +36 -0
- package/dist/persona-rejected.d.ts.map +1 -0
- package/dist/persona-rejected.js +40 -0
- package/dist/persona-rejected.js.map +1 -0
- package/dist/population-model.d.ts +3 -0
- package/dist/population-model.d.ts.map +1 -1
- package/dist/population-model.js +24 -3
- package/dist/population-model.js.map +1 -1
- package/dist/profile-file.d.ts +201 -0
- package/dist/profile-file.d.ts.map +1 -0
- package/dist/profile-file.js +736 -0
- package/dist/profile-file.js.map +1 -0
- package/dist/release-fetch.d.ts +4 -0
- package/dist/release-fetch.d.ts.map +1 -1
- package/dist/release-fetch.js +3 -0
- package/dist/release-fetch.js.map +1 -1
- package/dist/render.js +2 -2
- package/dist/render.js.map +1 -1
- package/dist/runtime-client.d.ts +47 -0
- package/dist/runtime-client.d.ts.map +1 -0
- package/dist/runtime-client.js +327 -0
- package/dist/runtime-client.js.map +1 -0
- package/dist/runtime-launch.d.ts +22 -0
- package/dist/runtime-launch.d.ts.map +1 -0
- package/dist/runtime-launch.js +92 -0
- package/dist/runtime-launch.js.map +1 -0
- package/dist/scale.d.ts +29 -0
- package/dist/scale.d.ts.map +1 -0
- package/dist/scale.js +105 -0
- package/dist/scale.js.map +1 -0
- package/dist/shaderdialect.d.ts.map +1 -1
- package/dist/shaderdialect.js +2 -1
- package/dist/shaderdialect.js.map +1 -1
- package/dist/speech-coherence.d.ts +52 -0
- package/dist/speech-coherence.d.ts.map +1 -0
- package/dist/speech-coherence.js +254 -0
- package/dist/speech-coherence.js.map +1 -0
- package/dist/template-selection.d.ts.map +1 -1
- package/dist/template-selection.js +8 -7
- package/dist/template-selection.js.map +1 -1
- package/dist/warnings.d.ts +35 -4
- package/dist/warnings.d.ts.map +1 -1
- package/dist/warnings.js +139 -25
- package/dist/warnings.js.map +1 -1
- package/dist/webgl-coherence.d.ts +30 -0
- package/dist/webgl-coherence.d.ts.map +1 -0
- package/dist/webgl-coherence.js +98 -0
- package/dist/webgl-coherence.js.map +1 -0
- package/dist/webgpu-override.d.ts +14 -0
- package/dist/webgpu-override.d.ts.map +1 -0
- package/dist/webgpu-override.js +82 -0
- package/dist/webgpu-override.js.map +1 -0
- package/dist/widevine.d.ts.map +1 -1
- package/dist/widevine.js +11 -10
- package/dist/widevine.js.map +1 -1
- package/package.json +5 -5
package/dist/warnings.js
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
// launch() and emitCoherenceWarnings() prints an actionable line to stderr. Never blocks the
|
|
7
7
|
// launch; suppressible with quiet:true or ANT0_BROWSER_NO_WARN=1. coherenceWarnings() is pure (no I/O).
|
|
8
8
|
import { readdirSync } from "node:fs";
|
|
9
|
+
import { webgpuOverridePlan } from "./webgpu-override.js";
|
|
9
10
|
import { CHROMIUM_MAJOR } from "./chromium-version.js";
|
|
11
|
+
import { canvasMode } from "./canvas.js";
|
|
10
12
|
const SOFTWARE_GPU = ["swiftshader", "llvmpipe", "microsoft basic render", "software adapter", "software"];
|
|
11
|
-
const seenNotes = new Set(); // fire-once per process for NOTE codes
|
|
13
|
+
const seenNotes = new Set(); // fire-once per process for NOTE codes and ONCE_WARN_CODES
|
|
14
|
+
/** WARN-level codes that still print only once per process (an ignored switch repeats every launch). */
|
|
15
|
+
const ONCE_WARN_CODES = new Set(["gpu-string-only"]);
|
|
12
16
|
/** True if this Linux host exposes a DRM/GPU device (a renderD or card node under /dev/dri). Absence
|
|
13
17
|
* strongly implies software rendering, so callers act only on ABSENCE. Does I/O (kept out of the
|
|
14
18
|
* pure coherenceWarnings). */
|
|
@@ -22,8 +26,8 @@ export function linuxHostHasGpu(driDir = "/dev/dri") {
|
|
|
22
26
|
}
|
|
23
27
|
/** Return identityMode when a persona presenting a HARDWARE GPU will render on a software rasterizer
|
|
24
28
|
* because this Linux host has no GPU device; else undefined. Threaded into coherenceWarnings as
|
|
25
|
-
* _gpuHostMissing. Silent under honest GPU (disableGpuFingerprint)
|
|
26
|
-
*
|
|
29
|
+
* _gpuHostMissing. Silent under honest GPU (disableGpuFingerprint) or a pinned software renderer.
|
|
30
|
+
* Does I/O. */
|
|
27
31
|
export function gpuHostMissingFor(fp, identityMode, hostPlatform, driDir = "/dev/dri") {
|
|
28
32
|
const host = hostPlatform ?? process.platform;
|
|
29
33
|
if ((identityMode !== "captured" && identityMode !== "synthetic") || !host.startsWith("linux"))
|
|
@@ -33,12 +37,35 @@ export function gpuHostMissingFor(fp, identityMode, hostPlatform, driDir = "/dev
|
|
|
33
37
|
const gr = String(fp.gpuRenderer ?? "").toLowerCase();
|
|
34
38
|
if (SOFTWARE_GPU.some((s) => gr.includes(s)))
|
|
35
39
|
return undefined;
|
|
36
|
-
|
|
37
|
-
const bridgeOn = bridge && typeof bridge === "object" ? Boolean(bridge.url) : Boolean(bridge);
|
|
38
|
-
if (bridgeOn || linuxHostHasGpu(driDir))
|
|
40
|
+
if (linuxHostHasGpu(driDir))
|
|
39
41
|
return undefined;
|
|
40
42
|
return identityMode;
|
|
41
43
|
}
|
|
44
|
+
/** First engine release that closes the narrow-switch gaps: WebGPU, limits and shader precision follow
|
|
45
|
+
* the real GPU under --disable-gpu-string-spoof, and toBlob/convertToBlob follow --disable-canvas-noise. */
|
|
46
|
+
export const GPU_CANVAS_FIX_ENGINE = "158.0.8127.18-ant0.8";
|
|
47
|
+
const ENGINE_RE = /^(\d+)\.(\d+)\.(\d+)\.(\d+)-ant0\.(\d+)$/;
|
|
48
|
+
const DEV_ENGINE_RE = /^\d+\.\d+\.\d+\.\d+-ant0\.dev$/;
|
|
49
|
+
/** True when the running engine is ant0.8 or later. A development build (`<chromium>-ant0.dev`, built
|
|
50
|
+
* from main) counts as NEW, so it is not nagged about gaps main has closed; a missing or unparseable
|
|
51
|
+
* version counts as OLD, so the operator is warned. Compared numerically, field by field. */
|
|
52
|
+
export function engineHasGpuCanvasFixes(engineVersion) {
|
|
53
|
+
if (typeof engineVersion !== "string")
|
|
54
|
+
return false;
|
|
55
|
+
const v = engineVersion.trim();
|
|
56
|
+
if (DEV_ENGINE_RE.test(v))
|
|
57
|
+
return true;
|
|
58
|
+
const have = ENGINE_RE.exec(v);
|
|
59
|
+
if (!have)
|
|
60
|
+
return false;
|
|
61
|
+
const need = ENGINE_RE.exec(GPU_CANVAS_FIX_ENGINE);
|
|
62
|
+
for (let i = 1; i < need.length; i++) {
|
|
63
|
+
const a = Number(have[i]), b = Number(need[i]);
|
|
64
|
+
if (a !== b)
|
|
65
|
+
return a > b;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
42
69
|
function proxyServer(proxy) {
|
|
43
70
|
if (!proxy)
|
|
44
71
|
return "";
|
|
@@ -69,8 +96,17 @@ function gpuIncoherent(renderer, platform) {
|
|
|
69
96
|
return "Linux uses OpenGL/Vulkan, never Direct3D/Metal";
|
|
70
97
|
return null;
|
|
71
98
|
}
|
|
99
|
+
/** The canvas mode the launch resolves to; an invalid `canvas` value (rejected elsewhere) counts as real. */
|
|
100
|
+
function warnedCanvasMode(opts) {
|
|
101
|
+
try {
|
|
102
|
+
return canvasMode(opts);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
return "real";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
72
108
|
/** Inspect resolved options for incoherent / missing-recommended combinations. Pure. */
|
|
73
|
-
export function coherenceWarnings(opts, hostPlatform, buildMajor) {
|
|
109
|
+
export function coherenceWarnings(opts, hostPlatform, buildMajor, engineVersion) {
|
|
74
110
|
const host = hostPlatform ?? process.platform;
|
|
75
111
|
const bmajor = buildMajor ?? String(CHROMIUM_MAJOR);
|
|
76
112
|
const out = [];
|
|
@@ -84,9 +120,11 @@ export function coherenceWarnings(opts, hostPlatform, buildMajor) {
|
|
|
84
120
|
const gpuR = opts.gpuRenderer, gpuV = opts.gpuVendor;
|
|
85
121
|
const profile = opts.fingerprintProfile;
|
|
86
122
|
const dgf = opts.disableGpuFingerprint, noise = opts.fingerprintNoise;
|
|
123
|
+
const gpuStringSpoof = opts.gpuStringSpoof, canvasNoise = opts.canvasNoise;
|
|
124
|
+
const fixed = engineHasGpuCanvasFixes(engineVersion);
|
|
125
|
+
const personaV4 = typeof profile === "object" && profile !== null
|
|
126
|
+
&& profile.schema_version === 4;
|
|
87
127
|
const headless = opts.headless;
|
|
88
|
-
const bridge = opts.canvasBridge;
|
|
89
|
-
const bridgeOn = bridge && typeof bridge === "object" ? Boolean(bridge.url) : Boolean(bridge);
|
|
90
128
|
const userArgs = opts._userArgs ?? [];
|
|
91
129
|
if (server && !geoip && !tz && !lang)
|
|
92
130
|
warn("proxy-no-geo", "proxy set without geoip and no timezone/acceptLanguage - the browser's timezone and language " +
|
|
@@ -107,16 +145,42 @@ export function coherenceWarnings(opts, hostPlatform, buildMajor) {
|
|
|
107
145
|
}
|
|
108
146
|
if (gpuR && SOFTWARE_GPU.some((s) => gpuR.toLowerCase().includes(s)))
|
|
109
147
|
warn("gpu-software", `gpuRenderer is a SOFTWARE renderer ('${gpuR}') - a real consumer machine reports a hardware GPU. ` +
|
|
110
|
-
"Pin a real GPU string, or use
|
|
111
|
-
|
|
148
|
+
"Pin a real GPU string, or use a real-GPU host.");
|
|
149
|
+
const wgpu = webgpuOverridePlan(opts);
|
|
150
|
+
if (wgpu.warning)
|
|
151
|
+
warn("gpu-webgpu-mismatch", wgpu.warning);
|
|
152
|
+
// A schema 4 persona names its own brand (chrome or edge), and the engine is built for it.
|
|
153
|
+
if (brand && !personaV4 && !["chrome", "google chrome"].includes(String(brand).toLowerCase()))
|
|
112
154
|
warn("brand-mismatch", `brand='${brand}' is advertised in UA-CH, but the binary's TLS/JA4 and engine are Chrome ${bmajor} ` +
|
|
113
155
|
"- a UA-vs-transport mismatch strict detectors cross-check. Keep brand='Chrome'.");
|
|
114
156
|
if (bver && String(bver).split(".")[0] !== bmajor)
|
|
115
157
|
warn("version-mismatch", `brandVersion major ${String(bver).split(".")[0]} differs from the build's Chrome ${bmajor} - ` +
|
|
116
158
|
`JA4/UA-CH version desync. Align brandVersion to ${bmajor} (or omit it).`);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
159
|
+
// Canvas mode (identity API: overrides.canvas, see canvas.ts). "real" is this computer's genuine
|
|
160
|
+
// canvas output, the same for every profile on this computer; the SDK adds no noise switch and
|
|
161
|
+
// nothing below warns about noise. "noise" is unique to the profile and stable across launches and
|
|
162
|
+
// sites (--fingerprint-noise-key). Only noise mode can put altered pixels next to a real GPU string.
|
|
163
|
+
const noiseMode = warnedCanvasMode(opts) === "noise";
|
|
164
|
+
const REAL_HINT = " Use canvas:'real' (the default) for this computer's genuine canvas output.";
|
|
165
|
+
if (dgf && noiseMode)
|
|
166
|
+
warn("gpu-noise", "disableGpuFingerprint presents the REAL GPU, but canvas mode 'noise' makes the canvas output " +
|
|
167
|
+
"unique to the profile - altered pixels next to a real GPU are themselves a tell." + REAL_HINT);
|
|
168
|
+
// gpuStringSpoof:false. On engines before ant0.8 the switch is ignored; that case is covered by the
|
|
169
|
+
// gpu-string-only warning below, so this warning is for ant0.8+ only (no two messages saying the same).
|
|
170
|
+
if (!dgf && gpuStringSpoof === false && noiseMode && fixed)
|
|
171
|
+
warn("gpu-noise-string", "gpuStringSpoof:false reports the REAL WebGL vendor/renderer, but canvas mode 'noise' makes the " +
|
|
172
|
+
"canvas output unique to the profile - a real string over altered pixels is itself a tell." + REAL_HINT);
|
|
173
|
+
if (!dgf && gpuStringSpoof === false && !fixed)
|
|
174
|
+
warn("gpu-string-only", "engines before ant0.8 ignore gpuStringSpoof:false, so the setting has no effect until the " +
|
|
175
|
+
"engine is upgraded: this launch still reports the full persona GPU (WebGL vendor/renderer, " +
|
|
176
|
+
"getParameter limits, extension list, shader precision and the navigator.gpu WebGPU identity). " +
|
|
177
|
+
"Upgrade the engine to ant0.8 or later, or use disableGpuFingerprint:true to take the whole GPU " +
|
|
178
|
+
"surface real.");
|
|
179
|
+
if (canvasNoise === false && !fixed && noiseMode)
|
|
180
|
+
note("canvas-noise-toblob", "engines before ant0.8 ignore canvasNoise:false, so the setting has no effect until the engine " +
|
|
181
|
+
"is upgraded; this launch is in canvas mode 'noise'. Upgrade the engine to ant0.8 or later." + REAL_HINT);
|
|
182
|
+
if (noiseMode && noise === false)
|
|
183
|
+
warn(CANVAS_NOISE_CONFLICT_CODE, CANVAS_NOISE_CONFLICT_MESSAGE);
|
|
120
184
|
// A persona presenting a hardware GPU on a Linux host with NO GPU device renders on a software
|
|
121
185
|
// rasterizer: the renderer STRING claims a real GPU while MAX_TEXTURE_SIZE, the WebGL extension
|
|
122
186
|
// list and navigator.gpu (WebGPU adapter) report software-tier caps -- exactly what an enterprise
|
|
@@ -129,26 +193,25 @@ export function coherenceWarnings(opts, hostPlatform, buildMajor) {
|
|
|
129
193
|
"WebGPU fall back to a software rasterizer. A strict/enterprise detector reads the contradiction " +
|
|
130
194
|
"directly: the renderer STRING claims a real GPU while MAX_TEXTURE_SIZE, the WebGL extension " +
|
|
131
195
|
"list and navigator.gpu (the WebGPU adapter) report software-tier capabilities. Run on a host " +
|
|
132
|
-
"with a real GPU (and drop --disable-gpu)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
note("headless-render", "headless with no canvasBridge/disableGpuFingerprint/fingerprintProfile - canvas and WebGL may " +
|
|
196
|
+
"with a real GPU (and drop --disable-gpu).");
|
|
197
|
+
if (headless !== false && !dgf && !profile && !gpuUnreachable)
|
|
198
|
+
note("headless-render", "headless with no disableGpuFingerprint/fingerprintProfile - canvas and WebGL may " +
|
|
136
199
|
"render on software here while the persona claims a hardware GPU (a render-vs-string mismatch on " +
|
|
137
|
-
"canvas-scored sites). Use
|
|
138
|
-
if (
|
|
139
|
-
note("
|
|
140
|
-
"
|
|
200
|
+
"canvas-scored sites). Use disableGpuFingerprint or a real-GPU host.");
|
|
201
|
+
if (opts._cacheDirGiven)
|
|
202
|
+
note("cache-dir-ignored", "cacheDir is ignored on launch: the engine comes from runtime discovery. To choose the download " +
|
|
203
|
+
"cache, use executablePath({ cacheDir }).");
|
|
141
204
|
if (userArgs.some((a) => String(a).includes("--enable-automation") || String(a).startsWith("--remote-debugging-port")))
|
|
142
205
|
warn("automation-arg", "your args re-introduce an automation flag (--enable-automation / --remote-debugging-port) the SDK " +
|
|
143
206
|
"strips by default - a strong webdriver/CDP tell.");
|
|
144
207
|
return out;
|
|
145
208
|
}
|
|
146
209
|
/** Print coherence warnings to stderr unless quiet or ANT0_BROWSER_NO_WARN. NOTE lines fire once/process. */
|
|
147
|
-
export function emitCoherenceWarnings(opts, quiet, hostPlatform, buildMajor) {
|
|
210
|
+
export function emitCoherenceWarnings(opts, quiet, hostPlatform, buildMajor, engineVersion) {
|
|
148
211
|
if (quiet || process.env.ANT0_BROWSER_NO_WARN)
|
|
149
212
|
return;
|
|
150
|
-
for (const w of coherenceWarnings(opts, hostPlatform, buildMajor)) {
|
|
151
|
-
if (w.severity === "note") {
|
|
213
|
+
for (const w of coherenceWarnings(opts, hostPlatform, buildMajor, engineVersion)) {
|
|
214
|
+
if (w.severity === "note" || ONCE_WARN_CODES.has(w.code)) {
|
|
152
215
|
if (seenNotes.has(w.code))
|
|
153
216
|
continue;
|
|
154
217
|
seenNotes.add(w.code);
|
|
@@ -156,4 +219,55 @@ export function emitCoherenceWarnings(opts, quiet, hostPlatform, buildMajor) {
|
|
|
156
219
|
process.stderr.write(`ant0-browser: ${w.severity === "warn" ? "warning" : "note"}: ${w.message}\n`);
|
|
157
220
|
}
|
|
158
221
|
}
|
|
222
|
+
let canvasBridgeNoted = false;
|
|
223
|
+
/** One-time note that `canvasBridge` was removed and its value is ignored. Never throws. */
|
|
224
|
+
export function warnCanvasBridgeRemoved(quiet) {
|
|
225
|
+
if (canvasBridgeNoted)
|
|
226
|
+
return;
|
|
227
|
+
canvasBridgeNoted = true;
|
|
228
|
+
if (quiet || process.env.ANT0_BROWSER_NO_WARN)
|
|
229
|
+
return;
|
|
230
|
+
process.stderr.write("ant0-browser: note: canvasBridge was removed and is ignored. Use a host with a real GPU for hardware canvas/WebGL.\n");
|
|
231
|
+
}
|
|
232
|
+
/** Test hook: forget that the note was shown. */
|
|
233
|
+
export function resetCanvasBridgeNote() { canvasBridgeNoted = false; }
|
|
234
|
+
/** Code and text of the warning for `canvas: "noise"` together with `fingerprintNoise: false`. The
|
|
235
|
+
* args are unchanged (both switches are sent); the combination just contradicts itself. */
|
|
236
|
+
export const CANVAS_NOISE_CONFLICT_CODE = "canvas-noise-conflict";
|
|
237
|
+
export const CANVAS_NOISE_CONFLICT_MESSAGE = "canvas mode 'noise' is combined with fingerprint noise switched off (fingerprintNoise:false in Node, " +
|
|
238
|
+
"fingerprint_noise=False in Python). The SDK sends both the noise key and --disable-fingerprint-noise, " +
|
|
239
|
+
"and the combination contradicts itself. Drop the fingerprint noise override, or use canvas \"real\" for " +
|
|
240
|
+
"this computer's genuine canvas output.";
|
|
241
|
+
/** The text of the `canvas-noise-no-key` warning. */
|
|
242
|
+
export const CANVAS_NOISE_NO_KEY_MESSAGE = "canvasNoise / fingerprintNoise: true no longer turn canvas noise on; this launch uses real readback. " +
|
|
243
|
+
"To get a per-profile canvas, set overrides.canvas to \"noise\" (with overrides.canvasNoiseKey, or a synthetic identity, which has a key).";
|
|
244
|
+
/** Warn (every launch, to stderr) that legacy canvasNoise/fingerprintNoise:true does not enable noise and the launch stays real. */
|
|
245
|
+
export function warnCanvasNoiseNoKey(quiet) {
|
|
246
|
+
if (quiet || process.env.ANT0_BROWSER_NO_WARN)
|
|
247
|
+
return;
|
|
248
|
+
process.stderr.write(`ant0-browser: warning: [canvas-noise-no-key] ${CANVAS_NOISE_NO_KEY_MESSAGE}\n`);
|
|
249
|
+
}
|
|
250
|
+
/** A debug-level line: printed only when ANT0_BROWSER_DEBUG is set. */
|
|
251
|
+
export function debugLog(message) {
|
|
252
|
+
if (process.env.ANT0_BROWSER_DEBUG)
|
|
253
|
+
process.stderr.write(`ant0-browser: debug: ${message}\n`);
|
|
254
|
+
}
|
|
255
|
+
/** Code and text of the warning for a platform or brand override on a schema 4 persona (same in the Python SDK). */
|
|
256
|
+
export const PERSONA_IDENTITY_OVERRIDE_CODE = "persona-identity-override";
|
|
257
|
+
export const PERSONA_IDENTITY_OVERRIDE_MESSAGE = "a platform or brand override is mixed with a schema 4 persona. The override wins over the persona's " +
|
|
258
|
+
"identity and only the value you set is passed (the persona's versions are not carried along), so the " +
|
|
259
|
+
"page can show an identity the persona does not describe. Drop the override to present the persona as issued.";
|
|
260
|
+
export function warnPersonaIdentityOverride(quiet) {
|
|
261
|
+
if (quiet || process.env.ANT0_BROWSER_NO_WARN)
|
|
262
|
+
return;
|
|
263
|
+
process.stderr.write(`ant0-browser: warning: [${PERSONA_IDENTITY_OVERRIDE_CODE}] ${PERSONA_IDENTITY_OVERRIDE_MESSAGE}\n`);
|
|
264
|
+
}
|
|
265
|
+
/** Print persona notices (see profile-file.ts) to stderr as warnings, every launch, unless quiet or
|
|
266
|
+
* ANT0_BROWSER_NO_WARN. */
|
|
267
|
+
export function emitPersonaNotices(notices, quiet) {
|
|
268
|
+
if (quiet || process.env.ANT0_BROWSER_NO_WARN)
|
|
269
|
+
return;
|
|
270
|
+
for (const n of notices)
|
|
271
|
+
process.stderr.write(`ant0-browser: warning: [${n.code}] ${n.message}\n`);
|
|
272
|
+
}
|
|
159
273
|
//# sourceMappingURL=warnings.js.map
|
package/dist/warnings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,+FAA+F;AAC/F,6FAA6F;AAC7F,wGAAwG;AAExG,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,4FAA4F;AAC5F,gGAAgG;AAChG,+FAA+F;AAC/F,6FAA6F;AAC7F,wGAAwG;AAExG,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAE7D,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,UAAU,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAC3G,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC,C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
|
|
3
|
+
*
|
|
4
|
+
* ONE table keyed by (os_family, browser_family). Each row lists the relations as data (the sum of
|
|
5
|
+
* the `sum` limits must not exceed the `max` limit) and the engine's own value for each limit a
|
|
6
|
+
* profile leaves out. Evaluation is over the MERGED record: webgl1 first, then webgl2 overwriting
|
|
7
|
+
* key by key. A relation is evaluated, with absent limits filled from the row's defaults, when at
|
|
8
|
+
* least one of its limits is present; a relation with none present is skipped. A present limit
|
|
9
|
+
* that is not a non-negative integer is a violation. A pair without a row has no rule; a new
|
|
10
|
+
* platform or browser family is a new row. Keep in step with the engine (patch 926) and the
|
|
11
|
+
* cloud's webgl-coherence-rules.ts.
|
|
12
|
+
*/
|
|
13
|
+
export interface WebGLRelation {
|
|
14
|
+
sum: readonly string[];
|
|
15
|
+
max: string;
|
|
16
|
+
}
|
|
17
|
+
export interface WebGLRuleRow {
|
|
18
|
+
relations: readonly WebGLRelation[];
|
|
19
|
+
defaults: Readonly<Record<string, number>>;
|
|
20
|
+
}
|
|
21
|
+
/** Rule rows by `${os_family}/${browser_family}`. */
|
|
22
|
+
export declare const WEBGL_COHERENCE_RULES: Readonly<Record<string, WebGLRuleRow>>;
|
|
23
|
+
/**
|
|
24
|
+
* Violations, as readable strings, of the rule row for (osFamily, browserFamily) in the merged
|
|
25
|
+
* record of `webgl1` and `webgl2` parameter objects. Empty for an unknown pair.
|
|
26
|
+
* Message: `incoherent WebGL limits: webgl2 A (14) + B (12) exceeds C (24)`; the set label is
|
|
27
|
+
* webgl2 when any limit of the relation comes from webgl2, else webgl1.
|
|
28
|
+
*/
|
|
29
|
+
export declare function webglLimitViolations(osFamily: string, browserFamily: string, webgl1: Record<string, unknown> | undefined, webgl2: Record<string, unknown> | undefined): string[];
|
|
30
|
+
//# sourceMappingURL=webgl-coherence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-coherence.d.ts","sourceRoot":"","sources":["../src/webgl-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,SAAS,aAAa,EAAE,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAmBD,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAIxE,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC1C,MAAM,EAAE,CA4CV"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGL limit coherence of a persona profile, mirroring the engine's strict loader.
|
|
3
|
+
*
|
|
4
|
+
* ONE table keyed by (os_family, browser_family). Each row lists the relations as data (the sum of
|
|
5
|
+
* the `sum` limits must not exceed the `max` limit) and the engine's own value for each limit a
|
|
6
|
+
* profile leaves out. Evaluation is over the MERGED record: webgl1 first, then webgl2 overwriting
|
|
7
|
+
* key by key. A relation is evaluated, with absent limits filled from the row's defaults, when at
|
|
8
|
+
* least one of its limits is present; a relation with none present is skipped. A present limit
|
|
9
|
+
* that is not a non-negative integer is a violation. A pair without a row has no rule; a new
|
|
10
|
+
* platform or browser family is a new row. Keep in step with the engine (patch 926) and the
|
|
11
|
+
* cloud's webgl-coherence-rules.ts.
|
|
12
|
+
*/
|
|
13
|
+
const CHROMIUM_DESKTOP = {
|
|
14
|
+
relations: [
|
|
15
|
+
{ sum: ["MAX_VERTEX_UNIFORM_BLOCKS", "MAX_FRAGMENT_UNIFORM_BLOCKS"], max: "MAX_COMBINED_UNIFORM_BLOCKS" },
|
|
16
|
+
{ sum: ["MAX_COMBINED_UNIFORM_BLOCKS"], max: "MAX_UNIFORM_BUFFER_BINDINGS" },
|
|
17
|
+
{ sum: ["MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_IMAGE_UNITS"], max: "MAX_COMBINED_TEXTURE_IMAGE_UNITS" },
|
|
18
|
+
],
|
|
19
|
+
defaults: {
|
|
20
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 12,
|
|
21
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 12,
|
|
22
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 24,
|
|
23
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 24,
|
|
24
|
+
MAX_VERTEX_TEXTURE_IMAGE_UNITS: 16,
|
|
25
|
+
MAX_TEXTURE_IMAGE_UNITS: 16,
|
|
26
|
+
MAX_COMBINED_TEXTURE_IMAGE_UNITS: 32,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** Rule rows by `${os_family}/${browser_family}`. */
|
|
30
|
+
export const WEBGL_COHERENCE_RULES = {
|
|
31
|
+
"windows/chromium": CHROMIUM_DESKTOP,
|
|
32
|
+
"linux/chromium": CHROMIUM_DESKTOP,
|
|
33
|
+
"macos/chromium": CHROMIUM_DESKTOP,
|
|
34
|
+
};
|
|
35
|
+
function isCount(value) {
|
|
36
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Violations, as readable strings, of the rule row for (osFamily, browserFamily) in the merged
|
|
40
|
+
* record of `webgl1` and `webgl2` parameter objects. Empty for an unknown pair.
|
|
41
|
+
* Message: `incoherent WebGL limits: webgl2 A (14) + B (12) exceeds C (24)`; the set label is
|
|
42
|
+
* webgl2 when any limit of the relation comes from webgl2, else webgl1.
|
|
43
|
+
*/
|
|
44
|
+
export function webglLimitViolations(osFamily, browserFamily, webgl1, webgl2) {
|
|
45
|
+
const row = WEBGL_COHERENCE_RULES[`${osFamily}/${browserFamily}`];
|
|
46
|
+
if (row === undefined)
|
|
47
|
+
return [];
|
|
48
|
+
const find = (key) => {
|
|
49
|
+
if (webgl2 && webgl2[key] !== undefined)
|
|
50
|
+
return { value: webgl2[key], set: "webgl2" };
|
|
51
|
+
if (webgl1 && webgl1[key] !== undefined)
|
|
52
|
+
return { value: webgl1[key], set: "webgl1" };
|
|
53
|
+
return undefined;
|
|
54
|
+
};
|
|
55
|
+
const out = [];
|
|
56
|
+
const reported = new Set();
|
|
57
|
+
for (const relation of row.relations) {
|
|
58
|
+
const keys = [...relation.sum, relation.max];
|
|
59
|
+
if (!keys.some((k) => find(k) !== undefined))
|
|
60
|
+
continue;
|
|
61
|
+
let usable = true;
|
|
62
|
+
let set = "webgl1";
|
|
63
|
+
const values = [];
|
|
64
|
+
for (const k of keys) {
|
|
65
|
+
const found = find(k);
|
|
66
|
+
if (found !== undefined) {
|
|
67
|
+
if (found.set === "webgl2")
|
|
68
|
+
set = "webgl2";
|
|
69
|
+
if (!isCount(found.value)) {
|
|
70
|
+
usable = false;
|
|
71
|
+
if (!reported.has(k)) {
|
|
72
|
+
reported.add(k);
|
|
73
|
+
out.push(`${k} must be a non-negative integer, got ${JSON.stringify(found.value)}`);
|
|
74
|
+
}
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
values.push(found.value);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const fallback = row.defaults[k];
|
|
81
|
+
if (fallback === undefined)
|
|
82
|
+
usable = false;
|
|
83
|
+
else
|
|
84
|
+
values.push(fallback);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (!usable)
|
|
88
|
+
continue;
|
|
89
|
+
const total = values.slice(0, -1).reduce((a, b) => a + b, 0);
|
|
90
|
+
const max = values[values.length - 1];
|
|
91
|
+
if (total > max) {
|
|
92
|
+
const sums = relation.sum.map((k, i) => `${k} (${values[i]})`).join(" + ");
|
|
93
|
+
out.push(`incoherent WebGL limits: ${set} ${sums} exceeds ${relation.max} (${max})`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=webgl-coherence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-coherence.js","sourceRoot":"","sources":["../src/webgl-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,MAAM,gBAAgB,GAAiB;IACrC,SAAS,EAAE;QACT,EAAE,GAAG,EAAE,CAAC,2BAA2B,EAAE,6BAA6B,CAAC,EAAE,GAAG,EAAE,6BAA6B,EAAE;QACzG,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,EAAE,GAAG,EAAE,6BAA6B,EAAE;QAC5E,EAAE,GAAG,EAAE,CAAC,gCAAgC,EAAE,yBAAyB,CAAC,EAAE,GAAG,EAAE,kCAAkC,EAAE;KAChH;IACD,QAAQ,EAAE;QACR,yBAAyB,EAAE,EAAE;QAC7B,2BAA2B,EAAE,EAAE;QAC/B,2BAA2B,EAAE,EAAE;QAC/B,2BAA2B,EAAE,EAAE;QAC/B,8BAA8B,EAAE,EAAE;QAClC,uBAAuB,EAAE,EAAE;QAC3B,gCAAgC,EAAE,EAAE;KACrC;CACF,CAAC;AAEF,qDAAqD;AACrD,MAAM,CAAC,MAAM,qBAAqB,GAA2C;IAC3E,kBAAkB,EAAE,gBAAgB;IACpC,gBAAgB,EAAE,gBAAgB;IAClC,gBAAgB,EAAE,gBAAgB;CACnC,CAAC;AAEF,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBA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,CAAC,KAAK,CAAC,CAAC;YAC3E,GAAG,CAAC,IAAI,CAAC,4BAA4B,GAAG,IAAI,IAAI,YAAY,QAAQ,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function webgpuArchitectureFor(renderer: string): string;
|
|
2
|
+
export interface WebgpuOverridePlan {
|
|
3
|
+
args: string[];
|
|
4
|
+
/** Set when WebGPU may not fully match the override (family unknown, or no architecture mapping). */
|
|
5
|
+
warning?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function webgpuOverridePlan(o: {
|
|
8
|
+
gpuVendor?: unknown;
|
|
9
|
+
gpuRenderer?: unknown;
|
|
10
|
+
fingerprintProfile?: unknown;
|
|
11
|
+
disableGpuFingerprint?: unknown;
|
|
12
|
+
gpuStringSpoof?: unknown;
|
|
13
|
+
}): WebgpuOverridePlan;
|
|
14
|
+
//# sourceMappingURL=webgpu-override.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-override.d.ts","sourceRoot":"","sources":["../src/webgpu-override.ts"],"names":[],"mappings":"AAiCA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAgBD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qGAAqG;IACrG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IACzE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC3D,GAAG,kBAAkB,CA8BrB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// A GPU override (gpuVendor / gpuRenderer) replaces only the WebGL strings in the engine. The WebGPU
|
|
2
|
+
// adapter (patch 075, gpu_adapter.cc) reads --fingerprint-webgpu-{vendor,architecture,device,
|
|
3
|
+
// description} when present, else the persona's own values, so without these flags WebGL can say
|
|
4
|
+
// Intel while navigator.gpu still says the persona's old AMD/NVIDIA GPU.
|
|
5
|
+
//
|
|
6
|
+
// Empty values: the adapter tests HasSwitch() first, so `--fingerprint-webgpu-architecture=` really
|
|
7
|
+
// yields an empty architecture (it does NOT fall back to the persona). Device and description are
|
|
8
|
+
// emptied the same way so the old GPU's strings cannot leak. (The persona derivation in patch 002
|
|
9
|
+
// does refill an empty persona.webgpu_architecture from the WebGL vendor, but the adapter never
|
|
10
|
+
// reads that value once the switch is present.)
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { gpuFamilies } from "./persona-profile-v2.js";
|
|
13
|
+
/** Renderer text -> WebGPU architecture. Spellings: `gen-9`, `gen-12-lp`, `turing`, `ampere` appear
|
|
14
|
+
* in this repo's persona data (schemas/fixtures, patches/075 + 002). `pascal`/`lovelace` (NVIDIA)
|
|
15
|
+
* and `gcn-4`/`rdna-1`/`rdna-2`/`rdna-3` (AMD) follow Dawn's gpu_info architecture naming; they are
|
|
16
|
+
* not in repo fixtures. Anything not matched is left empty rather than guessed. */
|
|
17
|
+
const ARCHITECTURES = [
|
|
18
|
+
[/\b(?:uhd|hd) graphics\s*[56]\d\d\b/i, "gen-9"],
|
|
19
|
+
[/\biris\W*(?:\(r\)\W*)?xe\b|\buhd graphics\s*7\d\d\b/i, "gen-12-lp"],
|
|
20
|
+
[/\bgtx\s*10\d\d\b/i, "pascal"],
|
|
21
|
+
[/\bgtx\s*16\d\d\b|\brtx\s*20\d\d\b/i, "turing"],
|
|
22
|
+
[/\brtx\s*30\d\d\b/i, "ampere"],
|
|
23
|
+
[/\brtx\s*40\d\d\b/i, "lovelace"],
|
|
24
|
+
[/\brx\s*[45]\d\d\b/i, "gcn-4"],
|
|
25
|
+
[/\brx\s*5\d{3}\b/i, "rdna-1"],
|
|
26
|
+
[/\brx\s*6\d{3}\b/i, "rdna-2"],
|
|
27
|
+
[/\brx\s*7\d{3}\b/i, "rdna-3"],
|
|
28
|
+
];
|
|
29
|
+
const SUPPORTED = new Set(["intel", "nvidia", "amd", "qualcomm"]);
|
|
30
|
+
export function webgpuArchitectureFor(renderer) {
|
|
31
|
+
return ARCHITECTURES.find(([re]) => re.test(renderer))?.[1] ?? "";
|
|
32
|
+
}
|
|
33
|
+
function profileWebgpuFamily(profile) {
|
|
34
|
+
let obj;
|
|
35
|
+
try {
|
|
36
|
+
obj = typeof profile === "object" ? profile : existsSync(String(profile)) ? JSON.parse(readFileSync(String(profile), "utf8")) : JSON.parse(String(profile));
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const g = obj?.graphics?.webgpu;
|
|
42
|
+
if (!g || typeof g !== "object")
|
|
43
|
+
return undefined;
|
|
44
|
+
const text = [g.vendor, g.architecture, g.device, g.description].filter((s) => typeof s === "string").join(" ");
|
|
45
|
+
const fams = gpuFamilies(text);
|
|
46
|
+
return fams.size === 1 ? [...fams][0] : undefined;
|
|
47
|
+
}
|
|
48
|
+
export function webgpuOverridePlan(o) {
|
|
49
|
+
const vendor = typeof o.gpuVendor === "string" ? o.gpuVendor : "";
|
|
50
|
+
const renderer = typeof o.gpuRenderer === "string" ? o.gpuRenderer : "";
|
|
51
|
+
if (!vendor && !renderer)
|
|
52
|
+
return { args: [] };
|
|
53
|
+
// The real GPU is presented (or the string spoof is off): the override is not applied at all.
|
|
54
|
+
if (o.disableGpuFingerprint === true || o.gpuStringSpoof === false)
|
|
55
|
+
return { args: [] };
|
|
56
|
+
const fams = gpuFamilies(`${vendor} ${renderer}`);
|
|
57
|
+
const family = fams.size === 1 ? [...fams][0] : undefined;
|
|
58
|
+
if (!family || !SUPPORTED.has(family)) {
|
|
59
|
+
return {
|
|
60
|
+
args: [],
|
|
61
|
+
warning: `Cannot tell which GPU family gpuVendor/gpuRenderer ('${vendor}' / '${renderer}') names, so WebGPU ` +
|
|
62
|
+
"(navigator.gpu) keeps the persona's own adapter and may contradict WebGL. Use a recognisable " +
|
|
63
|
+
"Intel/NVIDIA/AMD/Qualcomm renderer string.",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (o.fingerprintProfile !== undefined && profileWebgpuFamily(o.fingerprintProfile) === family)
|
|
67
|
+
return { args: [] };
|
|
68
|
+
const arch = webgpuArchitectureFor(renderer);
|
|
69
|
+
return {
|
|
70
|
+
// device/description are emptied so the previous GPU's strings cannot leak.
|
|
71
|
+
args: [
|
|
72
|
+
`--fingerprint-webgpu-vendor=${family}`,
|
|
73
|
+
`--fingerprint-webgpu-architecture=${arch}`,
|
|
74
|
+
"--fingerprint-webgpu-device=",
|
|
75
|
+
"--fingerprint-webgpu-description=",
|
|
76
|
+
],
|
|
77
|
+
warning: arch ? undefined :
|
|
78
|
+
`gpuRenderer '${renderer}' is not in the WebGPU architecture table: WebGPU vendor is set to '${family}' ` +
|
|
79
|
+
"but its architecture, device and description are empty, which a real adapter never reports.",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=webgpu-override.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-override.js","sourceRoot":"","sources":["../src/webgpu-override.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,8FAA8F;AAC9F,iGAAiG;AACjG,yEAAyE;AACzE,EAAE;AACF,oGAAoG;AACpG,kGAAkG;AAClG,kGAAkG;AAClG,gGAAgG;AAChG,gDAAgD;AAEhD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;mFAGmF;AACnF,MAAM,aAAa,GAAuB;I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AAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,OAAO;YACL,IAAI,EAAE,EAAE;YACR,OAAO,EAAE,wDAAwD,MAAM,QAAQ,QAAQ,sBAAsB;gBAC3G,+FAA+F;gBAC/F,4CAA4C;SAC/C,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,CAAC,kBAAkB,KAAK,SAAS,IAAI,mBAAmB,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACpH,MAAM,IAAI,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC7C,OAAO;QACL,4EAA4E;QAC5E,IAAI,EAAE;YACJ,+BAA+B,MAAM,EAAE;YACvC,qCAAqC,IAAI,EAAE;YAC3C,8BAA8B;YAC9B,mCAAmC;SACpC;QACD,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACzB,gBAAgB,QAAQ,uEAAuE,MAAM,IAAI;gBACzG,6FAA6F;KAChG,CAAC;AACJ,CAAC"}
|
package/dist/widevine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widevine.d.ts","sourceRoot":"","sources":["../src/widevine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"widevine.d.ts","sourceRoot":"","sources":["../src/widevine.ts"],"names":[],"mappings":"AAqBA,6FAA6F;AAC7F,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAClE,eAAO,MAAM,SAAS,uDAAuD,CAAC;AAC9E,eAAO,MAAM,SAAS,0CAA0C,CAAC;AAwBjE,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAUD,uGAAuG;AACvG,wBAAgB,gBAAgB,IAAI,OAAO,CAiB1C;AAgBD,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAe/D;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM7C;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC/E;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBnG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC1B,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,EACjD,QAAQ,EAAE,MAAM,EAAE,GACjB;IAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAevE"}
|
package/dist/widevine.js
CHANGED
|
@@ -16,6 +16,7 @@ import os from "node:os";
|
|
|
16
16
|
import path from "node:path";
|
|
17
17
|
import * as unzipper from "unzipper";
|
|
18
18
|
import { CHROMIUM_UA_VERSION } from "./chromium-version.js";
|
|
19
|
+
import { SdkError } from "./errors.js";
|
|
19
20
|
/** Chrome's component-updater app id for the Widevine CDM + Google's Omaha JSON endpoint. */
|
|
20
21
|
export const WIDEVINE_APP_ID = "oimompecagnajdejgnnjijobebaeigek";
|
|
21
22
|
export const OMAHA_URL = "https://update.googleapis.com/service/update2/json";
|
|
@@ -68,7 +69,7 @@ async function postJson(url, body) {
|
|
|
68
69
|
signal: AbortSignal.timeout(60_000),
|
|
69
70
|
});
|
|
70
71
|
if (!res.ok)
|
|
71
|
-
throw new
|
|
72
|
+
throw new SdkError("sdk.widevine_failed", `Widevine update check HTTP ${res.status}`);
|
|
72
73
|
let raw = await res.text();
|
|
73
74
|
if (raw.startsWith(")]}'"))
|
|
74
75
|
raw = raw.includes("\n") ? raw.slice(raw.indexOf("\n") + 1) : raw.slice(4); // strip XSSI guard
|
|
@@ -79,7 +80,7 @@ export function parseUpdate(resp) {
|
|
|
79
80
|
const app = resp?.response?.app?.[0];
|
|
80
81
|
const uc = app?.updatecheck;
|
|
81
82
|
if (!uc || uc.status !== "ok")
|
|
82
|
-
throw new
|
|
83
|
+
throw new SdkError("sdk.widevine_failed", `Widevine update check status: ${uc?.status}`);
|
|
83
84
|
for (const pl of uc.pipelines || []) {
|
|
84
85
|
for (const op of pl.operations || []) {
|
|
85
86
|
const urls = op.urls || [];
|
|
@@ -92,17 +93,17 @@ export function parseUpdate(resp) {
|
|
|
92
93
|
const pkg = uc.manifest?.packages?.package?.[0];
|
|
93
94
|
if (base && pkg?.name)
|
|
94
95
|
return [base.replace(/\/+$/, "") + "/" + pkg.name, pkg.hash_sha256 || "", uc.manifest?.version || ""];
|
|
95
|
-
throw new
|
|
96
|
+
throw new SdkError("sdk.widevine_failed", "could not find a CDM download URL in the update response");
|
|
96
97
|
}
|
|
97
98
|
/** A CRX3 file is 'Cr24' + u32 version + u32 headerLen + header + zip. Return the zip bytes. */
|
|
98
99
|
export function crx3ToZip(buf) {
|
|
99
100
|
if (buf.subarray(0, 4).toString("latin1") !== "Cr24")
|
|
100
101
|
return buf; // already a plain zip
|
|
101
102
|
if (buf.length < 12)
|
|
102
|
-
throw new
|
|
103
|
+
throw new SdkError("sdk.widevine_failed", "malformed CRX3 (truncated header)");
|
|
103
104
|
const headerLen = buf.readUInt32LE(8);
|
|
104
105
|
if (12 + headerLen > buf.length)
|
|
105
|
-
throw new
|
|
106
|
+
throw new SdkError("sdk.widevine_failed", "malformed CRX3 (header overruns buffer)");
|
|
106
107
|
return buf.subarray(12 + headerLen);
|
|
107
108
|
}
|
|
108
109
|
/**
|
|
@@ -123,17 +124,17 @@ export async function fetchWidevine(opts = {}) {
|
|
|
123
124
|
log(opts.quiet, `fetching CDM ${version || "(latest)"}`);
|
|
124
125
|
const res = await fetch(url, { headers: { "User-Agent": UA }, redirect: "follow", signal: AbortSignal.timeout(120_000) });
|
|
125
126
|
if (!res.ok)
|
|
126
|
-
throw new
|
|
127
|
+
throw new SdkError("sdk.widevine_failed", `Widevine CDM download HTTP ${res.status}`);
|
|
127
128
|
const blob = Buffer.from(await res.arrayBuffer());
|
|
128
129
|
// The CDM is a NATIVE DLL loaded into the browser process — never install it unverified. A
|
|
129
130
|
// missing hash in the update response is a hard failure, not a skip.
|
|
130
131
|
if (!sha256)
|
|
131
|
-
throw new
|
|
132
|
+
throw new SdkError("sdk.widevine_failed", "Widevine update response had no sha256 — refusing to install an unverified CDM");
|
|
132
133
|
if (createHash("sha256").update(blob).digest("hex") !== sha256.toLowerCase()) {
|
|
133
|
-
throw new
|
|
134
|
+
throw new SdkError("sdk.widevine_failed", "Widevine CDM sha256 mismatch — refusing to install");
|
|
134
135
|
}
|
|
135
136
|
mkdirSync(verDir, { recursive: true });
|
|
136
|
-
const tmp = mkdtempSync(path.join(os.tmpdir(), "
|
|
137
|
+
const tmp = mkdtempSync(path.join(os.tmpdir(), "ant0-wv-"));
|
|
137
138
|
const zipPath = path.join(tmp, "cdm.zip");
|
|
138
139
|
try {
|
|
139
140
|
writeFileSync(zipPath, crx3ToZip(blob));
|
|
@@ -144,7 +145,7 @@ export async function fetchWidevine(opts = {}) {
|
|
|
144
145
|
await rm(tmp, { recursive: true, force: true });
|
|
145
146
|
}
|
|
146
147
|
if (!existsSync(dll))
|
|
147
|
-
throw new
|
|
148
|
+
throw new SdkError("sdk.widevine_failed", `extracted CDM but ${filename} not at ${dll}`);
|
|
148
149
|
log(opts.quiet, `installed: ${verDir}`);
|
|
149
150
|
return verDir;
|
|
150
151
|
}
|