Changeset 2866883
- Timestamp:
- 02/17/2023 08:48:14 AM (3 years ago)
- Location:
- viaads
- Files:
-
- 16 added
- 3 edited
-
tags/1.1.3 (added)
-
tags/1.1.3/apikey.php (added)
-
tags/1.1.3/externalJS.php (added)
-
tags/1.1.3/handleEmailGuid.php (added)
-
tags/1.1.3/hooks (added)
-
tags/1.1.3/hooks/addCart.php (added)
-
tags/1.1.3/hooks/orderHooks.php (added)
-
tags/1.1.3/hooks/pageLook.php (added)
-
tags/1.1.3/hooks/removeCart.php (added)
-
tags/1.1.3/http.php (added)
-
tags/1.1.3/js (added)
-
tags/1.1.3/js/viaads_handleEmailGuid.js (added)
-
tags/1.1.3/readme.txt (added)
-
tags/1.1.3/sync.php (added)
-
tags/1.1.3/userAgent.php (added)
-
tags/1.1.3/viaads.php (added)
-
trunk/js/viaads_handleEmailGuid.js (modified) (4 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/viaads.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
viaads/trunk/js/viaads_handleEmailGuid.js
r2866634 r2866883 2 2 3 3 if (window.location.search.includes("emailGuid=")) { 4 let emailGuidInterval =setInterval(function () {5 let cookieA ccept = getCookie("ViaAds");6 if (cookieA ccept != undefined) {4 setInterval(function () { 5 let cookieAaccept = getCookie("ViaAds"); 6 if (cookieAaccept != undefined) { 7 7 setDefaultCookie(); 8 8 //guid//email//emailGuid 9 var cookieValues = cookieA ccept.split("//");9 var cookieValues = cookieAaccept.split("//"); 10 10 var guid = cookieValues[0]; 11 if (guid == "") {11 if (guid == ""){ 12 12 guid = uuidv4(); 13 13 } 14 14 15 15 var mail = cookieValues[1]; 16 if (mail == "undefined") {16 if (mail == "undefined"){ 17 17 mail = ""; 18 18 } 19 19 20 20 document.cookie = "ViaAds=" + guid + "//" + mail + "//" + window.location.search.split("emailGuid=")[1] + "; max-age=34560000; path=/;"; 21 clearInterval(emailGuidInterval);22 21 } 23 22 }, 2000); … … 25 24 26 25 function setDefaultCookie() { 27 let cookieAccept = getCookie("via_ads"); 28 if (cookieAccept != undefined) { 29 let email = ""; 30 let eg = ""; 31 32 let oldCookie = getCookie("ViaAds"); 33 if (oldCookie != undefined) { 34 let cookieValues = oldCookie.split("//"); 35 email = cookieValues[1]; 36 eg = cookieValues[2]; 37 document.cookie = 'ViaAds=; Max-Age=0; Path=/;'; 38 } 39 40 //Basic cookie 41 let cookie = { 42 Consent: false, 43 Session: uuidv4(), 44 Email: email, 45 EG: eg, 46 FP: "", 47 FPU: "" 48 } 49 50 fingerPrint(cookie); 51 } else { 52 let cookie = JSON.parse(atob(cookieAccept)); 53 54 //Check time for last fingerPrint update 55 const date1Timestamp = cookie.FPU; 56 const date2Timestamp = new Date().getTime() / 1000; 57 const difference = date2Timestamp - date1Timestamp; 58 const differenceInDays = Math.abs(difference / (60 * 60 * 24)); 59 if (differenceInDays >= 3) { 60 fingerPrint(cookie); 61 //hashFingerPrint(fingerPrint(cookie)).then(r => {}); 26 let cookieAaccept = getCookie("ViaAds"); 27 if (cookieAaccept != undefined) { 28 if (cookieAaccept == "") { 29 document.cookie = "ViaAds=" + uuidv4() + "////; max-age=34560000; path=/;"; 62 30 } 63 31 } … … 67 35 const value = `; ${document.cookie}`; 68 36 const parts = value.split(`; ${name}=`); 69 if (parts.length === 2) return decodeURIComponent(parts.pop().split(';').shift());37 if (parts.length === 2) return parts.pop().split(';').shift(); 70 38 } 71 39 … … 75 43 ); 76 44 } 77 78 function fingerPrint(cookie) {79 let userAgent = navigator.userAgent;80 let platForm = window.navigator.platform;81 let cookieEnabled = window.navigator.cookieEnabled;82 let timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;83 let language = navigator.language;84 //Canvas85 let fonts = "";86 for (const font of document.fonts) {87 fonts += font.family;88 }89 let doNotTrack = window.navigator.doNotTrack;90 let vendor = window.navigator.vendor;91 let hardwareConcurrency = window.navigator.hardwareConcurrency;92 93 const audioContext = new (window.AudioContext || window.webkitAudioContext)();94 let audio = `${audioContext.destination.channelCount}|${audioContext.destination.channelCountMode}|${audioContext.destination.channelInterpretation}|${audioContext.destination.maxChannelCount}|95 ${audioContext.destination.numberOfInputs}|${audioContext.destination.numberOfOutputs}|${audioContext.sampleRate}|${audioContext.state}`;96 97 hashFingerPrint(`${userAgent}${platForm}${cookieEnabled}${timeZone}${language}${fonts}${doNotTrack}${vendor}${hardwareConcurrency}${audio}`).then(r => {98 cookie.FP = r;99 cookie.FPU = new Date().getTime() / 1000;100 console.log(cookie);101 document.cookie = "via_ads=" + btoa(JSON.stringify(cookie)) + "; max-age=34560000; path=/;";102 });103 104 }105 106 async function hashFingerPrint(message) {107 const msgUint8 = new TextEncoder().encode(message); // encode as (utf-8) Uint8Array108 const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); // hash the message109 const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array110 const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string111 return hashHex;112 }113 -
viaads/trunk/readme.txt
r2866634 r2866883 4 4 Requires at least: 5.4 5 5 Tested up to: 6.1 6 Stable tag: 1.1. 26 Stable tag: 1.1.3 7 7 Requires PHP: 7.0 8 8 License: GPLv3 -
viaads/trunk/viaads.php
r2866634 r2866883 3 3 * Plugin Name: ViaAds 4 4 * Description: Plugin der muliggør forbindelsen til ViaAds / Plug-in enabling the connection to ViaAds. 5 * Version: 1.1. 25 * Version: 1.1.3 6 6 * Author: ViaAds 7 7 * Author URI: https://www.viaads.dk/
Note: See TracChangeset
for help on using the changeset viewer.