This commit is contained in:
z0ccc 2022-11-07 11:08:40 -05:00
parent 0f9706dd60
commit 4f663f8868
11 changed files with 96 additions and 77 deletions

View file

@ -1,25 +1,29 @@
import { Link, Text } from 'theme-ui' import { Link } from 'theme-ui'
interface FooterLinkProps { const FooterLink = () => {
link: string
text: string
hoverText: string
}
const FooterLink = ({ link, text, hoverText }: FooterLinkProps) => {
return ( return (
<Link variant="footer" href={`https://vytal.io/${link}`} target="_blank"> <Link
{text}{' '} variant="footer"
<Text href={`https://go.nordvpn.net/aff_c?offer_id=15&aff_id=79520&url_id=902`}
sx={{ target="_blank"
color: 'primaryDark', >
':hover': { Vytal does not change your IP address. To change your IP you will need to
textDecoration: 'underline', use a VPN such as{' '}
}, <Link
}} variant="hover"
href={`https://go.nordvpn.net/aff_c?offer_id=15&aff_id=79520&url_id=902`}
target="_blank"
> >
{hoverText} NordVPN
</Text> </Link>{' '}
or{' '}
<Link
variant="hover"
href={`https://go.getproton.me/aff_c?offer_id=26&aff_id=3825`}
target="_blank"
>
ProtonVPN
</Link>
</Link> </Link>
) )
} }

View file

@ -9,7 +9,8 @@ const Table = ({ children }: TableProps) => {
<Box <Box
sx={{ sx={{
border: '1px solid', border: '1px solid',
mb: '12px', mt: '12px',
mb: '8px',
borderRadius: '4px', borderRadius: '4px',
borderColor: 'grey', borderColor: 'grey',
}} }}

View file

@ -14,7 +14,7 @@ const TableRow = ({ title, value, noBorder = false }: TableRowProps) => {
borderBottomColor: 'grey', borderBottomColor: 'grey',
}} }}
> >
<td sx={{ fontWeight: '700', width: '100px', p: '8px' }}>{title}</td> <td sx={{ fontWeight: '700', width: '100px', p: '5px 8px' }}>{title}</td>
<td> <td>
<Box <Box
sx={{ sx={{

View file

@ -140,7 +140,6 @@ const AutofillPage = ({ tab, autofillData }: AutofillPageProps) => {
> >
Autofill Current Page Autofill Current Page
</Button> </Button>
<FooterLink link="test" text="Test" hoverText="autofill data" />
</Page> </Page>
) )
} }

View file

@ -48,11 +48,6 @@ const ConnectionPage = ({ tab, ipData }: ConnectionPageProps) => {
noBorder noBorder
/> />
</Table> </Table>
<FooterLink
link="test"
text="Connection info can be changed by using a"
hoverText="VPN or proxy"
/>
</Page> </Page>
) )
} }

View file

