Detects if there is a name before showing hash

This commit is contained in:
z0ccc 2021-08-26 14:18:05 -04:00
parent 783eee3799
commit e4072d5134
2 changed files with 14 additions and 8 deletions

View file

@ -13,12 +13,15 @@ import {
const FingerprintBlock = () => { const FingerprintBlock = () => {
const [name, setName] = useState(''); const [name, setName] = useState('');
const [load, setLoad] = useState(false);
const [saved, setSaved] = useState(''); const [saved, setSaved] = useState('');
const hash = getHash([...getHardware(), ...getWebGL(), ...getSoftware()]); const hash = getHash([...getHardware(), ...getWebGL(), ...getSoftware()]);
getName(hash, setName); getName(hash, setName, setLoad);
return ( return (
<ScanBlock> <ScanBlock>
<h1>Fingerprint</h1> <h1>Fingerprint</h1>
{load && (
<>
{name ? ( {name ? (
<Table data={getFingerprint(name, hash)} /> <Table data={getFingerprint(name, hash)} />
) : ( ) : (
@ -26,6 +29,8 @@ const FingerprintBlock = () => {
<div className="hash">{hash}</div> <div className="hash">{hash}</div>
</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

View file

@ -322,13 +322,14 @@ const getFingerprint = (name, hash) => {
const getHash = (data) => md5(JSON.stringify(data)).toString(); const getHash = (data) => md5(JSON.stringify(data)).toString();
const getName = (hash, setName) => { const getName = (hash, setName, setLoad) => {
axios axios
.get(`https://api.vytal.io/fingerprint/?hash=${hash}`) .get(`https://api.vytal.io/fingerprint/?hash=${hash}`)
.then((response) => { .then((response) => {
if (response.data.length !== 0) { if (response.data.length !== 0) {
setName(response.data[response.data.length - 1].name); setName(response.data[response.data.length - 1].name);
} }
setLoad(true);
}); });
}; };