get-browser-fingerprint 2.1.1 → 3.0.0
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/.eslintrc +1 -4
- package/.github/workflows/commit.yml +2 -2
- package/package.json +5 -5
- package/src/index.js +3 -26
- package/src/index.spec.js +1 -0
- package/.babelrc +0 -1
- package/.jest-run/Template Jest.run.xml +0 -9
- package/jest.config.js +0 -7
- package/src/index.spec.js.bak +0 -34
package/.eslintrc
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-browser-fingerprint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"author": "Damiano Barbati <damiano.barbati@gmail.com> (https://github.com/damianobarbati)",
|
|
5
5
|
"repository": "https://github.com/damianobarbati/get-browser-fingerprint",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"eslint": "eslint --ignore-path .gitignore --fix",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "vitest run"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"eslint-config-xs": "^1.
|
|
14
|
+
"eslint-config-xs": "^1.6.2",
|
|
15
15
|
"http-server": "^14.1.1",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"puppeteer": "^19.8.0",
|
|
17
|
+
"vitest": "^0.29.7"
|
|
18
18
|
}
|
|
19
19
|
}
|
package/src/index.js
CHANGED
|
@@ -1,29 +1,11 @@
|
|
|
1
1
|
const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, debug = false } = {}) => {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const {
|
|
5
|
-
appName,
|
|
6
|
-
appCodeName,
|
|
7
|
-
appVersion,
|
|
8
|
-
cookieEnabled,
|
|
9
|
-
deviceMemory,
|
|
10
|
-
doNotTrack,
|
|
11
|
-
hardwareConcurrency,
|
|
12
|
-
language,
|
|
13
|
-
languages,
|
|
14
|
-
maxTouchPoints,
|
|
15
|
-
platform,
|
|
16
|
-
product,
|
|
17
|
-
productSub,
|
|
18
|
-
userAgent,
|
|
19
|
-
vendor,
|
|
20
|
-
vendorSub,
|
|
21
|
-
} = window.navigator;
|
|
2
|
+
const { cookieEnabled, deviceMemory, doNotTrack, hardwareConcurrency, language, languages, maxTouchPoints, platform, userAgent, vendor } = window.navigator;
|
|
22
3
|
|
|
23
4
|
const { width, height, colorDepth, pixelDepth } = window.screen;
|
|
24
5
|
const timezoneOffset = new Date().getTimezoneOffset();
|
|
25
6
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
26
7
|
const touchSupport = 'ontouchstart' in window;
|
|
8
|
+
const devicePixelRatio = window.devicePixelRatio;
|
|
27
9
|
|
|
28
10
|
const canvas = getCanvasID(debug);
|
|
29
11
|
const webgl = enableWebgl ? getWebglID(debug) : undefined; // undefined will remove this from the stringify down here
|
|
@@ -46,9 +28,6 @@ const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, debu
|
|
|
46
28
|
width,
|
|
47
29
|
})
|
|
48
30
|
: JSON.stringify({
|
|
49
|
-
appCodeName,
|
|
50
|
-
appName,
|
|
51
|
-
appVersion,
|
|
52
31
|
canvas,
|
|
53
32
|
colorDepth,
|
|
54
33
|
cookieEnabled,
|
|
@@ -62,14 +41,11 @@ const getBrowserFingerprint = ({ hardwareOnly = false, enableWebgl = false, debu
|
|
|
62
41
|
maxTouchPoints,
|
|
63
42
|
pixelDepth,
|
|
64
43
|
platform,
|
|
65
|
-
product,
|
|
66
|
-
productSub,
|
|
67
44
|
timezone,
|
|
68
45
|
timezoneOffset,
|
|
69
46
|
touchSupport,
|
|
70
47
|
userAgent,
|
|
71
48
|
vendor,
|
|
72
|
-
vendorSub,
|
|
73
49
|
webgl,
|
|
74
50
|
webglInfo,
|
|
75
51
|
width,
|
|
@@ -245,4 +221,5 @@ export const murmurhash3_32_gc = (key) => {
|
|
|
245
221
|
};
|
|
246
222
|
|
|
247
223
|
window.getBrowserFingerprint = getBrowserFingerprint;
|
|
224
|
+
|
|
248
225
|
export default getBrowserFingerprint;
|
package/src/index.spec.js
CHANGED
package/.babelrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<component name="ProjectRunConfigurationManager">
|
|
2
|
-
<configuration default="true" type="JavaScriptTestRunnerJest">
|
|
3
|
-
<node-interpreter value="project" />
|
|
4
|
-
<node-options value="--experimental-vm-modules" />
|
|
5
|
-
<working-dir value="" />
|
|
6
|
-
<scope-kind value="ALL" />
|
|
7
|
-
<method v="2" />
|
|
8
|
-
</configuration>
|
|
9
|
-
</component>
|
package/jest.config.js
DELETED
package/src/index.spec.js.bak
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { strict as assert } from 'assert';
|
|
2
|
-
import puppeteer from 'puppeteer';
|
|
3
|
-
|
|
4
|
-
const browser = await puppeteer.launch();
|
|
5
|
-
const page = await browser.newPage();
|
|
6
|
-
|
|
7
|
-
await page.addScriptTag({
|
|
8
|
-
type: 'module',
|
|
9
|
-
path: './src/index.js',
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
await (async () => {
|
|
13
|
-
const result = await page.evaluate(() => {
|
|
14
|
-
const result = getBrowserFingerprint();
|
|
15
|
-
return result;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
assert.deepStrictEqual(Number.isInteger(result), true, 'fingerprint is not an integer');
|
|
19
|
-
assert.deepStrictEqual(String(result).length > 7, true, 'fingerprint is not long enough');
|
|
20
|
-
})();
|
|
21
|
-
|
|
22
|
-
await (async () => {
|
|
23
|
-
const browser = await puppeteer.launch();
|
|
24
|
-
const page = await browser.newPage();
|
|
25
|
-
const result = await page.evaluate(() => {
|
|
26
|
-
const result = getBrowserFingerprint({ enableWebgl: true });
|
|
27
|
-
return result;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
assert.deepStrictEqual(Number.isInteger(result), true, 'fingerprint is not an integer');
|
|
31
|
-
assert.deepStrictEqual(String(result).length > 7, true, 'fingerprint is not long enough');
|
|
32
|
-
})();
|
|
33
|
-
|
|
34
|
-
await browser.close();
|