@ -6,17 +6,18 @@ import detachDebugger from '../../../utils/detachDebugger'
import countryLocales from '../../../utils/countryLocales' import countryLocales from '../../../utils/countryLocales'
import { ipData } from '../../../types' import { ipData } from '../../../types'
import configurations from '../../../utils/configurations' import configurations from '../../../utils/configurations'
import CheckBox from '../../Components/CheckBox'
import FooterLink from '../../Components/FooterLink' import FooterLink from '../../Components/FooterLink'
import Table from '../../Components/Table'
import TableRow from '../../Components/TableRow'
interface SystemPageProps { interface LocationPageProps {
tab: string tab: string
ipData?: ipData ipData?: ipData
geolocation?: GeolocationCoordinates geolocation?: GeolocationCoordinates
} }
const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => { const LocationPage = ({ tab, ipData, geolocation }: LocationPageProps) => {
const [systemType, setSystemType] = useState('') const [locationType, setLocationType] = useState('')
const [timezone, setTimezone] = useState('') const [timezone, setTimezone] = useState('')
const [locale, setLocale] = useState('') const [locale, setLocale] = useState('')
const [lat, setLatitude] = useState('') const [lat, setLatitude] = useState('')
@ -27,9 +28,9 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
useEffect(() => { useEffect(() => {
chrome.storage.local.get( chrome.storage.local.get(
['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'], ['locationType', 'configuration', 'timezone', 'locale', 'lat', 'lon'],
(storage) => { (storage) => {
if (!storage.systemType || storage.systemType === 'default') { if (!storage.locationType || storage.locationType === 'default') {
setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone) setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone)
setLocale(Intl.DateTimeFormat().resolvedOptions().locale) setLocale(Intl.DateTimeFormat().resolvedOptions().locale)
if (geolocation) { if (geolocation) {
@ -37,7 +38,7 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
setLongitude(`${geolocation.longitude}`) setLongitude(`${geolocation.longitude}`)
} }
} }
if (storage.systemType === 'matchIp' && ipData) { if (storage.locationType === 'matchIp' && ipData) {
setTimezone(ipData.timezone) setTimezone(ipData.timezone)
setLocale(countryLocales[ipData.countryCode].locale) setLocale(countryLocales[ipData.countryCode].locale)
setLatitude(`${ipData.lat}`) setLatitude(`${ipData.lat}`)
@ -48,24 +49,24 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
lat: ipData.lat, lat: ipData.lat,
lon: ipData.lon, lon: ipData.lon,
}) })
} else if (storage.systemType === 'custom') { } else if (storage.locationType === 'custom') {
storage.configuration && setConfiguration(storage.configuration) storage.configuration && setConfiguration(storage.configuration)
storage.timezone && setTimezone(storage.timezone) storage.timezone && setTimezone(storage.timezone)
storage.locale && setLocale(storage.locale) storage.locale && setLocale(storage.locale)
storage.lat && setLatitude(storage.lat) storage.lat && setLatitude(storage.lat)
storage.lon && setLongitude(storage.lon) storage.lon && setLongitude(storage.lon)
} }
storage.systemType storage.locationType
? setSystemType(storage.systemType) ? setLocationType(storage.locationType)
: setSystemType('default') : setLocationType('default')
} }
) )
}, [geolocation, ipData]) }, [geolocation, ipData])
const changeType = (e: ChangeEvent<HTMLInputElement>) => { const changeType = (e: ChangeEvent<HTMLInputElement>) => {
detachDebugger() detachDebugger()
setSystemType(e.target.value) setLocationType(e.target.value)
chrome.storage.local.set({ systemType: e.target.value }) chrome.storage.local.set({ locationType: e.target.value })
if (e.target.value === 'default') { if (e.target.value === 'default') {
setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone) setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone)
@ -129,18 +130,26 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
} }
const changeInputText = () => { const changeInputText = () => {
if (systemType !== 'custom' || configuration !== 'custom') { if (locationType !== 'custom' || configuration !== 'custom') {
setConfiguration('custom') setConfiguration('custom')
setSystemType('custom') setLocationType('custom')
chrome.storage.local.set({ chrome.storage.local.set({
configuration: 'custom', configuration: 'custom',
systemType: 'custom', locationType: 'custom',
}) })
} }
} }
const getFlagEmoji = (countryCode: string) => {
const codePoints = countryCode
.toUpperCase()
.split('')
.map((char) => 127397 + char.charCodeAt(0))
return String.fromCodePoint(...codePoints)
}
return ( return (
<Page isCurrentTab={tab === 'system'} title={'System Data'}> <Page isCurrentTab={tab === 'location'} title={'Location Data'}>
<Flex <Flex
sx={{ sx={{
justifyContent: 'space-between', justifyContent: 'space-between',
@ -149,33 +158,46 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
> >
<Label> <Label>
<Radio <Radio
name="systemType" name="locationType"
value="default" value="default"
onChange={changeType} onChange={changeType}
checked={systemType === 'default'} checked={locationType === 'default'}
/> />
Default Default
</Label> </Label>
<Label> <Label>
<Radio <Radio
name="systemType" name="locationType"
value="matchIp" value="matchIp"
onChange={changeType} onChange={changeType}
checked={systemType === 'matchIp'} checked={locationType === 'matchIp'}
/> />
Match IP Match IP
</Label> </Label>
<Label> <Label>
<Radio <Radio
name="systemType" name="locationType"
value="custom" value="custom"
onChange={changeType} onChange={changeType}
checked={systemType === 'custom'} checked={locationType === 'custom'}
/> />
Custom Custom
</Label> </Label>
</Flex> </Flex>
{systemType === 'custom' && ( {locationType === 'matchIp' && (
<Table>
<TableRow
title="IP Address"
value={
ipData
? `${getFlagEmoji(ipData.countryCode)} ${ipData?.query}`
: 'loading...'
}
noBorder
/>
</Table>
)}
{locationType === 'custom' && (
<> <>
<Label htmlFor="configuration">Configuration</Label> <Label htmlFor="configuration">Configuration</Label>
<Select <Select
@ -222,12 +244,9 @@ const SystemPage = ({ tab, ipData, geolocation }: SystemPageProps) => {
onChange={changeInputText} onChange={changeInputText}
mb="12px" mb="12px"
/> />
{systemType !== 'default' && ( <FooterLink />
<CheckBox title={'Enable Debugger API Spoofing'} />
)}
<FooterLink link="test" text="Test with" hoverText="system data scan" />
</Page> </Page>
) )
} }
export default SystemPage export default LocationPage

View file

@ -3,9 +3,7 @@ import { Box, Label, Radio, Flex, Select } from 'theme-ui'
import DebouncedInput from '../../Components/DebouncedInput' import DebouncedInput from '../../Components/DebouncedInput'
import userAgents from '../../../utils/userAgents' import userAgents from '../../../utils/userAgents'
import detachDebugger from '../../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
import attachCurrentTab from '../../../utils/attachCurrentTab'
import Page from '../../Components/Page' import Page from '../../Components/Page'
import CheckBox from '../../Components/CheckBox'
import FooterLink from '../../Components/FooterLink' import FooterLink from '../../Components/FooterLink'
interface UserAgentPageProps { interface UserAgentPageProps {
@ -64,7 +62,7 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
platform: userAgents[e.target.value]['platform'], platform: userAgents[e.target.value]['platform'],
operatingSystem: e.target.value, operatingSystem: e.target.value,
}) })
await attachCurrentTab() // await attachCurrentTab()
} }
const changeBrowser = (e: ChangeEvent<HTMLSelectElement>) => { const changeBrowser = (e: ChangeEvent<HTMLSelectElement>) => {
@ -176,10 +174,7 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
onChange={changeTextInput} onChange={changeTextInput}
mb="12px" mb="12px"
/> />
{userAgentType !== 'default' && ( <FooterLink />
<CheckBox title={'Enable Debugger API Spoofing'} />
)}
<FooterLink link="test" text="Scan for" hoverText="user agent leaks" />
</Page> </Page>
) )
} }

View file

@ -60,7 +60,6 @@ const WebRtcPage = ({ tab }: SystemPageProps) => {
webRtcPolicy={webRtcPolicy} webRtcPolicy={webRtcPolicy}
onChange={changeRadioValue} onChange={changeRadioValue}
/> />
<FooterLink link="test" text="Scan for" hoverText="WebRTC leaks" />
</Page> </Page>
) )
} }

