aboutsummaryrefslogtreecommitdiff
path: root/webAO/client.js
diff options
context:
space:
mode:
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);