Added other options page
This commit is contained in:
parent
8c7b07ef44
commit
634ff42538
8 changed files with 157 additions and 102 deletions
34
src/Popup/Pages/OtherOptionsPage/index.tsx
Normal file
34
src/Popup/Pages/OtherOptionsPage/index.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { useState, useEffect, ChangeEvent } from 'react'
|
||||||
|
import { Box, Label, Radio, Flex, Input, Select, Divider } from 'theme-ui'
|
||||||
|
import userAgents from '../../../utils/userAgents'
|
||||||
|
import detachDebugger from '../../../utils/detachDebugger'
|
||||||
|
import SettingsCheckBox from '../SettingsPage/SettingsCheckBox'
|
||||||
|
|
||||||
|
interface OtherOptionsPageProps {
|
||||||
|
tab: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const OtherOptionsPage = ({ tab }: OtherOptionsPageProps) => {
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
sx={{
|
||||||
|
display: tab === 'otherOptions' ? 'block' : 'none',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box sx={{ fontSize: '21px', mb: '12px', fontWeight: '600' }}>
|
||||||
|
Other Options
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<SettingsCheckBox title={'Network Prediction Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Alternate Error Pages Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Search Suggest Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Spelling Service Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Translation Service Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Hyperlink Auditing Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Referrers Enabled'} />
|
||||||
|
<SettingsCheckBox title={'Third Party Cookies Allowed'} />
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OtherOptionsPage
|
||||||
|
|
@ -24,7 +24,6 @@ const SystemPage = ({ tab, ipData }: SystemPageProps) => {
|
||||||
['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'],
|
['systemType', 'configuration', 'timezone', 'locale', 'lat', 'lon'],
|
||||||
(storage) => {
|
(storage) => {
|
||||||
if (storage.systemType === 'custom') {
|
if (storage.systemType === 'custom') {
|
||||||
console.log(storage.configuration)
|
|
||||||
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)
|
||||||
|
|
@ -104,7 +103,6 @@ const SystemPage = ({ tab, ipData }: SystemPageProps) => {
|
||||||
|
|
||||||
const changeInputText = () => {
|
const changeInputText = () => {
|
||||||
if (systemType !== 'custom' || configuration !== 'custom') {
|
if (systemType !== 'custom' || configuration !== 'custom') {
|
||||||
console.log(2)
|
|
||||||
setConfiguration('custom')
|
setConfiguration('custom')
|
||||||
setSystemType('custom')
|
setSystemType('custom')
|
||||||
chrome.storage.local.set({
|
chrome.storage.local.set({
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import { 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, Divider } from 'theme-ui'
|
||||||
import userAgents from '../../../utils/userAgents'
|
import userAgents from '../../../utils/userAgents'
|
||||||
import detachDebugger from '../../../utils/detachDebugger'
|
import detachDebugger from '../../../utils/detachDebugger'
|
||||||
|
import SettingsCheckBox from '../SettingsPage/SettingsCheckBox'
|
||||||
|
|
||||||
interface UserAgentPageProps {
|
interface UserAgentPageProps {
|
||||||
tab: string
|
tab: string
|
||||||
|
|
@ -66,7 +67,7 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ fontSize: '21px', mb: '12px', fontWeight: '600' }}>
|
<Box sx={{ fontSize: '21px', mb: '12px', fontWeight: '600' }}>
|
||||||
Other Options
|
User Agent
|
||||||
</Box>
|
</Box>
|
||||||
<Flex
|
<Flex
|
||||||
sx={{
|
sx={{
|
||||||
|
|
|
||||||
51
src/Popup/Pages/WebRtcPage/RadioButton.tsx
Normal file
51
src/Popup/Pages/WebRtcPage/RadioButton.tsx
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
import { useState, useEffect, ChangeEvent } from 'react'
|
||||||
|
import { Box, Label, Radio, Text } from 'theme-ui'
|
||||||
|
import handleWebRtcPolicy from './handleWebRtcPolicy'
|
||||||
|
|
||||||
|
interface RadioButtonProps {
|
||||||
|
value: string
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
webRtcPolicy: string
|
||||||
|
onChange: (e: ChangeEvent<HTMLInputElement>) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const RadioButton = ({
|
||||||
|
value,
|
||||||
|
name,
|
||||||
|
description,
|
||||||
|
webRtcPolicy,
|
||||||
|
onChange,
|
||||||
|
}: RadioButtonProps) => {
|
||||||
|
// const [webRtcPolicy, setWebRtcPolicy] = useState('default')
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// chrome.storage.local.get(['webRtcPolicy'], (storage) => {
|
||||||
|
// storage.webRtcPolicy && setWebRtcPolicy(storage.webRtcPolicy)
|
||||||
|
// })
|
||||||
|
// }, [])
|
||||||
|
|
||||||
|
// chrome.privacy.network.webRTCIPHandlingPolicy.onChange.addListener(function (
|
||||||
|
// details
|
||||||
|
// ) {
|
||||||
|
// console.log(details)
|
||||||
|
// setWebRtcPolicy(details.value)
|
||||||
|
// })
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Label sx={{ cursor: 'pointer' }}>
|
||||||
|
<Radio
|
||||||
|
name="webRtcPolicy"
|
||||||
|
value={value}
|
||||||
|
onChange={onChange}
|
||||||
|
checked={webRtcPolicy === value}
|
||||||
|
/>
|
||||||
|
<Text sx={{ fontWeight: '700' }}>{name}</Text>
|
||||||
|
</Label>
|
||||||
|
<Box sx={{ ml: '32px', mb: '12px', fontSize: '12px' }}>{description}</Box>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RadioButton
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect, ChangeEvent } from 'react'
|
||||||
import { Box, Button, Label, Radio, Select, Text } from 'theme-ui'
|
import { Box, Label, Radio, Text } from 'theme-ui'
|
||||||
import getWebRTCData from './getWebRTCData'
|
|
||||||
import handleWebRtcPolicy from './handleWebRtcPolicy'
|
import handleWebRtcPolicy from './handleWebRtcPolicy'
|
||||||
|
import RadioButton from './RadioButton'
|
||||||
|
|
||||||
interface SystemPageProps {
|
interface SystemPageProps {
|
||||||
tab: string
|
tab: string
|
||||||
|
|
@ -9,7 +9,6 @@ interface SystemPageProps {
|
||||||
|
|
||||||
const WebRtcPage = ({ tab }: SystemPageProps) => {
|
const WebRtcPage = ({ tab }: SystemPageProps) => {
|
||||||
const [webRtcPolicy, setWebRtcPolicy] = useState('default')
|
const [webRtcPolicy, setWebRtcPolicy] = useState('default')
|
||||||
const [webRtcIp, setWebRtcIp] = useState([])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
chrome.storage.local.get(['webRtcPolicy'], (storage) => {
|
chrome.storage.local.get(['webRtcPolicy'], (storage) => {
|
||||||
|
|
@ -17,12 +16,17 @@ const WebRtcPage = ({ tab }: SystemPageProps) => {
|
||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
chrome.privacy.network.webRTCIPHandlingPolicy.onChange.addListener(function (
|
// chrome.privacy.network.webRTCIPHandlingPolicy.onChange.addListener(function (
|
||||||
details
|
// details
|
||||||
) {
|
// ) {
|
||||||
console.log(details)
|
// console.log(details)
|
||||||
setWebRtcPolicy(details.value)
|
// setWebRtcPolicy(details.value)
|
||||||
})
|
// })
|
||||||
|
|
||||||
|
const changeRadioValue = (e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
handleWebRtcPolicy(e.target.value)
|
||||||
|
setWebRtcPolicy(e.target.value)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
|
|
@ -33,57 +37,43 @@ const WebRtcPage = ({ tab }: SystemPageProps) => {
|
||||||
<Box sx={{ fontSize: '21px', mb: '12px', fontWeight: '600' }}>
|
<Box sx={{ fontSize: '21px', mb: '12px', fontWeight: '600' }}>
|
||||||
WebRTC Policy
|
WebRTC Policy
|
||||||
</Box>
|
</Box>
|
||||||
<Label>
|
<RadioButton
|
||||||
<Radio
|
value={'default'}
|
||||||
name="webRtcPolicy"
|
name={'Default'}
|
||||||
value="default"
|
description={
|
||||||
onChange={(e) => handleWebRtcPolicy(e.target.value)}
|
'Same as above, except allow WebRTC traffic through the default private'
|
||||||
checked={webRtcPolicy === 'default'}
|
}
|
||||||
/>
|
webRtcPolicy={webRtcPolicy}
|
||||||
<Box>
|
onChange={changeRadioValue}
|
||||||
<Text sx={{ fontWeight: '700' }}>Default</Text>
|
/>
|
||||||
<Box sx={{ mb: '12px', fontSize: '12px' }}>
|
<RadioButton
|
||||||
Same as above, except allow WebRTC traffic through the default
|
value={'disable_non_proxied_udp'}
|
||||||
private
|
name={'Disable non-proxied UDP (force proxy)'}
|
||||||
</Box>
|
description={
|
||||||
</Box>
|
'Same as above, except allow WebRTC traffic through the default private'
|
||||||
</Label>
|
}
|
||||||
|
webRtcPolicy={webRtcPolicy}
|
||||||
<Label>
|
onChange={changeRadioValue}
|
||||||
<Radio
|
/>
|
||||||
name="webRtcPolicy"
|
<RadioButton
|
||||||
value="default_public_and_private_interfaces"
|
value={'default_public_and_private_interfaces'}
|
||||||
onChange={(e) => handleWebRtcPolicy(e.target.value)}
|
name={'Default public and private interfaces'}
|
||||||
checked={webRtcPolicy === 'default_public_and_private_interfaces'}
|
description={
|
||||||
/>
|
'Same as above, except allow WebRTC traffic through the default private'
|
||||||
<Box>
|
}
|
||||||
<Text sx={{ fontWeight: '700' }}>
|
webRtcPolicy={webRtcPolicy}
|
||||||
Default public and private interfaces
|
onChange={changeRadioValue}
|
||||||
</Text>
|
/>
|
||||||
<Box sx={{ mb: '12px', fontSize: '12px' }}>
|
<RadioButton
|
||||||
Send WebRTC traffic via the default public network adapter to the
|
value={'default_public_interface_only'}
|
||||||
Internet. This will be.
|
name={'Default public interface only'}
|
||||||
</Box>
|
description={
|
||||||
</Box>
|
'Same as above, except allow WebRTC traffic through the default private'
|
||||||
</Label>
|
}
|
||||||
|
webRtcPolicy={webRtcPolicy}
|
||||||
<Label>
|
onChange={changeRadioValue}
|
||||||
<Radio
|
/>
|
||||||
name="webRtcPolicy"
|
{/* <Label>
|
||||||
value="default_public_interface_only"
|
|
||||||
onChange={(e) => handleWebRtcPolicy(e.target.value)}
|
|
||||||
checked={webRtcPolicy === 'default_public_interface_only'}
|
|
||||||
/>
|
|
||||||
<Box>
|
|
||||||
<Text sx={{ fontWeight: '700' }}>Default public interface only</Text>
|
|
||||||
<Box sx={{ mb: '12px', fontSize: '12px' }}>
|
|
||||||
Same as above, except allow WebRTC traffic through the default
|
|
||||||
private interface to your.
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
</Label>
|
|
||||||
|
|
||||||
<Label>
|
|
||||||
<Radio
|
<Radio
|
||||||
name="webRtcPolicy"
|
name="webRtcPolicy"
|
||||||
value="disable_non_proxied_udp"
|
value="disable_non_proxied_udp"
|
||||||
|
|
@ -97,37 +87,7 @@ const WebRtcPage = ({ tab }: SystemPageProps) => {
|
||||||
proxies.
|
proxies.
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Label>
|
</Label> */}
|
||||||
|
|
||||||
{/* <Select
|
|
||||||
name="webRtcPolicy"
|
|
||||||
id="webRtcPolicy"
|
|
||||||
value={webRtcPolicy}
|
|
||||||
onChange={(e) => handleWebRtcPolicy(e.target.value)}
|
|
||||||
>
|
|
||||||
<option value="default">Default</option>
|
|
||||||
<option value="default_public_and_private_interfaces">
|
|
||||||
Default public and private interfaces
|
|
||||||
</option>
|
|
||||||
<option value="default_public_interface_only">
|
|
||||||
Default public interface only
|
|
||||||
</option>
|
|
||||||
<option value="disable_non_proxied_udp">Disable non proxied udp</option>
|
|
||||||
</Select> */}
|
|
||||||
{/* <Box sx={{ fontSize: '12px', mb: '8px' }}>
|
|
||||||
IP: {JSON.stringify(webRtcIp)}
|
|
||||||
</Box>
|
|
||||||
<Button
|
|
||||||
onClick={() => {
|
|
||||||
getWebRTCData(setWebRtcIp)
|
|
||||||
// getWebRTCData().then((ip) => {
|
|
||||||
// console.log(ip)
|
|
||||||
// setWebRtcIp(ip)
|
|
||||||
// })
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Reload
|
|
||||||
</Button> */}
|
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import {
|
||||||
HardDrive,
|
HardDrive,
|
||||||
FileText,
|
FileText,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
|
Globe,
|
||||||
Sliders,
|
Sliders,
|
||||||
Settings,
|
Settings,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
|
|
@ -20,6 +21,7 @@ import CurrentPage from './Pages/CurrentPage'
|
||||||
import { ipData } from '../types'
|
import { ipData } from '../types'
|
||||||
import getIp from '../utils/getIp'
|
import getIp from '../utils/getIp'
|
||||||
import '../assets/global.css'
|
import '../assets/global.css'
|
||||||
|
import OtherOptionsPage from './Pages/OtherOptionsPage'
|
||||||
|
|
||||||
const Popup = () => {
|
const Popup = () => {
|
||||||
const [tab, setTab] = useState('webRtc')
|
const [tab, setTab] = useState('webRtc')
|
||||||
|
|
@ -36,7 +38,7 @@ const Popup = () => {
|
||||||
<Flex
|
<Flex
|
||||||
sx={{
|
sx={{
|
||||||
width: '350px',
|
width: '350px',
|
||||||
height: '390px',
|
height: '400px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
|
|
@ -68,19 +70,24 @@ const Popup = () => {
|
||||||
onClick={() => setTab('webRtc')}
|
onClick={() => setTab('webRtc')}
|
||||||
/>
|
/>
|
||||||
<TabItem
|
<TabItem
|
||||||
Icon={Sliders}
|
Icon={Globe}
|
||||||
active={tab === 'useragent'}
|
active={tab === 'useragent'}
|
||||||
onClick={() => setTab('useragent')}
|
onClick={() => setTab('useragent')}
|
||||||
/>
|
/>
|
||||||
|
<TabItem
|
||||||
|
Icon={Sliders}
|
||||||
|
active={tab === 'otherOptions'}
|
||||||
|
onClick={() => setTab('otherOptions')}
|
||||||
|
/>
|
||||||
<TabItem
|
<TabItem
|
||||||
Icon={Settings}
|
Icon={Settings}
|
||||||
active={tab === 'settings'}
|
active={tab === 'settings'}
|
||||||
onClick={() => setTab('settings')}
|
onClick={() => setTab('settings')}
|
||||||
/>
|
/>
|
||||||
<TabItem
|
{/* <TabItem
|
||||||
Icon={ExternalLink}
|
Icon={ExternalLink}
|
||||||
onClick={() => window.open('https://vytal.io')}
|
onClick={() => window.open('https://vytal.io')}
|
||||||
/>
|
/> */}
|
||||||
</Flex>
|
</Flex>
|
||||||
<Box sx={{ m: '12px', width: '100%' }}>
|
<Box sx={{ m: '12px', width: '100%' }}>
|
||||||
<CurrentPage tab={tab} />
|
<CurrentPage tab={tab} />
|
||||||
|
|
@ -88,6 +95,7 @@ const Popup = () => {
|
||||||
<AutofillPage tab={tab} />
|
<AutofillPage tab={tab} />
|
||||||
<WebRtcPage tab={tab} />
|
<WebRtcPage tab={tab} />
|
||||||
<UserAgentPage tab={tab} />
|
<UserAgentPage tab={tab} />
|
||||||
|
<OtherOptionsPage tab={tab} />
|
||||||
<SettingsPage tab={tab} />
|
<SettingsPage tab={tab} />
|
||||||
{/* <Text
|
{/* <Text
|
||||||
sx={{
|
sx={{
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,7 @@ body {
|
||||||
font-family: 'Nunito';
|
font-family: 'Nunito';
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
font-family: 'Nunito';
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,8 @@ export const theme: Theme = {
|
||||||
margin: '0',
|
margin: '0',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
forms: {
|
forms: {
|
||||||
label: { width: 'auto' },
|
label: { width: 'auto', alignItems: 'center' },
|
||||||
input: {
|
input: {
|
||||||
p: '2px 8px',
|
p: '2px 8px',
|
||||||
mb: '8px',
|
mb: '8px',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue