From fa799daf05d8b4f70a08b6f6cacca16c4a15cbac Mon Sep 17 00:00:00 2001 From: z0ccc Date: Sat, 16 Apr 2022 13:39:09 -0400 Subject: [PATCH] Added custom locales to debugger --- src/pages/Background/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/pages/Background/index.js b/src/pages/Background/index.js index 8815deb..51833c6 100644 --- a/src/pages/Background/index.js +++ b/src/pages/Background/index.js @@ -1,6 +1,5 @@ import countryLocales from '../../utils/countryLocales' - const attachTab = (tabId, ipData) => { chrome.storage.sync.get( [ @@ -11,6 +10,8 @@ const attachTab = (tabId, ipData) => { 'latitudeMatchIP', 'lon', 'longitudeMatchIP', + 'locale', + 'localeMatchIP', ], (result) => { chrome.debugger.attach({ tabId: tabId }, '1.3', function () { @@ -38,7 +39,11 @@ const attachTab = (tabId, ipData) => { chrome.debugger.sendCommand( { tabId: tabId }, 'Emulation.setLocaleOverride', - { locale: countryLocales[result.ipData.countryCode].locale } + { + locale: result.localeMatchIP + ? countryLocales[result.ipData.countryCode].locale + : result.locale, + } ) const latitude = result.latMatchIP @@ -48,8 +53,6 @@ const attachTab = (tabId, ipData) => { ? result.ipData.lon : parseFloat(result.lon) - console.log(latitude, longitude) - chrome.debugger.sendCommand( { tabId: tabId }, 'Emulation.setGeolocationOverride',