diff --git a/web/nfc-theme/static/geo.js b/web/nfc-theme/static/geo.js index 469ac2e..09657f9 100644 --- a/web/nfc-theme/static/geo.js +++ b/web/nfc-theme/static/geo.js @@ -90,7 +90,28 @@ function getFingerprint() { return hash; }; +const generateUUID = () => { + let + d = new Date().getTime(), + d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { + let r = Math.random() * 16; + if (d > 0) { + r = (d + r) % 16 | 0; + d = Math.floor(d / 16); + } else { + r = (d2 + r) % 16 | 0; + d2 = Math.floor(d2 / 16); + } + return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16); + }); + }; + +if ( !Cookies.get('nfcexplorer') ) { + Cookies.set('nfcexplorer', generateUUID) +} + fetch('https://nmns.place/track?' + new URLSearchParams({ - hash: getFingerprint(), + hash: Cookies.get('nfcexplorer'), ua: ua, })); \ No newline at end of file diff --git a/web/nfc-theme/templates/base.html b/web/nfc-theme/templates/base.html index 7881858..bba59ae 100644 --- a/web/nfc-theme/templates/base.html +++ b/web/nfc-theme/templates/base.html @@ -22,5 +22,6 @@ {% endif %} +