View file

@ -3,14 +3,14 @@ import { ThemeProvider, Flex, Box } from 'theme-ui'
import { theme } from '../theme' import { theme } from '../theme'
import { import {
Wifi, Wifi,
HardDrive, MapPin,
FileText, FileText,
MessageSquare, MessageSquare,
Globe, Globe,
Settings, Settings,
} from 'react-feather' } from 'react-feather'
import TabItem from './TabItem' import TabItem from './TabItem'
import SystemPage from './Pages/SystemPage' import LocationPage from './Pages/LocationPage'
import UserAgentPage from './Pages/UserAgentPage' import UserAgentPage from './Pages/UserAgentPage'
import SettingsPage from './Pages/SettingsPage' import SettingsPage from './Pages/SettingsPage'
import AutofillPage from './Pages/AutofillPage' import AutofillPage from './Pages/AutofillPage'
@ -24,7 +24,7 @@ import OtherOptionsPage from './Pages/OtherOptionsPage'
import addresses from '../utils/addresses' import addresses from '../utils/addresses'
const Popup = () => { const Popup = () => {
const [tab, setTab] = useState('autofill') const [tab, setTab] = useState('location')
const [ipData, setIpData] = useState<ipData>() const [ipData, setIpData] = useState<ipData>()
// const [reverseGeocoding, setReverseGeocoding] = useState<any>(undefined) // const [reverseGeocoding, setReverseGeocoding] = useState<any>(undefined)
const [geolocation, setGeolocation] = useState<GeolocationCoordinates>() const [geolocation, setGeolocation] = useState<GeolocationCoordinates>()
@ -69,17 +69,17 @@ const Popup = () => {
flexDirection: 'column', flexDirection: 'column',
}} }}
> >
<TabItem {/* <TabItem
Icon={Wifi} Icon={Wifi}
active={tab === 'connection'} active={tab === 'connection'}
onClick={() => setTab('connection')} onClick={() => setTab('connection')}
/> /> */}
<TabItem <TabItem
Icon={HardDrive} Icon={MapPin}
active={tab === 'system'} active={tab === 'location'}
onClick={() => setTab('system')} onClick={() => setTab('location')}
/> />
<TabItem {/* <TabItem
Icon={FileText} Icon={FileText}
active={tab === 'autofill'} active={tab === 'autofill'}
onClick={() => setTab('autofill')} onClick={() => setTab('autofill')}
@ -88,7 +88,7 @@ const Popup = () => {
Icon={MessageSquare} Icon={MessageSquare}
active={tab === 'webRtc'} active={tab === 'webRtc'}
onClick={() => setTab('webRtc')} onClick={() => setTab('webRtc')}
/> /> */}
<TabItem <TabItem
Icon={Globe} Icon={Globe}
active={tab === 'userAgent'} active={tab === 'userAgent'}
@ -111,7 +111,7 @@ const Popup = () => {
</Flex> </Flex>
<Box sx={{ m: '12px', width: '100%' }}> <Box sx={{ m: '12px', width: '100%' }}>
<ConnectionPage tab={tab} ipData={ipData} /> <ConnectionPage tab={tab} ipData={ipData} />
<SystemPage tab={tab} ipData={ipData} geolocation={geolocation} /> <LocationPage tab={tab} ipData={ipData} geolocation={geolocation} />
<AutofillPage <AutofillPage
tab={tab} tab={tab}
autofillData={autofillData} autofillData={autofillData}

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Vytal - VPN Companion", "name": "Vytal - Spoof timezone, location & user agent",
"version": "2.0.0", "version": "2.1.0",
"description": "Spoof Timezone, Geolocation, Locale and User Agent.", "description": "Spoof Timezone, Geolocation, Locale and User Agent.",
"permissions": ["storage", "debugger", "privacy", "geolocation"], "permissions": ["storage", "debugger", "privacy", "geolocation"],
"background": { "service_worker": "background.bundle.js" }, "background": { "service_worker": "background.bundle.js" },

View file

@ -79,5 +79,12 @@ export const theme: Theme = {
bottom: '0', bottom: '0',
textDecoration: 'none', textDecoration: 'none',
}, },
hover: {
color: 'primaryDark',
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline',
},
},
}, },
} }