Fixed bugs with user agent
This commit is contained in:
parent
6f202aeae5
commit
867b9ef33d
3 changed files with 23 additions and 20 deletions
|
|
@ -27,15 +27,15 @@ const attachTab = (tabId, ipData) => {
|
||||||
// 'Emulation.clearIdleOverride'
|
// 'Emulation.clearIdleOverride'
|
||||||
// )
|
// )
|
||||||
|
|
||||||
chrome.debugger.sendCommand(
|
if (result.timezone) {
|
||||||
{ tabId: tabId },
|
chrome.debugger.sendCommand(
|
||||||
'Emulation.setTimezoneOverride',
|
{ tabId: tabId },
|
||||||
{
|
'Emulation.setTimezoneOverride',
|
||||||
timezoneId: result.timezoneMatchIP
|
{
|
||||||
? result.ipData.timezone
|
timezoneId: result.timezone,
|
||||||
: result.timezone,
|
}
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
result.localeMatchIP,
|
result.localeMatchIP,
|
||||||
|
|
@ -48,15 +48,15 @@ const attachTab = (tabId, ipData) => {
|
||||||
: result.locale
|
: result.locale
|
||||||
)
|
)
|
||||||
|
|
||||||
chrome.debugger.sendCommand(
|
if (result.locale) {
|
||||||
{ tabId: tabId },
|
chrome.debugger.sendCommand(
|
||||||
'Emulation.setLocaleOverride',
|
{ tabId: tabId },
|
||||||
{
|
'Emulation.setLocaleOverride',
|
||||||
locale: result.localeMatchIP
|
{
|
||||||
? countryLocales[result.ipData.countryCode].locale
|
locale: result.locale,
|
||||||
: result.locale,
|
}
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
|
|
||||||
const latitude = result.latMatchIP
|
const latitude = result.latMatchIP
|
||||||
? result.ipData.lat
|
? result.ipData.lat
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,10 @@ const DebugSettings = ({ type, title, ip }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleMatchIP = (e) => {
|
const toggleMatchIP = (e) => {
|
||||||
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
|
chrome.storage.sync.set({
|
||||||
|
[type]: ip[type],
|
||||||
|
[matchIPStorage]: !matchIP,
|
||||||
|
})
|
||||||
!matchIP && setValue(ip[type])
|
!matchIP && setValue(ip[type])
|
||||||
setMatchIP(e.target.checked)
|
setMatchIP(e.target.checked)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const UserAgentSettings = () => {
|
||||||
const randomUserAgent =
|
const randomUserAgent =
|
||||||
userAgents[Math.floor(Math.random() * userAgents.length)]
|
userAgents[Math.floor(Math.random() * userAgents.length)]
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
randomize: randomUserAgent,
|
userAgent: randomUserAgent,
|
||||||
randomUA: e.target.checked,
|
randomUA: e.target.checked,
|
||||||
})
|
})
|
||||||
e.target.checked ? setUserAgent(randomUserAgent) : setUserAgent('')
|
e.target.checked ? setUserAgent(randomUserAgent) : setUserAgent('')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue