aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2021-02-23 20:48:58 +0100
committerstonedDiscord <Tukz@gmx.de>2021-02-23 20:48:58 +0100
commitaaed93c94764e401bc45308bd1183824181c36cf (patch)
tree71bf9e8b96ee23b06170081d369b75f593e85bad /webAO/client.js
parent6c1b16f78448d3eb4f73cf4cad2e613afb4af48d (diff)
remove old version of fpjs
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js40
1 files changed, 13 insertions, 27 deletions
diff --git a/webAO/client.js b/webAO/client.js
index 68101e2..59070b5 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 { escapeChat, encodeChat, prepChat, safe_tags } from './encoding.js';
@@ -60,34 +60,20 @@ let extrafeatures = [];
let hdid;
const options = { fonts: { extendedJsFonts: true, userDefinedFonts: ["Ace Attorney", "8bitoperator", "DINEngschrift"] }, excludes: { userAgent: true, enumerateDevices: true } };
-if (window.requestIdleCallback) {
- requestIdleCallback(function () {
- Fingerprint2.get(options, function (components) {
- hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31);
- client = new Client(serverIP);
- viewport = new Viewport();
+FingerprintJS.load().then(fp => {
+ fp.get().then(result => {
+ // Handle the result
+ hdid = result.visitorId;
- if (/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlayStation|Opera Mini/i.test(navigator.userAgent)) {
- oldLoading = true;
- }
- client.loadResources();
- });
- });
-} else {
- setTimeout(function () {
- Fingerprint2.get(options, function (components) {
- hdid = Fingerprint2.x64hash128(components.reduce((a, b) => `${a.value || a}, ${b.value}`), 31);
- client = new Client(serverIP);
- viewport = new Viewport();
-
- if (/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlayStation|Opera Mini/i.test(navigator.userAgent)) {
- oldLoading = true;
- }
- client.loadResources();
- });
- }, 500);
-}
+ client = new Client(serverIP);
+ viewport = new Viewport();
+ if (/webOS|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|PlayStation|Opera Mini/i.test(navigator.userAgent)) {
+ oldLoading = true;
+ }
+ client.loadResources();
+ })
+})
let lastICMessageTime = new Date(0);