Fixed overriding timezone bug

This commit is contained in:
z0ccc 2022-05-05 14:30:45 -04:00
parent 27e0e414f9
commit b264e5f1bb
4 changed files with 21 additions and 16 deletions

View file

@ -27,11 +27,6 @@ const attachTab = (tabId, ipData) => {
// 'Emulation.clearGeolocationOverride'
// )
// chrome.debugger.sendCommand(
// { tabId: tabId },
// 'Emulation.clearIdleOverride'
// )
if (result.timezone) {
chrome.debugger.sendCommand(
{ tabId: tabId },
@ -88,7 +83,12 @@ const attachTab = (tabId, ipData) => {
}
chrome.tabs.onUpdated.addListener((tabId, change, tab) => {
chrome.debugger.getTargets((tabs) => {
const currentTab = tabs.find((obj) => obj.tabId === tabId)
if (!currentTab.attached) {
attachTab(tabId)
}
})
})
// const attachTabs = (ipData) => {

View file

@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react'
import detachDebugger from '../../utils/detachDebugger'
const DebugSettings = ({ type, title, ip }) => {
const [value, setValue] = useState('')
@ -27,6 +28,7 @@ const DebugSettings = ({ type, title, ip }) => {
chrome.storage.sync.set({ [matchIPStorage]: !matchIP })
setMatchIP(!matchIP)
}
// detachDebugger()
}
const toggleMatchIP = (e) => {

View file

@ -1,14 +1,5 @@
import React from 'react'
const detachDebugger = () => {
chrome.debugger.getTargets((tabs) => {
for (const tab in tabs) {
if (tabs[tab].attached && tabs[tab].tabId) {
chrome.debugger.detach({ tabId: tabs[tab].tabId })
}
}
})
}
import detachDebugger from '../../utils/detachDebugger'
const getFlagEmoji = (countryCode) => {
const codePoints = countryCode

View file

@ -0,0 +1,12 @@
const detachDebugger = () => {
chrome.debugger.getTargets((tabs) => {
console.log(tabs)
for (const tab in tabs) {
if (tabs[tab].attached && tabs[tab].tabId) {
chrome.debugger.detach({ tabId: tabs[tab].tabId })
}
}
})
}
export default detachDebugger