Fixed fingerprint functionality
This commit is contained in:
parent
213220e9fb
commit
54a363e4f0
3 changed files with 21 additions and 25 deletions
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
import { useState, useEffect } from 'react';
|
||||
import Block from './Block';
|
||||
import Table from './Table';
|
||||
|
|
@ -11,21 +10,19 @@ import {
|
|||
|
||||
const FingerprintBlock = ({ workerData }) => {
|
||||
const [signature, setSignature] = useState();
|
||||
const [load, setload] = useState(false);
|
||||
const hash = getHash(workerData);
|
||||
|
||||
useEffect(() => {
|
||||
if (signature) {
|
||||
postSignature(hash, signature);
|
||||
} else {
|
||||
getSignature(hash, setSignature);
|
||||
}
|
||||
}, [signature]);
|
||||
getSignature(hash, setSignature, setload);
|
||||
}, []);
|
||||
|
||||
const hash = getHash(workerData);
|
||||
return (
|
||||
<Block>
|
||||
<h1>Fingerprint</h1>
|
||||
{load && (
|
||||
<>
|
||||
{signature ? (
|
||||
{signature !== undefined ? (
|
||||
<div className="fingerprintTable">
|
||||
<Table data={getFingerprint(signature, hash)} />
|
||||
</div>
|
||||
|
|
@ -35,13 +32,14 @@ const FingerprintBlock = ({ workerData }) => {
|
|||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
<b>Explanation:</b> This is a unique identifier that can be used to
|
||||
follow you around the web. Even if you clear cookies, change your IP or
|
||||
use private mode the hash will stay the same. Enter your name below and
|
||||
reload the page in private mode to test it out.
|
||||
</p>
|
||||
<form onSubmit={(e) => setSignature(e.target[0].value)}>
|
||||
<form onSubmit={(e) => postSignature(hash, e.target[0].value)}>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
position: fixed;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgb(87, 35, 117);
|
||||
background: var(--grey);
|
||||
background: linear-gradient(
|
||||
165deg,
|
||||
rgba(87, 35, 117, 1) 0%,
|
||||
|
|
|
|||
|
|
@ -3,16 +3,14 @@ import md5 from 'crypto-js/md5';
|
|||
|
||||
export { getSignature, postSignature, getHash, getFingerprint };
|
||||
|
||||
const getSignature = (hash, setSignature) => {
|
||||
console.log('1');
|
||||
const getSignature = (hash, setSignature, setload) => {
|
||||
axios
|
||||
.get(`https://api.vytal.io/fingerprint/?hash=${hash}`)
|
||||
.then((response) => {
|
||||
console.log(response.data[response.data.length - 1]);
|
||||
|
||||
if (response.data.length !== 0) {
|
||||
setSignature(response.data[response.data.length - 1].name);
|
||||
}
|
||||
setload(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue