Added issue detection to other block items
This commit is contained in:
parent
6f0f8bd8ee
commit
82b5a1c06e
4 changed files with 16 additions and 84 deletions
|
|
@ -44,7 +44,7 @@ const Blocks = () => {
|
|||
connectionData={connectionData}
|
||||
/>
|
||||
<ScreenBlock />
|
||||
<OtherBlock />
|
||||
<OtherBlock workerData={workerData} />
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
/* eslint-disable arrow-body-style */
|
||||
/* eslint-disable no-unused-vars */
|
||||
import { useState, useEffect } from 'react';
|
||||
import Block from './Block';
|
||||
import { detectTor } from './main';
|
||||
|
||||
const OtherBlock = () => {
|
||||
const [adBlockDetected, setAdBlockDetected] = useState(false);
|
||||
const [batteryLevel, setBatteryLevel] = useState();
|
||||
const [batteryStatus, setBatteryStatus] = useState();
|
||||
|
||||
useEffect(() => {
|
||||
fetch('https://www3.doubleclick.net', {
|
||||
method: 'HEAD',
|
||||
mode: 'no-cors',
|
||||
cache: 'no-store',
|
||||
}).catch(() => {
|
||||
setAdBlockDetected(true);
|
||||
});
|
||||
|
||||
navigator.getBattery().then((res) => {
|
||||
setBatteryLevel(`${Math.round(res.level * 100)}%`);
|
||||
setBatteryStatus(res.charging ? 'Charging' : 'Not charging');
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Block>
|
||||
<h1>Other</h1>
|
||||
<div className="tableWrap">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Brave browser</td>
|
||||
<td>{navigator.brave ? 'True' : 'False'}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Tor Browser</td>
|
||||
<td>{detectTor() ? 'True' : 'False'}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Adblock</td>
|
||||
<td>{adBlockDetected ? 'True' : 'False'}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Timezone offset</td>
|
||||
<td>{new Date().getTimezoneOffset()}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Battery level</td>
|
||||
<td>{batteryLevel}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Battery status</td>
|
||||
<td>{batteryStatus}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p>
|
||||
<b>Explanation:</b> JavaScript can be used to find information about
|
||||
your hardware. This information can be used to create a fingerprint.
|
||||
</p>
|
||||
</Block>
|
||||
);
|
||||
};
|
||||
export default OtherBlock;
|
||||
|
|
@ -5,7 +5,7 @@ import Block from './Block';
|
|||
import Table from './Table';
|
||||
import getOther from '../utils/other';
|
||||
|
||||
const OtherBlock = ({ workerAgent }) => {
|
||||
const OtherBlock = ({ workerData }) => {
|
||||
const [adBlock, setAdBlock] = useState();
|
||||
const [battery, setBattery] = useState();
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ const OtherBlock = ({ workerAgent }) => {
|
|||
<Block>
|
||||
<h1>Other</h1>
|
||||
{battery && adBlock !== undefined && (
|
||||
<Table data={getOther(battery, adBlock)} />
|
||||
<Table data={getOther(battery, adBlock, workerData)} />
|
||||
)}
|
||||
<p>
|
||||
<b>Explanation:</b> JavaScript can be used to find information about
|
||||
|
|
|
|||
|
|
@ -22,13 +22,13 @@ const checkDatePrototype = () => {
|
|||
};
|
||||
|
||||
// Returns object with location data
|
||||
const getOther = (battery, adBlock) => {
|
||||
const getOther = (battery, adBlock, workerData) => {
|
||||
const workerAgentParsed = 1;
|
||||
return [
|
||||
{
|
||||
key: 'Brave browser',
|
||||
value: navigator.brave ? 'True' : 'False',
|
||||
issues: [],
|
||||
issues: [checkWebWorker],
|
||||
},
|
||||
{
|
||||
key: 'Tor browser',
|
||||
|
|
@ -43,12 +43,21 @@ const getOther = (battery, adBlock) => {
|
|||
{
|
||||
key: 'Date',
|
||||
value: new Date().toString(),
|
||||
issues: [checkDatePrototype()],
|
||||
issues: [
|
||||
checkDatePrototype(),
|
||||
checkWebWorker(new Date().toString(), workerData.date),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Timezone offset',
|
||||
value: new Date().getTimezoneOffset(),
|
||||
issues: [checkDatePrototype()],
|
||||
issues: [
|
||||
checkDatePrototype(),
|
||||
checkWebWorker(
|
||||
new Date().getTimezoneOffset(),
|
||||
workerData.timezoneOffset
|
||||
),
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Battery level',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue