Added navigator file
This commit is contained in:
parent
87b02777e2
commit
539261dd8f
4 changed files with 72 additions and 0 deletions
30
frontend/src/components/NavigatorBlock.js
Normal file
30
frontend/src/components/NavigatorBlock.js
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
/* eslint-disable arrow-body-style */
|
||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import ScanBlock from './ScanBlock';
|
||||||
|
import NewTable from './NewTable';
|
||||||
|
import { getHardware, getWebGL, getBattery } from './main';
|
||||||
|
import { getNavigator } from './navigator';
|
||||||
|
|
||||||
|
const NavigatorBlock = () => {
|
||||||
|
// const [data, setData] = useState([]);
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// getBattery().then((batteryInfo) => {
|
||||||
|
// setData([...getHardware(), ...getWebGL(), ...batteryInfo]);
|
||||||
|
// });
|
||||||
|
// }, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScanBlock>
|
||||||
|
<h1>Hardware</h1>
|
||||||
|
<NewTable data={getNavigator()} />
|
||||||
|
<p>
|
||||||
|
<b>Explanation:</b> JavaScript can be used to find information about
|
||||||
|
your hardware. This information can be used to create a fingerprint.
|
||||||
|
</p>
|
||||||
|
</ScanBlock>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default NavigatorBlock;
|
||||||
17
frontend/src/components/NewTable.js
Normal file
17
frontend/src/components/NewTable.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
const Table = ({ data }) => (
|
||||||
|
<div className="tableWrap">
|
||||||
|
<table>
|
||||||
|
{data.map((item) => (
|
||||||
|
<tbody key={item.title}>
|
||||||
|
<tr>
|
||||||
|
<td>{item.title}</td>
|
||||||
|
<td>{item.value}</td>
|
||||||
|
<td>{item.test}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
))}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default Table;
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import NavigatorBlock from './NavigatorBlock';
|
||||||
import FingerprintBlock from './FingerprintBlock';
|
import FingerprintBlock from './FingerprintBlock';
|
||||||
import LocationBlock from './LocationBlock';
|
import LocationBlock from './LocationBlock';
|
||||||
import HardwareBlock from './HardwareBlock';
|
import HardwareBlock from './HardwareBlock';
|
||||||
|
|
@ -8,6 +9,7 @@ import FiltersBlock from './FiltersBlock';
|
||||||
|
|
||||||
const ScanBlocks = () => (
|
const ScanBlocks = () => (
|
||||||
<>
|
<>
|
||||||
|
<NavigatorBlock />
|
||||||
<FingerprintBlock />
|
<FingerprintBlock />
|
||||||
<LocationBlock />
|
<LocationBlock />
|
||||||
<ConnectionBlock />
|
<ConnectionBlock />
|
||||||
|
|
|
||||||
23
frontend/src/components/navigator.js
Normal file
23
frontend/src/components/navigator.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* eslint-disable import/prefer-default-export */
|
||||||
|
export { getNavigator };
|
||||||
|
|
||||||
|
const getNavigator = () => {
|
||||||
|
const data = [
|
||||||
|
{
|
||||||
|
key: 'deviceMemory',
|
||||||
|
title: 'Device memory',
|
||||||
|
value: navigator.deviceMemory ? `${navigator.deviceMemory}GB` : 'N/A',
|
||||||
|
test:
|
||||||
|
checkUndefinedProperties('deviceMemory') &&
|
||||||
|
'failed undefined properties',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkUndefinedProperties = (property) => {
|
||||||
|
if (Object.getOwnPropertyDescriptor(navigator, property) !== undefined) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
Loading…
Add table
Reference in a new issue