Fixed bugs with user agent

This commit is contained in:
z0ccc 2022-05-01 20:52:33 -04:00
parent 18f30a7025
commit 65dc85ee4f
3 changed files with 23 additions and 20 deletions

View file

@ -27,15 +27,15 @@ const attachTab = (tabId, ipData) => {
// 'Emulation.clearIdleOverride'
// )
chrome.debugger.sendCommand(
{ tabId: tabId },
'Emulation.setTimezoneOverride',
{
timezoneId: result.timezoneMatchIP
? result.ipData.timezone
: result.timezone,
}
)
if (result.timezone) {
chrome.debugger.sendCommand(
{ tabId: tabId },
'Emulation.setTimezoneOverride',
{
timezoneId: result.timezone,
}
)
}
console.log(
result.localeMatchIP,
@ -48,15 +48,15 @@ const attachTab = (tabId, ipData) => {
: result.locale
)
chrome.debugger.sendCommand(
{ tabId: tabId },
'Emulation.setLocaleOverride',
{
locale: result.localeMatchIP
? countryLocales[result.ipData.countryCode].locale
: result.locale,
}
)
if (result.locale) {
chrome.debugger.sendCommand(
{ tabId: tabId },
'Emulation.setLocaleOverride',
{
locale: result.locale,
}
)
}
const latitude = result.latMatchIP
? result.ipData.lat

View file

@ -30,7 +30,10 @@ const DebugSettings = ({ type, title, ip }) => {
}
const toggleMatchIP = (e) => {
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
chrome.storage.sync.set({
[type]: ip[type],
[matchIPStorage]: !matchIP,
})
!matchIP && setValue(ip[type])
setMatchIP(e.target.checked)
}

View file

@ -29,7 +29,7 @@ const UserAgentSettings = () => {
const randomUserAgent =
userAgents[Math.floor(Math.random() * userAgents.length)]
chrome.storage.sync.set({
randomize: randomUserAgent,
userAgent: randomUserAgent,
randomUA: e.target.checked,
})
e.target.checked ? setUserAgent(randomUserAgent) : setUserAgent('')