aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2021-02-27 16:01:48 +0100
committerstonedDiscord <Tukz@gmx.de>2021-02-27 16:01:48 +0100
commit354acf206f9a0b55af2e3489f90af480cb4d8fbf (patch)
tree117540a7232df6744134a9ae1dfc84c65ce8929a /webAO/client.js
parent98c4a7c116c0d03ab330af44d426215571ed9864 (diff)
Revert "remove old version of fpjs"
This reverts commit aaed93c94764e401bc45308bd1183824181c36cf.
Diffstat (limited to 'webAO/client.js')
-rw-r--r--webAO/client.js40
1 files changed, 27 insertions, 13 deletions
diff --git a/webAO/client.js b/webAO/client.js
index b854a1b..b0d0295 100644
--- a/webAO/client.js
+++ b/webAO/client.js
@@ -4,7 +4,7 @@
* credits to aleks for original idea and source
*/
-import FingerprintJS from '@fingerprintjs/fingerprintjs';
+import Fingerprint2 from 'fingerprintjs2';
import { escapeChat, encodeChat, prepChat, safe_tags } from './encoding.js';
@@ -60,20 +60,34 @@ let extrafeatures = [];
let hdid;
const options = { fonts: { extendedJsFonts: true, userDefinedFonts: ["Ace Attorney", "8bitoperator", "DINEngschrift"] }, excludes: { userAgent: true, enumerateDevices: true } };
-FingerprintJS.load().then(fp => {
- fp.get().then(result => {
- // Handle the result
- hdid = result.visitorId;
+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();
- 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();
+ });
+ });
+} 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);
+}
- 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);