diff options
| author | stonedDiscord <Tukz@gmx.de> | 2022-03-07 20:36:07 +0100 |
|---|---|---|
| committer | stonedDiscord <Tukz@gmx.de> | 2022-03-07 20:36:07 +0100 |
| commit | 1eacc38833b2ad0054f197d84f522c70119f9855 (patch) | |
| tree | 208d29c2f0a1817df837a81bdeeea69240a631ed /webAO/client.js | |
| parent | d2bdf2238606450256ce53ee35c5cd369bb4f5bd (diff) | |
update fingerprintjs for real
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/webAO/client.js b/webAO/client.js index 67a7af0..bd8710a 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -4,7 +4,7 @@ * credits to aleks for original idea and source */ -import Fingerprint2 from 'fingerprintjs2'; +import FingerprintJS from '@fingerprintjs/fingerprintjs' import { EventEmitter } from 'events'; import { @@ -65,29 +65,17 @@ function isLowMemory() { } } -if (window.requestIdleCallback) { - requestIdleCallback(() => { - Fingerprint2.get(options, (components) => { - hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31); +const fpPromise = FingerprintJS.load() +fpPromise + .then(fp => fp.get()) + .then(result => { + hdid = result.visitorId; client = new Client(serverIP); viewport = new Viewport(); isLowMemory(); client.loadResources(); - }); - }); -} else { - setTimeout(() => { - Fingerprint2.get(options, (components) => { - hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31); - client = new Client(serverIP); - viewport = new Viewport(); - - isLowMemory(); - client.loadResources(); - }); - }, 500); -} +}); let lastICMessageTime = new Date(0); |
