Restructured folders

This commit is contained in:
z0ccc 2022-10-01 15:30:24 -04:00
parent f1c05de864
commit 0b5c77baea
20 changed files with 95 additions and 35 deletions

View file

@ -16,6 +16,7 @@
"@emotion/react": "^11.9.3", "@emotion/react": "^11.9.3",
"@hot-loader/react-dom": "^17.0.2", "@hot-loader/react-dom": "^17.0.2",
"@mdx-js/react": "^2.1.2", "@mdx-js/react": "^2.1.2",
"@types/webpack-env": "^1.18.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-feather": "^2.0.10", "react-feather": "^2.0.10",

View file

@ -1,16 +1,16 @@
import attachDebugger from '../../utils/attachDebugger' import attachDebugger from '../utils/attachDebugger'
const attachTab = (tabId) => { const attachTab = (tabId: number) => {
chrome.debugger.getTargets((tabs) => { chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === tabId) const currentTab = tabs.find((obj) => obj.tabId === tabId)
if (!currentTab.attached) { if (!currentTab?.attached) {
attachDebugger(tabId) attachDebugger(tabId)
} }
}) })
} }
chrome.tabs.onCreated.addListener((tab) => { chrome.tabs.onCreated.addListener((tab) => {
attachDebugger(tab.id) tab.id && attachDebugger(tab.id)
}) })
chrome.tabs.onActivated.addListener((tab) => { chrome.tabs.onActivated.addListener((tab) => {

View file

@ -1,7 +1,7 @@
import React, { Dispatch, SetStateAction, ChangeEvent } from 'react' import { Dispatch, SetStateAction, ChangeEvent } from 'react'
import { Label, Select } from 'theme-ui' import { Label, Select } from 'theme-ui'
import configurations from '../../utils/configurations' import configurations from '../../../utils/configurations'
import detachDebugger from '../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
interface ConfigurationSelectProps { interface ConfigurationSelectProps {
configuration: string configuration: string

View file

@ -1,7 +1,7 @@
import React, { Dispatch, SetStateAction } from 'react' import { Dispatch, SetStateAction } from 'react'
import { Flex, Button, Text } from 'theme-ui' import { Flex, Button, Text } from 'theme-ui'
import detachDebugger from '../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
import getIP from '../../utils/getIP' import getIP from '../../../utils/getIP'
const getFlagEmoji = (countryCode: string) => { const getFlagEmoji = (countryCode: string) => {
const codePoints = countryCode const codePoints = countryCode

View file

@ -1,13 +1,13 @@
import React, { import {
useState, useState,
useEffect, useEffect,
Dispatch, Dispatch,
SetStateAction, SetStateAction,
ChangeEvent, ChangeEvent,
} from 'react' } from 'react'
import configurations from '../../utils/configurations' import configurations from '../../../utils/configurations'
import countryLocales from '../../utils/countryLocales' import countryLocales from '../../../utils/countryLocales'
import detachDebugger from '../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
import { Label, Input } from 'theme-ui' import { Label, Input } from 'theme-ui'
interface LocationInputProps { interface LocationInputProps {

View file

@ -1,9 +1,9 @@
import React, { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { Box } from 'theme-ui' import { Box } from 'theme-ui'
import LocationInput from './LocationInput' import LocationInput from './LocationInput'
import ConfigurationSelect from './ConfigurationSelect' import ConfigurationSelect from './ConfigurationSelect'
import IPData from './IPData' import IPData from './IPData'
import getIP from '../../utils/getIP' import getIP from '../../../utils/getIP'
interface LocationPageProps { interface LocationPageProps {
tab: string tab: string

View file

@ -1,6 +1,6 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { Box, Label, Select } from 'theme-ui' import { Box, Label, Select } from 'theme-ui'
import setWebRtcPolicy from '../../utils/setWebRtcPolicy' import setWebRtcPolicy from '../../../utils/setWebRtcPolicy'
import SettingsCheckBox from './SettingsCheckBox' import SettingsCheckBox from './SettingsCheckBox'
interface LocationPageProps { interface LocationPageProps {

View file

@ -1,7 +1,7 @@
import React, { Dispatch, SetStateAction, ChangeEvent } from 'react' import { Dispatch, SetStateAction, ChangeEvent } from 'react'
import { Label, Select } from 'theme-ui' import { Label, Select } from 'theme-ui'
import configurations from '../../utils/configurations' import configurations from '../../../utils/configurations'
import detachDebugger from '../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
interface ConfigurationSelectProps { interface ConfigurationSelectProps {
title: string title: string

View file

@ -1,7 +1,7 @@
import React, { useState, useEffect, ChangeEvent } from 'react' import { useState, useEffect, ChangeEvent } from 'react'
import { Box, Label, Radio, Flex, Input, Select } from 'theme-ui' import { Box, Label, Radio, Flex, Input, Select } from 'theme-ui'
import userAgents from '../../utils/userAgents' import userAgents from '../../../utils/userAgents'
import detachDebugger from '../../utils/detachDebugger' import detachDebugger from '../../../utils/detachDebugger'
interface UserAgentPageProps { interface UserAgentPageProps {
tab: string tab: string

View file

@ -1,11 +1,19 @@
import React, { useState } from 'react' import React, { useState } from 'react'
import { ThemeProvider, Flex, Box, Text } from 'theme-ui' import { ThemeProvider, Flex, Box, Text } from 'theme-ui'
import { theme } from '../../theme' import { theme } from '../theme'
import { MapPin, Globe, Settings, ExternalLink } from 'react-feather' import {
MapPin,
Home,
MessageSquare,
Globe,
Sliders,
Settings,
ExternalLink,
} from 'react-feather'
import TabItem from './TabItem' import TabItem from './TabItem'
import LocationPage from './LocationPage' import LocationPage from './Pages/LocationPage'
import UserAgentPage from './UserAgentPage' import UserAgentPage from './Pages/UserAgentPage'
import SettingsPage from './SettingsPage' import SettingsPage from './Pages/SettingsPage'
const Popup = () => { const Popup = () => {
const [tab, setTab] = useState('settings') const [tab, setTab] = useState('settings')
@ -32,7 +40,17 @@ const Popup = () => {
onClick={() => setTab('location')} onClick={() => setTab('location')}
/> />
<TabItem <TabItem
Icon={Globe} Icon={Home}
active={tab === 'AdressAutofill'}
onClick={() => setTab('AdressAutofill')}
/>
<TabItem
Icon={MessageSquare}
active={tab === 'WebRTC'}
onClick={() => setTab('WebRTC')}
/>
<TabItem
Icon={Sliders}
active={tab === 'useragent'} active={tab === 'useragent'}
onClick={() => setTab('useragent')} onClick={() => setTab('useragent')}
/> />
@ -50,7 +68,7 @@ const Popup = () => {
<LocationPage tab={tab} /> <LocationPage tab={tab} />
<UserAgentPage tab={tab} /> <UserAgentPage tab={tab} />
<SettingsPage tab={tab} /> <SettingsPage tab={tab} />
<Text {/* <Text
sx={{ sx={{
mb: '8px', mb: '8px',
fontSize: '10px', fontSize: '10px',
@ -59,7 +77,7 @@ const Popup = () => {
}} }}
> >
Current tab won't be fully spoofed until after 1st or 2nd reload. Current tab won't be fully spoofed until after 1st or 2nd reload.
</Text> </Text> */}
</Box> </Box>
</Flex> </Flex>
</ThemeProvider> </ThemeProvider>

View file

@ -1,6 +1,6 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Vytal - Spoof Timezone, Geolocation, Locale and User Agent", "name": "Vytal - VPN Companion",
"version": "2.0.0", "version": "2.0.0",
"description": "Spoof Timezone, Geolocation, Locale and User Agent.", "description": "Spoof Timezone, Geolocation, Locale and User Agent.",
"permissions": ["storage", "debugger", "activeTab", "privacy"], "permissions": ["storage", "debugger", "activeTab", "privacy"],

View file

@ -22,6 +22,7 @@ export const theme: Theme = {
fontFamily: "'Segoe UI', Tahoma, sans-serif", fontFamily: "'Segoe UI', Tahoma, sans-serif",
}, },
}, },
forms: { forms: {
label: { width: 'auto' }, label: { width: 'auto' },
input: { input: {

View file

@ -0,0 +1,34 @@
const setAutofillAddress = () => {
chrome.storage.sync.get(['isWebRtcDisabled'], (storage) => {
const value = storage.isWebRtcDisabled
? 'default'
: 'disable_non_proxied_udp'
chrome.privacy.services.autofillAddressEnabled.clear({}, () => {
chrome.privacy.network.webRTCIPHandlingPolicy.set(
{
value,
},
() => {
chrome.storage.sync.set({
isWebRtcDisabled: !storage.isWebRtcDisabled,
})
// chrome.privacy.network.webRTCIPHandlingPolicy.get({}, (s) => {
// // let path = 'data/icons/'
// // let title = 'WebRTC access is allowed'
// if (s.value !== value) {
// // path += 'red/'
// // title =
// console.log('WebRTC access cannot be changed. It is controlled by another extension')
// } else if (prefs.enabled === false) {
// path += 'disabled/'
// title = 'WebRTC access is blocked'
// }
// })
}
)
})
})
}
export default setAutofillAddress

View file

@ -15,6 +15,7 @@
"noEmit": false, "noEmit": false,
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "theme-ui" "jsxImportSource": "theme-ui"
}, },
"include": ["src"], "include": ["src"],
"exclude": ["build", "node_modules"] "exclude": ["build", "node_modules"]

View file

@ -36,8 +36,8 @@ if (fileSystem.existsSync(secretsPath)) {
var options = { var options = {
mode: process.env.NODE_ENV || 'development', mode: process.env.NODE_ENV || 'development',
entry: { entry: {
popup: path.join(__dirname, 'src', 'pages', 'Popup', 'index.jsx'), popup: path.join(__dirname, 'src', 'Popup', 'index.tsx'),
background: path.join(__dirname, 'src', 'pages', 'Background', 'index.js'), background: path.join(__dirname, 'src', 'Background', 'index.ts'),
}, },
chromeExtensionBoilerplate: { chromeExtensionBoilerplate: {
notHotReload: ['background'], notHotReload: ['background'],
@ -147,7 +147,7 @@ var options = {
], ],
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'pages', 'Popup', 'index.html'), template: path.join(__dirname, 'src', 'Popup', 'index.html'),
filename: 'popup.html', filename: 'popup.html',
chunks: ['popup'], chunks: ['popup'],
cache: false, cache: false,

View file

@ -1640,6 +1640,11 @@
dependencies: dependencies:
csstype "^3.0.2" csstype "^3.0.2"
"@types/webpack-env@^1.18.0":
version "1.18.0"
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.18.0.tgz#ed6ecaa8e5ed5dfe8b2b3d00181702c9925f13fb"
integrity sha512-56/MAlX5WMsPVbOg7tAxnYvNYMMWr/QJiIp6BxVSW3JJXUVzzOn64qW8TzQyMSqSUFM2+PVI4aUHcHOzIz/1tg==
"@types/ws@^8.5.1": "@types/ws@^8.5.1":
version "8.5.3" version "8.5.3"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d"