user agent age update
This commit is contained in:
parent
fcabda87f5
commit
2ab3089f8f
5 changed files with 475 additions and 195 deletions
|
|
@ -9,7 +9,7 @@ interface CheckBoxProps {
|
||||||
|
|
||||||
const CheckBox = ({ title, onChange, checked }: CheckBoxProps) => {
|
const CheckBox = ({ title, onChange, checked }: CheckBoxProps) => {
|
||||||
return (
|
return (
|
||||||
<Label sx={{ mb: '8px' }}>
|
<Label sx={{ mb: '8px', cursor: 'pointer' }}>
|
||||||
<Checkbox onChange={onChange} checked={checked} />
|
<Checkbox onChange={onChange} checked={checked} />
|
||||||
{title}
|
{title}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState, useEffect, ChangeEvent } from 'react'
|
import { useState, useEffect, ChangeEvent } from 'react'
|
||||||
import { Box, Label, Radio, Flex, Select } from 'theme-ui'
|
import { Box, Label, Select } from 'theme-ui'
|
||||||
|
import Checkbox from '../../Components/CheckBox'
|
||||||
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'
|
||||||
|
|
@ -10,77 +11,56 @@ interface UserAgentPageProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserAgentPage = ({ tab }: UserAgentPageProps) => {
|
const UserAgentPage = ({ tab }: UserAgentPageProps) => {
|
||||||
const [userAgentType, setUserAgentType] = useState('default')
|
const [browserDefault, setBrowserDefault] = useState(true)
|
||||||
const [operatingSystem, setOperatingSystem] = useState('Windows')
|
const [userAgentInfo, setUserAgentInfo] = useState('')
|
||||||
const [browser, setBrowser] = useState('Chrome')
|
|
||||||
const [userAgent, setUserAgent] = useState('')
|
const [userAgent, setUserAgent] = useState('')
|
||||||
const [platform, setPlatform] = useState('')
|
const [platform, setPlatform] = useState('')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
chrome.storage.local.get(
|
chrome.storage.local.get(
|
||||||
['userAgentType', 'operatingSystem', 'browser', 'userAgent', 'platform'],
|
['userAgentBrowserDefault', 'userAgentInfo', 'userAgent', 'platform'],
|
||||||
(storage) => {
|
(storage) => {
|
||||||
storage.userAgentType && setUserAgentType(storage.userAgentType)
|
storage.userAgentBrowserDefault !== undefined &&
|
||||||
storage.operatingSystem && setOperatingSystem(storage.operatingSystem)
|
setBrowserDefault(storage.userAgentBrowserDefault)
|
||||||
storage.browser && setBrowser(storage.browser)
|
storage.userAgentInfo && setUserAgentInfo(storage.userAgentInfo)
|
||||||
storage.userAgent && setUserAgent(storage.userAgent)
|
storage.userAgent && setUserAgent(storage.userAgent)
|
||||||
storage.platform && setPlatform(storage.platform)
|
storage.platform && setPlatform(storage.platform)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const changeType = (e: ChangeEvent<HTMLInputElement>) => {
|
const changeBrowserDefault = () => {
|
||||||
detachDebugger()
|
if (!browserDefault) {
|
||||||
setUserAgentType(e.target.value)
|
detachDebugger()
|
||||||
chrome.storage.local.set({ userAgentType: e.target.value })
|
|
||||||
|
|
||||||
if (e.target.value === 'default') {
|
|
||||||
setUserAgent('')
|
|
||||||
setPlatform('')
|
|
||||||
chrome.storage.local.set({
|
|
||||||
userAgent: '',
|
|
||||||
platform: '',
|
|
||||||
})
|
|
||||||
} else if (e.target.value === 'preloaded') {
|
|
||||||
setUserAgent(userAgents[operatingSystem]['userAgents'][browser])
|
|
||||||
setPlatform(userAgents[operatingSystem]['platform'])
|
|
||||||
chrome.storage.local.set({
|
|
||||||
userAgent: userAgents[operatingSystem]['userAgents'][browser],
|
|
||||||
platform: userAgents[operatingSystem]['platform'],
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chrome.storage.local.set({
|
||||||
|
userAgentBrowserDefault: !browserDefault,
|
||||||
|
})
|
||||||
|
setBrowserDefault(!browserDefault)
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeOperatingSystem = async (e: ChangeEvent<HTMLSelectElement>) => {
|
const changeUserAgentInfo = async (e: ChangeEvent<HTMLSelectElement>) => {
|
||||||
detachDebugger()
|
detachDebugger()
|
||||||
setOperatingSystem(e.target.value)
|
setUserAgentInfo(e.target.value)
|
||||||
let browserValue = browser
|
|
||||||
if (!userAgents[e.target.value]['userAgents'][browser]) {
|
|
||||||
browserValue = Object.keys(userAgents[e.target.value]['userAgents'])[0]
|
|
||||||
setBrowser(browserValue)
|
|
||||||
}
|
|
||||||
setUserAgent(userAgents[e.target.value]['userAgents'][browserValue])
|
|
||||||
setPlatform(userAgents[e.target.value]['platform'])
|
|
||||||
chrome.storage.local.set({
|
chrome.storage.local.set({
|
||||||
userAgent: userAgents[e.target.value]['userAgents'][browserValue],
|
userAgentInfo: e.target.value,
|
||||||
platform: userAgents[e.target.value]['platform'],
|
|
||||||
operatingSystem: e.target.value,
|
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const changeBrowser = (e: ChangeEvent<HTMLSelectElement>) => {
|
if (e.target.value !== 'custom') {
|
||||||
detachDebugger()
|
const userAgentObj = JSON.parse(e.target.value)
|
||||||
setBrowser(e.target.value)
|
setUserAgent(userAgentObj.value)
|
||||||
setUserAgent(userAgents[operatingSystem]['userAgents'][e.target.value])
|
setPlatform(userAgentObj.platform)
|
||||||
chrome.storage.local.set({
|
chrome.storage.local.set({
|
||||||
userAgent: userAgents[operatingSystem]['userAgents'][e.target.value],
|
userAgent: userAgentObj.value,
|
||||||
browser: e.target.value,
|
platform: userAgentObj.platform,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeTextInput = () => {
|
const changeTextInput = () => {
|
||||||
if (userAgentType !== 'custom') {
|
if (userAgentInfo !== 'custom') {
|
||||||
setUserAgentType('custom')
|
setUserAgentInfo('custom')
|
||||||
chrome.storage.local.set({
|
chrome.storage.local.set({
|
||||||
userAgentType: 'custom',
|
userAgentType: 'custom',
|
||||||
})
|
})
|
||||||
|
|
@ -89,94 +69,56 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page isCurrentTab={tab === 'userAgent'} title={'User Agent'}>
|
<Page isCurrentTab={tab === 'userAgent'} title={'User Agent'}>
|
||||||
<Flex
|
<Checkbox
|
||||||
|
title="Use browser default"
|
||||||
|
onChange={changeBrowserDefault}
|
||||||
|
checked={browserDefault}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: 'space-between',
|
opacity: browserDefault ? '0.5' : '1',
|
||||||
mb: '8px',
|
pointerEvents: browserDefault ? 'none' : 'auto',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Label>
|
<Box sx={{ width: '100%' }}>
|
||||||
<Radio
|
<Label htmlFor="type">Type</Label>
|
||||||
name="userAgentType"
|
<Select
|
||||||
value="default"
|
name="type"
|
||||||
onChange={changeType}
|
id="type"
|
||||||
checked={userAgentType === 'default'}
|
value={userAgentInfo}
|
||||||
/>
|
onChange={changeUserAgentInfo}
|
||||||
Default
|
mb={'8px'}
|
||||||
</Label>
|
>
|
||||||
<Label>
|
<option value="custom">Custom</option>
|
||||||
<Radio
|
{Object.keys(userAgents).map((key) => (
|
||||||
name="userAgentType"
|
<optgroup key={key} label={userAgents[key].title}>
|
||||||
value="preloaded"
|
{userAgents[key].values.map((key: any) => (
|
||||||
onChange={changeType}
|
<option key={key.value} value={JSON.stringify(key)}>
|
||||||
checked={userAgentType === 'preloaded'}
|
{key.title}
|
||||||
/>
|
|
||||||
Preloaded
|
|
||||||
</Label>
|
|
||||||
<Label>
|
|
||||||
<Radio
|
|
||||||
name="userAgentType"
|
|
||||||
value="custom"
|
|
||||||
onChange={changeType}
|
|
||||||
checked={userAgentType === 'custom'}
|
|
||||||
/>
|
|
||||||
Custom
|
|
||||||
</Label>
|
|
||||||
</Flex>
|
|
||||||
{userAgentType === 'preloaded' && (
|
|
||||||
<Flex sx={{ gap: '16px' }}>
|
|
||||||
<Box sx={{ width: '100%' }}>
|
|
||||||
<Label htmlFor="operatingSystem">Operating System</Label>
|
|
||||||
<Select
|
|
||||||
name="operatingSystem"
|
|
||||||
id="operatingSystem"
|
|
||||||
value={operatingSystem}
|
|
||||||
onChange={changeOperatingSystem}
|
|
||||||
mb={'8px'}
|
|
||||||
>
|
|
||||||
{Object.keys(userAgents).map((key) => (
|
|
||||||
<option value={key} key={key}>
|
|
||||||
{key}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</Select>
|
|
||||||
</Box>
|
|
||||||
<Box sx={{ width: '100%' }}>
|
|
||||||
<Label htmlFor="browser">Browser</Label>
|
|
||||||
<Select
|
|
||||||
name="browser"
|
|
||||||
id="browser"
|
|
||||||
value={browser}
|
|
||||||
onChange={changeBrowser}
|
|
||||||
mb={'8px'}
|
|
||||||
>
|
|
||||||
{Object.keys(userAgents[operatingSystem]['userAgents']).map(
|
|
||||||
(key) => (
|
|
||||||
<option value={key} key={key}>
|
|
||||||
{key}
|
|
||||||
</option>
|
</option>
|
||||||
)
|
))}
|
||||||
)}
|
</optgroup>
|
||||||
</Select>
|
))}
|
||||||
</Box>
|
</Select>
|
||||||
</Flex>
|
</Box>
|
||||||
)}
|
<DebouncedInput
|
||||||
<DebouncedInput
|
name="userAgent"
|
||||||
name="userAgent"
|
title="User Agent"
|
||||||
title="User Agent"
|
value={userAgent}
|
||||||
value={userAgent}
|
setValue={setUserAgent}
|
||||||
setValue={setUserAgent}
|
onChange={changeTextInput}
|
||||||
onChange={changeTextInput}
|
mb="12px"
|
||||||
mb="12px"
|
/>
|
||||||
/>
|
<DebouncedInput
|
||||||
<DebouncedInput
|
name="platform"
|
||||||
name="platform"
|
title="Platform"
|
||||||
title="Platform"
|
value={platform}
|
||||||
value={platform}
|
setValue={setPlatform}
|
||||||
setValue={setPlatform}
|
onChange={changeTextInput}
|
||||||
onChange={changeTextInput}
|
mb="12px"
|
||||||
mb="12px"
|
/>
|
||||||
/>
|
</Box>
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ const attachDebugger = (tabId: number) => {
|
||||||
'localeMatchIP',
|
'localeMatchIP',
|
||||||
'userAgent',
|
'userAgent',
|
||||||
'platform',
|
'platform',
|
||||||
|
'userAgentBrowserDefault',
|
||||||
],
|
],
|
||||||
(storage) => {
|
(storage) => {
|
||||||
if (
|
if (
|
||||||
|
|
@ -69,7 +70,10 @@ const attachDebugger = (tabId: number) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storage.userAgent || storage.platform) {
|
if (
|
||||||
|
!storage.userAgentBrowserDefault &&
|
||||||
|
(storage.userAgent || storage.platform)
|
||||||
|
) {
|
||||||
chrome.debugger.sendCommand(
|
chrome.debugger.sendCommand(
|
||||||
{ tabId: tabId },
|
{ tabId: tabId },
|
||||||
'Emulation.setUserAgentOverride',
|
'Emulation.setUserAgentOverride',
|
||||||
|
|
|
||||||
|
|
@ -1,66 +1,334 @@
|
||||||
const userAgents: any = {
|
const userAgents: any = [
|
||||||
Windows: {
|
{
|
||||||
platform: 'Win32',
|
title: 'Android',
|
||||||
userAgents: {
|
values: [
|
||||||
Chrome:
|
{
|
||||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
title: 'Android (4.0.2) Browser - Galaxy Nexus',
|
||||||
Edge: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54',
|
value:
|
||||||
Firefox:
|
'Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
|
||||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0',
|
platform: 'Android',
|
||||||
Opera:
|
},
|
||||||
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
{
|
||||||
},
|
title: 'Android (2.3) Browser - Nexus S',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; Nexus S Build/GRK39F) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
Mac: {
|
{
|
||||||
platform: 'MacIntel',
|
title: 'BlackBerry',
|
||||||
userAgents: {
|
values: [
|
||||||
Safari:
|
{
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15',
|
title: 'BlackBerry - BB10',
|
||||||
Chrome:
|
value:
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+',
|
||||||
Edge: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54',
|
platform: 'Android',
|
||||||
Firefox:
|
},
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/108.0',
|
{
|
||||||
Opera:
|
title: 'BlackBerry - PlayBook 2.1',
|
||||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
value:
|
||||||
},
|
'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'BlackBerry - 9900',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
Linux: {
|
title: 'Chrome',
|
||||||
platform: 'Linux x86_64',
|
values: [
|
||||||
userAgents: {
|
{
|
||||||
Chrome:
|
title: 'Chrome - Android Mobile',
|
||||||
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
value:
|
||||||
Firefox:
|
'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36',
|
||||||
'Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0',
|
platform: 'Android',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - Android Mobile (high-end)',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - Android Tablet',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - iPhone',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/108.0.0.0 Mobile/15E148 Safari/604.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - iPad',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPad; CPU OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/108.0.0.0 Mobile/15E148 Safari/604.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - Chrome OS',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (X11; CrOS x86_64 10066.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - Mac',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Chrome - Windows',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
Android: {
|
{
|
||||||
platform: 'Linux armv8l',
|
title: 'Firefox',
|
||||||
userAgents: {
|
values: [
|
||||||
Samsung:
|
{
|
||||||
'Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-G920P Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Mobile Safari/E7FBAF',
|
title: 'Firefox - Android Mobile',
|
||||||
Chrome:
|
value:
|
||||||
'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36',
|
'Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0',
|
||||||
Edge: 'Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36 EdgA/42.0.0.2057',
|
platform: 'Android',
|
||||||
Firefox:
|
},
|
||||||
'Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0',
|
{
|
||||||
Opera:
|
title: 'Firefox - Android Tablet',
|
||||||
'Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02',
|
value:
|
||||||
},
|
'Mozilla/5.0 (Android 4.4; Tablet; rv:70.0) Gecko/70.0 Firefox/70.0',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Firefox - iPhone',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Firefox - iPad',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPad; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Firefox - Mac',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:70.0) Gecko/20100101 Firefox/70.0',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Firefox - Windows',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:70.0) Gecko/20100101 Firefox/70.0',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
iOS: {
|
{
|
||||||
platform: 'iPhone',
|
title: 'Googlebot',
|
||||||
userAgents: {
|
values: [
|
||||||
Safari:
|
{
|
||||||
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
|
title: 'Googlebot',
|
||||||
Chrome:
|
value:
|
||||||
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/108.0.0.0 Mobile/15E148 Safari/604.1',
|
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
|
||||||
Edge: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1',
|
platform: 'Android',
|
||||||
Firefox:
|
},
|
||||||
'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4',
|
{
|
||||||
},
|
title: 'Googlebot Desktop',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Googlebot Smartphone',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
{
|
||||||
|
title: 'Internet Explorer',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
title: 'Internet Explorer 11',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Internet Explorer 10',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Internet Explorer 9',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Internet Explorer 8',
|
||||||
|
value:
|
||||||
|
'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Internet Explorer 7',
|
||||||
|
value: 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge (Chromium) - Windows',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.0.0',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge (Chromium) - Mac',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/604.1 Edg/108.0.0.0',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge - iPhone',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge - iPad',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPad; CPU OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 EdgiOS/44.5.2 Mobile/15E148 Safari/605.1.15',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge - Android Mobile',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36 EdgA/42.0.0.2057',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge - Android Tablet',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Safari/537.36 EdgA/42.0.0.2057',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge (EdgeHTML) - Windows',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19042',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Microsoft Edge (EdgeHTML) - XBox',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; Xbox; Xbox One) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19041',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
title: 'Opera - Mac',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera - Windows',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera (Presto) - Mac',
|
||||||
|
value:
|
||||||
|
'Opera/9.80 (Macintosh; Intel Mac OS X 10.9.1) Presto/2.12.388 Version/12.16',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera (Presto) - Windows',
|
||||||
|
value: 'Opera/9.80 (Windows NT 6.1) Presto/2.12.388 Version/12.16',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera Mobile - Android Mobile',
|
||||||
|
value:
|
||||||
|
'Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Opera Mini - iOS',
|
||||||
|
value:
|
||||||
|
'Opera/9.80 (iPhone; Opera Mini/8.0.0/34.2336; U; en) Presto/2.8.119 Version/11.10',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Safari',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
title: 'Safari - iPad iOS 13.2',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPad; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Safari - iPhone iOS 13.2',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Safari - Mac',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'UC Browser',
|
||||||
|
values: [
|
||||||
|
{
|
||||||
|
title: 'UC Browser - Android Mobile',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (Linux; U; Android 8.1.0; en-US; Nexus 6P Build/OPM7.181205.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.108 UCBrowser/12.11.1.1197 Mobile Safari/537.36',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'UC Browser - iOS',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3)',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'UC Browser - Windows Phone',
|
||||||
|
value:
|
||||||
|
'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920) UCBrowser/10.1.0.563 Mobile',
|
||||||
|
platform: 'Android',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
export default userAgents
|
export default userAgents
|
||||||
|
|
|
||||||
66
src/utils/userAgentsOld.ts
Normal file
66
src/utils/userAgentsOld.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
const userAgents: any = {
|
||||||
|
Windows: {
|
||||||
|
platform: 'Win32',
|
||||||
|
userAgents: {
|
||||||
|
Chrome:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
Edge: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54',
|
||||||
|
Firefox:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0',
|
||||||
|
Opera:
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Mac: {
|
||||||
|
platform: 'MacIntel',
|
||||||
|
userAgents: {
|
||||||
|
Safari:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Safari/605.1.15',
|
||||||
|
Chrome:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
Edge: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.54',
|
||||||
|
Firefox:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/108.0',
|
||||||
|
Opera:
|
||||||
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36 OPR/65.0.3467.48',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
Linux: {
|
||||||
|
platform: 'Linux x86_64',
|
||||||
|
userAgents: {
|
||||||
|
Chrome:
|
||||||
|
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
|
||||||
|
Firefox:
|
||||||
|
'Mozilla/5.0 (X11; Linux x86_64; rv:108.0) Gecko/20100101 Firefox/108.0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Android: {
|
||||||
|
platform: 'Linux armv8l',
|
||||||
|
userAgents: {
|
||||||
|
Samsung:
|
||||||
|
'Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-G920P Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.2 Chrome/38.0.2125.102 Mobile Safari/E7FBAF',
|
||||||
|
Chrome:
|
||||||
|
'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36',
|
||||||
|
Edge: 'Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36 EdgA/42.0.0.2057',
|
||||||
|
Firefox:
|
||||||
|
'Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0',
|
||||||
|
Opera:
|
||||||
|
'Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
iOS: {
|
||||||
|
platform: 'iPhone',
|
||||||
|
userAgents: {
|
||||||
|
Safari:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
|
||||||
|
Chrome:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/108.0.0.0 Mobile/15E148 Safari/604.1',
|
||||||
|
Edge: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 EdgiOS/44.5.0.10 Mobile/15E148 Safari/604.1',
|
||||||
|
Firefox:
|
||||||
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default userAgents
|
||||||
Loading…
Add table
Reference in a new issue