fpscanner 0.9.4 → 0.9.5-beta.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/README.md +42 -15
- package/dist/detections/hasBotUserAgent.d.ts +3 -0
- package/dist/detections/hasBotUserAgent.d.ts.map +1 -0
- package/dist/detections/hasGPUMismatch.d.ts +3 -0
- package/dist/detections/hasGPUMismatch.d.ts.map +1 -0
- package/dist/detections/hasHeadlessChromeScreenResolution.d.ts.map +1 -1
- package/dist/detections/hasInconsistentEtsl.d.ts +3 -0
- package/dist/detections/hasInconsistentEtsl.d.ts.map +1 -0
- package/dist/detections/hasMismatchLanguages.d.ts +3 -0
- package/dist/detections/hasMismatchLanguages.d.ts.map +1 -0
- package/dist/detections/hasPlatformMismatch.d.ts +3 -0
- package/dist/detections/hasPlatformMismatch.d.ts.map +1 -0
- package/dist/fpScanner.cjs.js +2 -2
- package/dist/fpScanner.es.js +323 -223
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/signals/browserFeatures.d.ts +18 -0
- package/dist/signals/browserFeatures.d.ts.map +1 -1
- package/dist/signals/iframe.d.ts.map +1 -1
- package/dist/signals/worker.d.ts.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -4
- package/scripts/safe-publish.js +111 -0
- package/src/detections/hasBotUserAgent.ts +11 -0
- package/src/detections/hasGPUMismatch.ts +25 -0
- package/src/detections/hasHeadlessChromeScreenResolution.ts +0 -3
- package/src/detections/hasImpossibleDeviceMemory.ts +1 -1
- package/src/detections/hasInconsistentEtsl.ts +21 -0
- package/src/detections/hasMismatchLanguages.ts +13 -0
- package/src/detections/hasPlatformMismatch.ts +46 -0
- package/src/index.ts +48 -5
- package/src/signals/browserFeatures.ts +37 -11
- package/src/signals/iframe.ts +9 -1
- package/src/signals/worker.ts +31 -8
- package/src/types.ts +23 -0
package/src/signals/worker.ts
CHANGED
|
@@ -12,6 +12,16 @@ export async function worker() {
|
|
|
12
12
|
cpuCount: INIT,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
let worker: Worker | null = null;
|
|
16
|
+
let workerUrl: string | null = null;
|
|
17
|
+
let timeoutId: number | null = null;
|
|
18
|
+
|
|
19
|
+
const cleanup = () => {
|
|
20
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
21
|
+
if (worker) worker.terminate();
|
|
22
|
+
if (workerUrl) URL.revokeObjectURL(workerUrl);
|
|
23
|
+
};
|
|
24
|
+
|
|
15
25
|
try {
|
|
16
26
|
const workerCode = `try {
|
|
17
27
|
var fingerprintWorker = {};
|
|
@@ -47,8 +57,15 @@ export async function worker() {
|
|
|
47
57
|
|
|
48
58
|
|
|
49
59
|
const blob = new Blob([workerCode], { type: 'application/javascript' });
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
workerUrl = URL.createObjectURL(blob);
|
|
61
|
+
worker = new Worker(workerUrl);
|
|
62
|
+
|
|
63
|
+
// Set timeout to prevent infinite hang
|
|
64
|
+
timeoutId = window.setTimeout(() => {
|
|
65
|
+
cleanup();
|
|
66
|
+
setObjectValues(workerData, ERROR);
|
|
67
|
+
resolve(workerData);
|
|
68
|
+
}, 2000);
|
|
52
69
|
|
|
53
70
|
worker.onmessage = function (e) {
|
|
54
71
|
try {
|
|
@@ -59,17 +76,23 @@ export async function worker() {
|
|
|
59
76
|
workerData.platform = e.data.platform;
|
|
60
77
|
workerData.memory = e.data.memory;
|
|
61
78
|
workerData.cpuCount = e.data.cpuCount;
|
|
62
|
-
|
|
63
|
-
return resolve(workerData);
|
|
64
79
|
} catch (_) {
|
|
65
80
|
setObjectValues(workerData, ERROR);
|
|
66
|
-
|
|
81
|
+
} finally {
|
|
82
|
+
cleanup();
|
|
83
|
+
resolve(workerData);
|
|
67
84
|
}
|
|
68
|
-
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
worker.onerror = function () {
|
|
88
|
+
cleanup();
|
|
89
|
+
setObjectValues(workerData, ERROR);
|
|
90
|
+
resolve(workerData);
|
|
91
|
+
};
|
|
69
92
|
} catch (e) {
|
|
93
|
+
cleanup();
|
|
70
94
|
setObjectValues(workerData, ERROR);
|
|
71
|
-
|
|
72
|
-
return resolve(workerData);
|
|
95
|
+
resolve(workerData);
|
|
73
96
|
}
|
|
74
97
|
|
|
75
98
|
});
|
package/src/types.ts
CHANGED
|
@@ -73,6 +73,24 @@ export interface BrowserFeaturesSignal {
|
|
|
73
73
|
webAssembly: SignalValue<boolean>;
|
|
74
74
|
buffer: SignalValue<boolean>;
|
|
75
75
|
showModalDialog: SignalValue<boolean>;
|
|
76
|
+
safari: SignalValue<boolean>;
|
|
77
|
+
webkitPrefixedFunction: SignalValue<boolean>;
|
|
78
|
+
mozPrefixedFunction: SignalValue<boolean>;
|
|
79
|
+
usb: SignalValue<boolean>;
|
|
80
|
+
browserCapture: SignalValue<boolean>;
|
|
81
|
+
paymentRequestUpdateEvent: SignalValue<boolean>;
|
|
82
|
+
pressureObserver: SignalValue<boolean>;
|
|
83
|
+
audioSession: SignalValue<boolean>;
|
|
84
|
+
selectAudioOutput: SignalValue<boolean>;
|
|
85
|
+
barcodeDetector: SignalValue<boolean>;
|
|
86
|
+
battery: SignalValue<boolean>;
|
|
87
|
+
devicePosture: SignalValue<boolean>;
|
|
88
|
+
documentPictureInPicture: SignalValue<boolean>;
|
|
89
|
+
eyeDropper: SignalValue<boolean>;
|
|
90
|
+
editContext: SignalValue<boolean>;
|
|
91
|
+
fencedFrame: SignalValue<boolean>;
|
|
92
|
+
sanitizer: SignalValue<boolean>;
|
|
93
|
+
otpCredential: SignalValue<boolean>;
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
export interface MediaQueriesSignal {
|
|
@@ -205,6 +223,11 @@ export interface FastBotDetectionDetails {
|
|
|
205
223
|
hasMismatchPlatformWorker: DetectionRuleResult;
|
|
206
224
|
hasSwiftshaderRenderer: DetectionRuleResult;
|
|
207
225
|
hasUTCTimezone: DetectionRuleResult;
|
|
226
|
+
hasMismatchLanguages: DetectionRuleResult;
|
|
227
|
+
hasInconsistentEtsl: DetectionRuleResult;
|
|
228
|
+
hasBotUserAgent: DetectionRuleResult;
|
|
229
|
+
hasGPUMismatch: DetectionRuleResult;
|
|
230
|
+
hasPlatformMismatch: DetectionRuleResult;
|
|
208
231
|
}
|
|
209
232
|
export interface Fingerprint {
|
|
210
233
|
signals: FingerprintSignals;
|