From 90cad36930bcac2d5e6aabcc7898466b64d0ec05 Mon Sep 17 00:00:00 2001 From: z0ccc Date: Mon, 23 Aug 2021 20:31:52 -0400 Subject: [PATCH] Added main file for functions --- README.md | 4 +- frontend/src/components/FingerprintBlock.js | 12 +++--- frontend/src/components/MainColumn.js | 6 +-- frontend/src/components/StartBlock.js | 43 +++++++++------------ frontend/src/components/main.js | 5 +++ 5 files changed, 32 insertions(+), 38 deletions(-) create mode 100644 frontend/src/components/main.js diff --git a/README.md b/README.md index 8b0bd7a..5d35e3f 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,14 @@ Check it out at https://vytal.io # Dev -Backend setup: +Backend Django setup: ``` cd backend python manage.py runserver ``` -Frontend setup: +Frontend React setup: ``` cd frontend diff --git a/frontend/src/components/FingerprintBlock.js b/frontend/src/components/FingerprintBlock.js index 8c8cfaf..15e3b5a 100644 --- a/frontend/src/components/FingerprintBlock.js +++ b/frontend/src/components/FingerprintBlock.js @@ -11,7 +11,7 @@ const FingerprintBlock = () => { useEffect(() => { axios - .get(`http://localhost:8000/fingerprint/?hash=${hash}`) + .get(`https://api.vytal.io/fingerprint/?hash=${hash}`) .then((response) => { if (response.data.length !== 0) { setName(response.data[response.data.length - 1].name); @@ -22,7 +22,7 @@ const FingerprintBlock = () => { const handleSave = (e) => { e.preventDefault(); - axios.post('http://localhost:8000/fingerprint/', { + axios.post('https://api.vytal.io/fingerprint/', { name: e.target[0].value, hash, }); @@ -134,10 +134,10 @@ const FingerprintBlock = () => { )}

- Explanation: This is a unique identifier that can be - used to 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 reload the page in private mode to test it out. + Explanation: This is a unique identifier that can be used to + 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 + reload the page in private mode to test it out.

{saved ? (

Success! Re-scan browser.

diff --git a/frontend/src/components/MainColumn.js b/frontend/src/components/MainColumn.js index 2f612a0..d06c105 100644 --- a/frontend/src/components/MainColumn.js +++ b/frontend/src/components/MainColumn.js @@ -9,11 +9,7 @@ const MainColumn = () => {
- {scan ? ( - - ) : ( - - )} + {scan ? : }
); diff --git a/frontend/src/components/StartBlock.js b/frontend/src/components/StartBlock.js index 1605dda..08db904 100644 --- a/frontend/src/components/StartBlock.js +++ b/frontend/src/components/StartBlock.js @@ -1,4 +1,3 @@ -import { useCallback } from 'react'; import ContentList from './ContentList'; import ScanBlock from './ScanBlock'; @@ -16,32 +15,26 @@ const contentItems = [ { title: 'System Info', icon: 'browser', - body: 'JavaScript can be used to find data about your computer\'s software and hardware. This information can be used to create a fingerprint.', + body: "JavaScript can be used to find data about your computer's software and hardware. This information can be used to create a fingerprint.", }, ]; -const StartBlock = ({ onScanClick }) => { - const startScan = useCallback(() => { - onScanClick(true); - }, [onScanClick]); - - return ( - -

About

-
- Vytal shows you what traces your browser leaves behind while surfing the - web. This scan allows you to understand how easy it is to identify and - track your browser even while using private mode. -
- - -
- ); -}; +const StartBlock = ({ setScan }) => ( + +

About

+
+ Vytal shows you what traces your browser leaves behind while surfing the + web. This scan allows you to understand how easy it is to identify and + track your browser even while using private mode. +
+ + setScan(true)} + id="scanButton" + value="Scan Browser" + /> +
+); export default StartBlock; diff --git a/frontend/src/components/main.js b/frontend/src/components/main.js new file mode 100644 index 0000000..c544cdc --- /dev/null +++ b/frontend/src/components/main.js @@ -0,0 +1,5 @@ +import md5 from 'crypto-js/md5'; + +const getHash = (data) => md5(JSON.stringify(data)).toString(); + +export { getHash as default };