Added adblock error to location

This commit is contained in:
z0ccc 2021-07-24 00:48:33 -04:00
parent 83d864df32
commit 38401bf4c1
3 changed files with 22 additions and 11 deletions

View file

@ -65,7 +65,7 @@ const ConnectBlock = () => {
{display === 1 && <Table data={data} />} {display === 1 && <Table data={data} />}
{display === 0 && ( {display === 0 && (
<div className="boxWrap"> <div className="boxWrap">
Unable to load data. Adblock or content filter may have blocked data from loading. Unable to fetch info. Adblock or content filter may have prevented data from loading.
</div> </div>
)} )}
<p> <p>

View file

@ -4,14 +4,17 @@ import Table from './Table';
const LocationBlock = () => { const LocationBlock = () => {
const [locationData, setLocationData] = useState(''); const [locationData, setLocationData] = useState('');
const [display, setDisplay] = useState('none'); const [display, setDisplay] = useState('');
useEffect(() => { useEffect(() => {
fetch('http://ip-api.com/json') fetch('http://ip-api.com/json')
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
setLocationData(data); setLocationData(data);
setDisplay('block'); setDisplay(1);
})
.catch(() => {
setDisplay(0);
}); });
}, []); }, []);
@ -53,10 +56,18 @@ const LocationBlock = () => {
return ( return (
<ScanBlock> <ScanBlock>
<h1>Location</h1> <h1>Location</h1>
<div style={{ display }}> {display === 1 && (
<img src={mapUrl} alt="Map of current location" /> <>
<Table data={data} /> <img src={mapUrl} alt="Map of current location" />
</div> <Table data={data} />
</>
)}
{display === 0 && (
<div className="boxWrap">
Unable to fetch info. Adblock or content filter may have prevented
data from loading.
</div>
)}
<p> <p>
<b>Explanation:</b> Your IP address can be used to determine your <b>Explanation:</b> Your IP address can be used to determine your
location. Using a VPN or Tor will hide your true location. location. Using a VPN or Tor will hide your true location.

View file

@ -7,15 +7,15 @@ import FiltersBlock from './FiltersBlock';
// import FontsBlock from './FontsBlock'; // import FontsBlock from './FontsBlock';
const ScanBlocks = () => ( const ScanBlocks = () => (
<div> <>
<ConnectBlock />
<FingerprintBlock /> <FingerprintBlock />
<FiltersBlock />
<LocationBlock /> <LocationBlock />
<ConnectBlock />
<FiltersBlock />
<SoftwareBlock /> <SoftwareBlock />
<HardwareBlock /> <HardwareBlock />
{/* <FontsBlock /> */} {/* <FontsBlock /> */}
</div> </>
); );
export default ScanBlocks; export default ScanBlocks;