user agent age update

This commit is contained in:
z0ccc 2022-12-25 00:12:44 -05:00
parent fcabda87f5
commit 2ab3089f8f
5 changed files with 475 additions and 195 deletions

View file

@ -9,7 +9,7 @@ interface CheckBoxProps {
const CheckBox = ({ title, onChange, checked }: CheckBoxProps) => {
return (
<Label sx={{ mb: '8px' }}>
<Label sx={{ mb: '8px', cursor: 'pointer' }}>
<Checkbox onChange={onChange} checked={checked} />
{title}
</Label>

View file

@ -1,5 +1,6 @@
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 userAgents from '../../../utils/userAgents'
import detachDebugger from '../../../utils/detachDebugger'
@ -10,77 +11,56 @@ interface UserAgentPageProps {
}
const UserAgentPage = ({ tab }: UserAgentPageProps) => {
const [userAgentType, setUserAgentType] = useState('default')
const [operatingSystem, setOperatingSystem] = useState('Windows')
const [browser, setBrowser] = useState('Chrome')
const [browserDefault, setBrowserDefault] = useState(true)
const [userAgentInfo, setUserAgentInfo] = useState('')
const [userAgent, setUserAgent] = useState('')
const [platform, setPlatform] = useState('')
useEffect(() => {
chrome.storage.local.get(
['userAgentType', 'operatingSystem', 'browser', 'userAgent', 'platform'],
['userAgentBrowserDefault', 'userAgentInfo', 'userAgent', 'platform'],
(storage) => {
storage.userAgentType && setUserAgentType(storage.userAgentType)
storage.operatingSystem && setOperatingSystem(storage.operatingSystem)
storage.browser && setBrowser(storage.browser)
storage.userAgentBrowserDefault !== undefined &&
setBrowserDefault(storage.userAgentBrowserDefault)
storage.userAgentInfo && setUserAgentInfo(storage.userAgentInfo)
storage.userAgent && setUserAgent(storage.userAgent)
storage.platform && setPlatform(storage.platform)
}
)
}, [])
const changeType = (e: ChangeEvent<HTMLInputElement>) => {
detachDebugger()
setUserAgentType(e.target.value)
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'],
})
const changeBrowserDefault = () => {
if (!browserDefault) {
detachDebugger()
}
chrome.storage.local.set({
userAgentBrowserDefault: !browserDefault,
})
setBrowserDefault(!browserDefault)
}
const changeOperatingSystem = async (e: ChangeEvent<HTMLSelectElement>) => {
const changeUserAgentInfo = async (e: ChangeEvent<HTMLSelectElement>) => {
detachDebugger()
setOperatingSystem(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'])
setUserAgentInfo(e.target.value)
chrome.storage.local.set({
userAgent: userAgents[e.target.value]['userAgents'][browserValue],
platform: userAgents[e.target.value]['platform'],
operatingSystem: e.target.value,
userAgentInfo: e.target.value,
})
}
const changeBrowser = (e: ChangeEvent<HTMLSelectElement>) => {
detachDebugger()
setBrowser(e.target.value)
setUserAgent(userAgents[operatingSystem]['userAgents'][e.target.value])
chrome.storage.local.set({
userAgent: userAgents[operatingSystem]['userAgents'][e.target.value],
browser: e.target.value,
})
if (e.target.value !== 'custom') {
const userAgentObj = JSON.parse(e.target.value)
setUserAgent(userAgentObj.value)
setPlatform(userAgentObj.platform)
chrome.storage.local.set({
userAgent: userAgentObj.value,
platform: userAgentObj.platform,
})
}
}
const changeTextInput = () => {
if (userAgentType !== 'custom') {
setUserAgentType('custom')
if (userAgentInfo !== 'custom') {
setUserAgentInfo('custom')
chrome.storage.local.set({
userAgentType: 'custom',
})
@ -89,94 +69,56 @@ const UserAgentPage = ({ tab }: UserAgentPageProps) => {
return (
<Page isCurrentTab={tab === 'userAgent'} title={'User Agent'}>
<Flex
<Checkbox
title="Use browser default"
onChange={changeBrowserDefault}
checked={browserDefault}
/>
<Box
sx={{
justifyContent: 'space-between',
mb: '8px',
opacity: browserDefault ? '0.5' : '1',
pointerEvents: browserDefault ? 'none' : 'auto',
}}
>
<Label>
<Radio
name="userAgentType"
value="default"
onChange={changeType}
checked={userAgentType === 'default'}
/>
Default
</Label>
<Label>
<Radio
name="userAgentType"
value="preloaded"
onChange={changeType}
checked={userAgentType === 'preloaded'}
/>
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}
<Box sx={{ width: '100%' }}>
<Label htmlFor="type">Type</Label>
<Select
name="type"
id="type"
value={userAgentInfo}
onChange={changeUserAgentInfo}
mb={'8px'}
>
<option value="custom">Custom</option>
{Object.keys(userAgents).map((key) => (
<optgroup key={key} label={userAgents[key].title}>
{userAgents[key].values.map((key: any) => (
<option key={key.value} value={JSON.stringify(key)}>
{key.title}
</option>
)
)}
</Select>
</Box>
</Flex>
)}
<DebouncedInput
name="userAgent"
title="User Agent"
value={userAgent}
setValue={setUserAgent}
onChange={changeTextInput}
mb="12px"
/>
<DebouncedInput
name="platform"
title="Platform"
value={platform}
setValue={setPlatform}
onChange={changeTextInput}
mb="12px"
/>
))}
</optgroup>
))}
</Select>
</Box>
<DebouncedInput
name="userAgent"
title="User Agent"
value={userAgent}
setValue={setUserAgent}
onChange={changeTextInput}
mb="12px"
/>
<DebouncedInput
name="platform"
title="Platform"
value={platform}
setValue={setPlatform}
onChange={changeTextInput}
mb="12px"
/>
</Box>
</Page>
)
}

View file

@ -12,6 +12,7 @@ const attachDebugger = (tabId: number) => {
'localeMatchIP',
'userAgent',
'platform',
'userAgentBrowserDefault',
],
(storage) => {
if (
@ -69,7 +70,10 @@ const attachDebugger = (tabId: number) => {
)
}
if (storage.userAgent || storage.platform) {
if (
!storage.userAgentBrowserDefault &&
(storage.userAgent || storage.platform)
) {
chrome.debugger.sendCommand(
{ tabId: tabId },
'Emulation.setUserAgentOverride',

View file

@ -1,66 +1,334 @@
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',
},
const userAgents: any = [
{
title: 'Android',
values: [
{
title: 'Android (4.0.2) Browser - Galaxy Nexus',
value:
'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',
platform: 'Android',
},
{
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',
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',
},
{
title: 'BlackBerry',
values: [
{
title: 'BlackBerry - BB10',
value:
'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+',
platform: 'Android',
},
{
title: 'BlackBerry - PlayBook 2.1',
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: {
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',
},
{
title: 'Chrome',
values: [
{
title: 'Chrome - Android Mobile',
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',
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',
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',
},
{
title: 'Firefox',
values: [
{
title: 'Firefox - Android Mobile',
value:
'Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0',
platform: 'Android',
},
{
title: 'Firefox - Android Tablet',
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',
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',
},
{
title: 'Googlebot',
values: [
{
title: 'Googlebot',
value:
'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
platform: 'Android',
},
{
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

View 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