diff --git a/src/helpers/browserAction.ts b/src/helpers/browserAction.ts index 4c039ff8..715ed574 100644 --- a/src/helpers/browserAction.ts +++ b/src/helpers/browserAction.ts @@ -12,9 +12,9 @@ export const initBrowserAction = () => { const updateTabProxyBadge = async (tab: browser.tabs.Tab, activeProxyDetails: ProxyDetails) => { const { id: tabId, url } = tab; const { excludedHosts } = await browser.storage.local.get('excludedHosts'); - const tabHost = new URL(url!).host; + const tabHost = new URL(url!).hostname; - const isExcluded = excludedHosts?.includes(tabHost); + const isExcluded = tabHost.length !== 0 && excludedHosts?.includes(tabHost); if (isExcluded) { browser.browserAction.setTitle({ tabId, title: `${tabHost} is set to never be proxied` }); diff --git a/src/helpers/socksProxy.ts b/src/helpers/socksProxy.ts index 1447bdbb..8c68ff7a 100644 --- a/src/helpers/socksProxy.ts +++ b/src/helpers/socksProxy.ts @@ -21,7 +21,7 @@ const getHostProxyDetails = async (): Promise => { const proxiedHosts = Object.keys(hostProxiesDetailsParsed); const activeTab = await browser.tabs.query({ active: true }); - const activeTabHost = new URL(activeTab[0].url!).host; + const activeTabHost = new URL(activeTab[0].url!).hostname; if ( proxiedHosts.includes(activeTabHost) && hostProxiesDetailsParsed[activeTabHost].socksEnabled