Skip to content

Commit

Permalink
Refresh the extension badge when toggling proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihildt committed Apr 18, 2024
1 parent 9089b8d commit 8b90c28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/composables/useSocksProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ProxyInfoType,
ProxyOperationArgs,
} from '@/helpers/socksProxy.types';
import { updateTabsProxyBadges } from '@/helpers/browserAction';

import useActiveTab from '@/composables/useActiveTab';
import useConnection from '@/composables/useConnection';
Expand Down Expand Up @@ -36,9 +37,11 @@ const currentHostProxyDNSEnabled = computed(() => currentHostProxyDetails.value?

const toggleGlobalProxy = () => {
globalProxyDetails.value.socksEnabled = !globalProxyDetails.value.socksEnabled;
updateTabsProxyBadges();
};
const toggleCurrentHostProxy = () => {
hostProxiesDetails.value[activeTabHost.value].socksEnabled = !currentHostProxyEnabled.value;
updateTabsProxyBadges();
};

const toggleGlobalProxyDNS = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/browserAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const updateTabProxyBadge = async (tab: browser.tabs.Tab, activeProxyDetails: Pr
};

// Update state of the proxy badge & title, for all tabs
const updateTabsProxyBadges = async () => {
export const updateTabsProxyBadges = async () => {
const tabs = await browser.tabs.query({});
const activeProxyDetails = await getActiveProxyDetails();

Expand Down

0 comments on commit 8b90c28

Please sign in to comment.