2023-05-21 15:54:20 +03:00
|
|
|
// reformat geo: links based on platform
|
2023-04-30 14:08:32 +03:00
|
|
|
const ua = String(platform.os).toLowerCase();
|
|
|
|
|
const android = ua.indexOf("android") > -1;
|
|
|
|
|
const ios = ua.indexOf("ios") > -1;
|
|
|
|
|
const windows = ua.indexOf("windows") > -1;
|
|
|
|
|
const linux = ua.indexOf("linux") > -1;
|
|
|
|
|
const mac = ua.indexOf("macos") > -1;
|
2023-05-01 22:59:40 +03:00
|
|
|
var hashlinks = document.querySelectorAll('[href*="geo:"]');
|
2023-05-01 21:58:23 +03:00
|
|
|
var hasharray = [...hashlinks];
|
|
|
|
|
if ( hasharray.length > 0 ) {
|
|
|
|
|
hasharray.forEach(hashlink => {
|
2023-05-01 22:59:40 +03:00
|
|
|
const geolink = hashlink.getAttribute("href").match(/(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)/g);
|
|
|
|
|
var latlon;
|
|
|
|
|
if ( geolink.length > 1 && geolink[0] == '0,0') latlon = geolink[1];
|
|
|
|
|
else latlon = geolink[0];
|
|
|
|
|
if ( windows || mac || linux ) hashlink.href = "https://maps.google.com/?q=" + latlon;
|
|
|
|
|
else if ( android ) hashlink.href = "geo:0,0?q=" + latlon;
|
|
|
|
|
else if ( ios ) hashlink.href = "http://maps.apple.com/?ll=" + latlon + "&q=" + hashlink.innerHTML;
|
2023-05-01 21:58:23 +03:00
|
|
|
});
|
2023-05-21 15:54:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fingerprint user
|
2023-05-21 16:02:53 +03:00
|
|
|
import { generateTheAudioFingerPrint } from './code/generateTheAudioPrints';
|
|
|
|
|
import { cyrb53 } from './code/EncryptDecrypt';
|
|
|
|
|
import { getCanvasFingerprint } from './code/GenerateCanvasFingerprint'
|
2023-05-21 15:54:20 +03:00
|
|
|
const getCurrentBrowserFingerPrint = () => {
|
|
|
|
|
const getTheAudioPrints = new Promise((resolve, reject) => {
|
2023-05-21 16:02:53 +03:00
|
|
|
generateTheAudioFingerPrint.run(function (fingerprint) {
|
2023-05-21 15:54:20 +03:00
|
|
|
resolve(fingerprint);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
const DevicePrints = new Promise((resolve, reject) => {
|
|
|
|
|
getTheAudioPrints.then((audioChannelResult) => {
|
2023-05-21 16:02:53 +03:00
|
|
|
let fingerprint = window.btoa(audioChannelResult) + (0, getCanvasFingerprint)();
|
|
|
|
|
resolve((0, cyrb53)(fingerprint, 0));
|
2023-05-21 15:54:20 +03:00
|
|
|
}).catch(() => {
|
|
|
|
|
try {
|
2023-05-21 16:02:53 +03:00
|
|
|
resolve((0, cyrb53)((0, getCanvasFingerprint)()).toString());
|
2023-05-21 15:54:20 +03:00
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
reject("Failed to generate the finger print of this browser");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return DevicePrints;
|
2023-05-21 16:02:53 +03:00
|
|
|
};
|