Skip to content

Commit a6d186d

Browse files
committed
Revert "feat: richer fingerprint surface — hardware (cores/RAM/touch), display (pixelRatio/gamut/range/prefs), connection, storage quota, voices count, WebGL extensions count"
This reverts commit f96fe93.
1 parent f96fe93 commit a6d186d

5 files changed

Lines changed: 10 additions & 135 deletions

File tree

src/detect/collectors.js

Lines changed: 1 addition & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ export const collectWebglFingerprintInfo = () => {
248248
const version = gl.getParameter(gl.VERSION) || "N/A";
249249
const shadingLanguageVersion = gl.getParameter(gl.SHADING_LANGUAGE_VERSION) || "N/A";
250250

251-
const extensions = gl.getSupportedExtensions() || [];
252251
const fingerprintData = `${vendor} | ${renderer} | ${version} | ${shadingLanguageVersion}`;
253252
return {
254253
status: "ok",
@@ -257,7 +256,6 @@ export const collectWebglFingerprintInfo = () => {
257256
renderer,
258257
version,
259258
shadingLanguageVersion,
260-
extensionsCount: extensions.length,
261259
error: "",
262260
};
263261
} catch (error) {
@@ -430,72 +428,18 @@ export const collectWebRtcInfo = async () => {
430428
}
431429
};
432430

433-
export const collectFingerprintInfo = async () => {
431+
export const collectFingerprintInfo = () => {
434432
try {
435433
const screenInfo = {
436434
width: screen.width || 0,
437435
height: screen.height || 0,
438436
colorDepth: screen.colorDepth || 0,
439-
availWidth: screen.availWidth || 0,
440-
availHeight: screen.availHeight || 0,
441-
pixelRatio: window.devicePixelRatio || 1,
442-
orientation: screen.orientation?.type || "N/A",
443437
};
444438

445-
const hardware = {
446-
cores: navigator.hardwareConcurrency || 0,
447-
// @ts-expect-error deviceMemory 为非标准但 Chromium 支持的指纹面
448-
memory: navigator.deviceMemory || 0,
449-
maxTouchPoints: navigator.maxTouchPoints || 0,
450-
};
451-
452-
const media = (query) => (typeof matchMedia === "function" && matchMedia(query).matches) || false;
453-
const display = {
454-
colorGamut: media("(color-gamut: rec2020)") ? "rec2020" : media("(color-gamut: p3)") ? "p3" : "srgb",
455-
dynamicRange: media("(dynamic-range: high)") ? "high" : "standard",
456-
prefersColorScheme: media("(prefers-color-scheme: dark)") ? "dark" : "light",
457-
prefersReducedMotion: media("(prefers-reduced-motion: reduce)"),
458-
prefersContrast: media("(prefers-contrast: more)") ? "more" : "no-preference",
459-
};
460-
461-
// @ts-expect-error NetworkInformation 为非标准但 Chromium 支持
462-
const connection = navigator.connection
463-
? {
464-
// @ts-expect-error 同上
465-
effectiveType: navigator.connection.effectiveType || "N/A",
466-
// @ts-expect-error 同上
467-
downlink: navigator.connection.downlink ?? null,
468-
// @ts-expect-error 同上
469-
rtt: navigator.connection.rtt ?? null,
470-
// @ts-expect-error 同上
471-
saveData: !!navigator.connection.saveData,
472-
}
473-
: null;
474-
475-
let storage = null;
476-
if (navigator.storage?.estimate) {
477-
try {
478-
const estimate = await navigator.storage.estimate();
479-
storage = { quota: estimate.quota ?? 0, usage: estimate.usage ?? 0 };
480-
} catch (_error) {}
481-
}
482-
483-
let voices = null;
484-
if (typeof speechSynthesis !== "undefined") {
485-
try {
486-
voices = speechSynthesis.getVoices().length;
487-
} catch (_error) {}
488-
}
489-
490439
return {
491440
status: "ok",
492441
userAgent: navigator.userAgent || "N/A",
493442
screen: screenInfo,
494-
hardware,
495-
display,
496-
connection,
497-
storage,
498-
voices,
499443
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || "N/A",
500444
timezoneOffset: new Date().getTimezoneOffset(),
501445
error: "",
@@ -506,11 +450,6 @@ export const collectFingerprintInfo = async () => {
506450
status: "error",
507451
userAgent: "N/A",
508452
screen: { width: 0, height: 0, colorDepth: 0 },
509-
hardware: null,
510-
display: null,
511-
connection: null,
512-
storage: null,
513-
voices: null,
514453
timezone: "N/A",
515454
timezoneOffset: 0,
516455
error: error?.message || String(error),

src/detect/detect.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,18 @@ const runAllDetections = async () => {
6363

6464
const jsLanguageInfo = collectJsLanguageInfo();
6565
const intlInfo = collectIntlInfo();
66-
const fingerprintInfoPromise = collectFingerprintInfo();
66+
const fingerprintInfo = collectFingerprintInfo();
6767
const canvasFingerprintInfo = collectCanvasFingerprintInfo();
6868
const webglFingerprintInfo = collectWebglFingerprintInfo();
6969
const compatibilityInfoPromise = collectCompatibilityInfo();
7070

71-
const [extensionContext, headerInfo, webRtcInfo, audioFingerprintInfo, compatibilityInfo, fingerprintInfo] =
72-
await Promise.all([
73-
extensionContextPromise,
74-
headerInfoPromise,
75-
webRtcInfoPromise,
76-
audioFingerprintInfoPromise,
77-
compatibilityInfoPromise,
78-
fingerprintInfoPromise,
79-
]);
71+
const [extensionContext, headerInfo, webRtcInfo, audioFingerprintInfo, compatibilityInfo] = await Promise.all([
72+
extensionContextPromise,
73+
headerInfoPromise,
74+
webRtcInfoPromise,
75+
audioFingerprintInfoPromise,
76+
compatibilityInfoPromise,
77+
]);
8078

8179
renderHeaderInfo(headerInfo);
8280
renderJsLanguageInfo(jsLanguageInfo);

src/detect/renderers.js

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ export const renderWebglFingerprintInfo = (webglFingerprintInfo) => {
208208
addDetail(translateDetect("webgl_unmasked_renderer_label"), webglFingerprintInfo.renderer);
209209
addDetail(translateDetect("webgl_version_label"), webglFingerprintInfo.version);
210210
addDetail(translateDetect("webgl_shading_language_version_label"), webglFingerprintInfo.shadingLanguageVersion);
211-
addDetail(translateDetect("webgl_extensions_count_label"), String(webglFingerprintInfo.extensionsCount ?? 0));
212211

213212
const footerP = document.createElement("p");
214213
footerP.className = "mb-0 mt-2 small text-muted";
@@ -390,48 +389,9 @@ export const renderFingerprintInfo = (fingerprintInfo) => {
390389
addDetail(translateDetect("user_agent_label"), fingerprintInfo.userAgent, false, "", true);
391390
addDetail(
392391
translateDetect("screen_information_label"),
393-
`${fingerprintInfo.screen.width}x${fingerprintInfo.screen.height}x${fingerprintInfo.screen.colorDepth}` +
394-
` @${fingerprintInfo.screen.pixelRatio}x (${fingerprintInfo.screen.availWidth}x${fingerprintInfo.screen.availHeight}, ${fingerprintInfo.screen.orientation})`,
392+
`${fingerprintInfo.screen.width}x${fingerprintInfo.screen.height}x${fingerprintInfo.screen.colorDepth}`,
395393
true,
396394
);
397-
398-
if (fingerprintInfo.hardware) {
399-
const hw = fingerprintInfo.hardware;
400-
addDetail(
401-
translateDetect("hardware_info_label"),
402-
`${hw.cores} ${translateDetect("cores_unit")} / ${hw.memory || "?"} GB / ${translateDetect("touch_points_label")} ${hw.maxTouchPoints}`,
403-
true,
404-
);
405-
}
406-
407-
if (fingerprintInfo.display) {
408-
const d = fingerprintInfo.display;
409-
addDetail(
410-
translateDetect("display_caps_label"),
411-
`${d.colorGamut} / ${d.dynamicRange} / ${d.prefersColorScheme}${d.prefersReducedMotion ? " / reduced-motion" : ""}`,
412-
true,
413-
);
414-
}
415-
416-
if (fingerprintInfo.connection) {
417-
const c = fingerprintInfo.connection;
418-
addDetail(
419-
translateDetect("connection_label"),
420-
`${c.effectiveType} / ${c.downlink} Mbps / RTT ${c.rtt} ms${c.saveData ? " / save-data" : ""}`,
421-
true,
422-
);
423-
}
424-
425-
if (fingerprintInfo.storage) {
426-
const quotaGb = (fingerprintInfo.storage.quota / 1024 ** 3).toFixed(1);
427-
const usageMb = (fingerprintInfo.storage.usage / 1024 ** 2).toFixed(1);
428-
addDetail(translateDetect("storage_quota_label"), `${usageMb} MB / ${quotaGb} GB`, true);
429-
}
430-
431-
if (fingerprintInfo.voices !== null && fingerprintInfo.voices !== undefined) {
432-
addDetail(translateDetect("voices_label"), String(fingerprintInfo.voices), true);
433-
}
434-
435395
addDetail(
436396
translateDetect("timezone_label"),
437397
`${fingerprintInfo.timezone} (${translateDetect("offset_label")} ${fingerprintInfo.timezoneOffset})`,

src/detect/snapshot.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@ export const buildDetectionSnapshot = (results) => {
7676
browserFingerprint: {
7777
userAgent: results.fingerprintInfo.userAgent,
7878
screen: results.fingerprintInfo.screen,
79-
hardware: results.fingerprintInfo.hardware,
80-
display: results.fingerprintInfo.display,
81-
connection: results.fingerprintInfo.connection,
82-
storage: results.fingerprintInfo.storage,
83-
voices: results.fingerprintInfo.voices,
8479
timezone: results.fingerprintInfo.timezone,
8580
timezoneOffset: results.fingerprintInfo.timezoneOffset,
8681
},
@@ -97,7 +92,6 @@ export const buildDetectionSnapshot = (results) => {
9792
renderer: results.webglFingerprintInfo.renderer,
9893
version: results.webglFingerprintInfo.version,
9994
shadingLanguageVersion: results.webglFingerprintInfo.shadingLanguageVersion,
100-
extensionsCount: results.webglFingerprintInfo.extensionsCount,
10195
error: results.webglFingerprintInfo.error,
10296
},
10397
audio: {

src/i18n/detect-dict.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
const detectEn = {
2-
hardware_info_label: "Hardware",
3-
cores_unit: "cores",
4-
touch_points_label: "touch points",
5-
display_caps_label: "Display capabilities",
6-
connection_label: "Connection",
7-
storage_quota_label: "Storage usage / quota",
8-
voices_label: "Speech synthesis voices",
9-
webgl_extensions_count_label: "WebGL extensions",
102
ai_copy_tooltip: "Copy",
113
ai_copied_tooltip: "Copied",
124
theme_toggle: "Toggle Theme",
@@ -217,14 +209,6 @@ const detectEn = {
217209
};
218210

219211
const detectZh = {
220-
hardware_info_label: "硬件信息",
221-
cores_unit: "核",
222-
touch_points_label: "触点数",
223-
display_caps_label: "显示能力",
224-
connection_label: "网络连接",
225-
storage_quota_label: "存储用量 / 配额",
226-
voices_label: "语音合成声音数",
227-
webgl_extensions_count_label: "WebGL 扩展数量",
228212
ai_copy_tooltip: "复制",
229213
ai_copied_tooltip: "已复制",
230214
theme_toggle: "切换主题",

0 commit comments

Comments
 (0)