Remove whitlist code since its not actually possible (im dumb)
This commit is contained in:
parent
8095255186
commit
25633154ad
5 changed files with 16 additions and 229 deletions
|
|
@ -1,62 +0,0 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import { Box, Flex, Button } from 'theme-ui'
|
||||
import LocationInput from './LocationInput'
|
||||
import ConfigurationSelect from './ConfigurationSelect'
|
||||
import IPData from './IPData'
|
||||
import getIP from '../../utils/getIP'
|
||||
import { Power } from 'react-feather'
|
||||
|
||||
const LocationPage = () => {
|
||||
const [on, setOn] = useState(true)
|
||||
|
||||
// useEffect(() => {
|
||||
// chrome.storage.sync.get(['configuration', 'ipData'], (result) => {
|
||||
// result.configuration && setConfiguration(result.configuration)
|
||||
// if (result.ipData) {
|
||||
// setIP(result.ipData)
|
||||
// } else {
|
||||
// Promise.resolve(getIP()).then((ipData) => setIP(ipData))
|
||||
// }
|
||||
// })
|
||||
// }, [])
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
m: '12px',
|
||||
width: '100%',
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
sx={{ justifyContent: 'center', alignItems: 'center', height: '100%' }}
|
||||
>
|
||||
<Button
|
||||
variant="power"
|
||||
onClick={() => {
|
||||
setOn(!on)
|
||||
}}
|
||||
sx={{
|
||||
bg: on ? 'green' : 'red',
|
||||
'&:hover': {
|
||||
bg: on ? 'greenDark' : 'redDark',
|
||||
},
|
||||
transition: 'background 0.25s',
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
height: '108px',
|
||||
width: '100px',
|
||||
transform: on ? 'rotate(0deg)' : 'rotate(-180deg)',
|
||||
transition: 'transform 0.25s',
|
||||
}}
|
||||
>
|
||||
<Power size={100} />
|
||||
</Box>
|
||||
</Button>
|
||||
</Flex>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
export default LocationPage
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
import * as React from 'react'
|
||||
import Logo from '../../assets/img/logo.svg'
|
||||
import Link from '../../assets/img/link.svg'
|
||||
|
||||
const Navbar = () => (
|
||||
<div
|
||||
style={{
|
||||
width: '100%',
|
||||
boxSizing: 'border-box',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
padding: '8px 12px',
|
||||
backgroundColor: 'var(--navbar)',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={Logo}
|
||||
style={{
|
||||
width: '100px',
|
||||
height: '24px',
|
||||
}}
|
||||
alt="Vytal logo"
|
||||
/>
|
||||
<a
|
||||
href="https://vytal.io"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
style={{
|
||||
height: '18px',
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={Link}
|
||||
alt="Test on vytal.io"
|
||||
style={{
|
||||
width: '18px',
|
||||
height: '18px',
|
||||
}}
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default Navbar
|
||||
|
|
@ -1,21 +1,20 @@
|
|||
import React, { useState } from 'react'
|
||||
import { ThemeProvider, Flex } from 'theme-ui'
|
||||
import { ThemeProvider, Flex, Box } from 'theme-ui'
|
||||
import { theme } from '../../theme'
|
||||
import { Home, MapPin, Globe, Command, List, ExternalLink } from 'react-feather'
|
||||
import { MapPin, Globe, ExternalLink } from 'react-feather'
|
||||
import TabItem from './TabItem'
|
||||
import LocationPage from './LocationPage'
|
||||
import UserAgentPage from './UserAgentPage'
|
||||
import WhitelistPage from './WhitelistPage'
|
||||
|
||||
const Popup = () => {
|
||||
const [tab, setTab] = useState('whitelist')
|
||||
const [tab, setTab] = useState('location')
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<Flex
|
||||
sx={{
|
||||
width: '350px',
|
||||
height: '368px',
|
||||
height: '390px',
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
|
|
@ -26,7 +25,6 @@ const Popup = () => {
|
|||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
{/* <TabItem Icon={Home} onClick={() => setTab(0)} /> */}
|
||||
<TabItem
|
||||
Icon={MapPin}
|
||||
active={tab === 'location'}
|
||||
|
|
@ -37,20 +35,23 @@ const Popup = () => {
|
|||
active={tab === 'useragent'}
|
||||
onClick={() => setTab('useragent')}
|
||||
/>
|
||||
{/* <TabItem Icon={Command} onClick={() => setTab(3)} /> */}
|
||||
<TabItem
|
||||
Icon={List}
|
||||
active={tab === 'whitelist'}
|
||||
onClick={() => setTab('whitelist')}
|
||||
/>
|
||||
<TabItem
|
||||
Icon={ExternalLink}
|
||||
onClick={() => window.open('https://vytal.io')}
|
||||
/>
|
||||
</Flex>
|
||||
<LocationPage tab={tab} />
|
||||
<UserAgentPage tab={tab} />
|
||||
<WhitelistPage tab={tab} />
|
||||
<Box>
|
||||
<LocationPage tab={tab} />
|
||||
<UserAgentPage tab={tab} />
|
||||
<div
|
||||
style={{
|
||||
margin: '8px 0 0 0',
|
||||
fontSize: '11px',
|
||||
}}
|
||||
>
|
||||
Current tab won't be fully spoofed until after reload
|
||||
</div>
|
||||
</Box>
|
||||
</Flex>
|
||||
</ThemeProvider>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,89 +0,0 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import { Box, Input, Flex, Button, Close } from 'theme-ui'
|
||||
|
||||
const WhitelistPage = ({ tab }: any) => {
|
||||
const [currentUrl, setCurrentUrl] = useState('')
|
||||
const [whitelist, setWhitelist] = useState<string[]>([])
|
||||
|
||||
const getCurrentUrl = async () => {
|
||||
const queryOptions = { active: true, lastFocusedWindow: true }
|
||||
const [tab] = await chrome.tabs.query(queryOptions)
|
||||
if (tab.url) {
|
||||
const domain = new URL(tab.url)
|
||||
const hostname = domain.hostname.replace('www.', '')
|
||||
if (hostname.includes('.')) {
|
||||
setCurrentUrl(hostname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
getCurrentUrl()
|
||||
chrome.storage.sync.get(['whitelist'], (result) => {
|
||||
result.whitelist && setWhitelist(result.whitelist)
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
chrome.storage.sync.set({ whitelist })
|
||||
}, [whitelist])
|
||||
|
||||
const handleSubmit = (e: any) => {
|
||||
e.preventDefault()
|
||||
!whitelist.includes(e.target.url.value) &&
|
||||
setWhitelist((prevWhitelist) => [...prevWhitelist, e.target.url.value])
|
||||
// detachDebugger()
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
m: '12px',
|
||||
width: '100%',
|
||||
display: tab === 'whitelist' ? 'block' : 'none',
|
||||
}}
|
||||
>
|
||||
<Box sx={{ fontSize: '20px', mb: '12px' }}>Whitelist</Box>
|
||||
<Flex as="form" onSubmit={(e) => handleSubmit(e)}>
|
||||
<Input name="url" defaultValue={currentUrl} spellCheck="false" />
|
||||
<Button sx={{ height: '28px', flexShrink: 0, ml: '8px' }}>Add</Button>
|
||||
</Flex>
|
||||
{whitelist.length ? (
|
||||
<Box
|
||||
sx={{
|
||||
border: '1px solid ',
|
||||
borderRadius: '4px',
|
||||
borderColor: 'grey',
|
||||
p: '2px 8px',
|
||||
my: '8px',
|
||||
maxHeight: '260px',
|
||||
overflow: 'auto',
|
||||
}}
|
||||
>
|
||||
{whitelist.map((element, index) => {
|
||||
return (
|
||||
<Flex
|
||||
key={index}
|
||||
sx={{
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
my: '8px',
|
||||
}}
|
||||
>
|
||||
{element}{' '}
|
||||
<Close
|
||||
sx={{ width: '24px', height: '24px' }}
|
||||
onClick={() =>
|
||||
setWhitelist(whitelist.filter((item) => item !== element))
|
||||
}
|
||||
/>
|
||||
</Flex>
|
||||
)
|
||||
})}
|
||||
</Box>
|
||||
) : null}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
export default WhitelistPage
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
const userAgents = [
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36',
|
||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.50',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36 Edg/100.0.1185.44',
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36 Edg/101.0.1210.32',
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36',
|
||||
]
|
||||
|
||||
export default userAgents
|
||||
Loading…
Add table
Reference in a new issue