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 { useState, useEffect } from 'react';
|
||||||
import Block from './Block';
|
import Block from './Block';
|
||||||
import Table from './Table';
|
import Table from './Table';
|
||||||
|
|
@ -11,37 +10,36 @@ import {
|
||||||
|
|
||||||
const FingerprintBlock = ({ workerData }) => {
|
const FingerprintBlock = ({ workerData }) => {
|
||||||
const [signature, setSignature] = useState();
|
const [signature, setSignature] = useState();
|
||||||
|
const [load, setload] = useState(false);
|
||||||
|
const hash = getHash(workerData);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (signature) {
|
getSignature(hash, setSignature, setload);
|
||||||
postSignature(hash, signature);
|
}, []);
|
||||||
} else {
|
|
||||||
getSignature(hash, setSignature);
|
|
||||||
}
|
|
||||||
}, [signature]);
|
|
||||||
|
|
||||||
const hash = getHash(workerData);
|
|
||||||
return (
|
return (
|
||||||
<Block>
|
<Block>
|
||||||
<h1>Fingerprint</h1>
|
<h1>Fingerprint</h1>
|
||||||
<>
|
{load && (
|
||||||
{signature ? (
|
<>
|
||||||
<div className="fingerprintTable">
|
{signature !== undefined ? (
|
||||||
<Table data={getFingerprint(signature, hash)} />
|
<div className="fingerprintTable">
|
||||||
</div>
|
<Table data={getFingerprint(signature, hash)} />
|
||||||
) : (
|
</div>
|
||||||
<div className="boxWrap">
|
) : (
|
||||||
<div className="hash">{hash}</div>
|
<div className="boxWrap">
|
||||||
</div>
|
<div className="hash">{hash}</div>
|
||||||
)}
|
</div>
|
||||||
</>
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<p>
|
<p>
|
||||||
<b>Explanation:</b> This is a unique identifier that can be used to
|
<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
|
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
|
use private mode the hash will stay the same. Enter your name below and
|
||||||
reload the page in private mode to test it out.
|
reload the page in private mode to test it out.
|
||||||
</p>
|
</p>
|
||||||
<form onSubmit={(e) => setSignature(e.target[0].value)}>
|
<form onSubmit={(e) => postSignature(hash, e.target[0].value)}>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="name"
|
id="name"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: rgb(87, 35, 117);
|
background: var(--grey);
|
||||||
background: linear-gradient(
|
background: linear-gradient(
|
||||||
165deg,
|
165deg,
|
||||||
rgba(87, 35, 117, 1) 0%,
|
rgba(87, 35, 117, 1) 0%,
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,14 @@ import md5 from 'crypto-js/md5';
|
||||||
|
|
||||||
export { getSignature, postSignature, getHash, getFingerprint };
|
export { getSignature, postSignature, getHash, getFingerprint };
|
||||||
|
|
||||||
const getSignature = (hash, setSignature) => {
|
const getSignature = (hash, setSignature, setload) => {
|
||||||
console.log('1');
|
|
||||||
axios
|
axios
|
||||||
.get(`https://api.vytal.io/fingerprint/?hash=${hash}`)
|
.get(`https://api.vytal.io/fingerprint/?hash=${hash}`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response.data[response.data.length - 1]);
|
|
||||||
|
|
||||||
if (response.data.length !== 0) {
|
if (response.data.length !== 0) {
|
||||||
setSignature(response.data[response.data.length - 1].name);
|
setSignature(response.data[response.data.length - 1].name);
|
||||||
}
|
}
|
||||||
|
setload(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue