diff options
| author | Tobias Järvelöv <tobias.jarvelov@mullvad.net> | 2025-03-05 16:02:05 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-03-10 10:14:20 +0100 |
| commit | ffb076c8e62a8fd30e57643dd17981a6aef15b31 (patch) | |
| tree | 0cf2810925fe6dc4e868485ba2446834e79967b9 | |
| parent | e434bf2be055facb588e59f4a96fbdac73d077c0 (diff) | |
| download | mullvadvpn-ffb076c8e62a8fd30e57643dd17981a6aef15b31.tar.xz mullvadvpn-ffb076c8e62a8fd30e57643dd17981a6aef15b31.zip | |
Remove parameter relaySettings in getTunnelProtocolFilter
We only used the relaySettings parameter to
handle when tunnel protocol was set to "any"
to potentially enable "openvpn" endpoints if
multihop was not enabled.
However, as the tunnel protocol now has to be
explicitly assigned to either "wireguard" or
"openvpn" we should only enable endpoints which
matches the tunnel protocol so we don't need
to check the multihop setting, as it has to be
disabled for the user to switch the tunnel
protocol to "openvpn"
3 files changed, 6 insertions, 26 deletions
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Filter.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Filter.tsx index d63caffe6d..aa08ade946 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/Filter.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/Filter.tsx @@ -114,7 +114,6 @@ export default function Filter() { // Returns only the ownership options that are compatible with the other filters function useFilteredOwnershipOptions(providers: string[], ownership: Ownership): Ownership[] { - const relaySettings = useNormalRelaySettings(); const tunnelProtocol = useTunnelProtocol(); const bridgeState = useSelector((state) => state.settings.bridgeState); const locations = useSelector((state) => state.settings.relayLocations); @@ -126,7 +125,6 @@ function useFilteredOwnershipOptions(providers: string[], ownership: Ownership): locations, endpointType, tunnelProtocol, - relaySettings, ); const relaylistForFilters = filterLocations(relayListForEndpointType, ownership, providers); @@ -143,14 +141,13 @@ function useFilteredOwnershipOptions(providers: string[], ownership: Ownership): } return ownershipOptions; - }, [locations, endpointType, tunnelProtocol, relaySettings, ownership, providers]); + }, [locations, endpointType, tunnelProtocol, ownership, providers]); return availableOwnershipOptions; } // Returns only the providers that are compatible with the other filters export function useFilteredProviders(providers: string[], ownership: Ownership): string[] { - const relaySettings = useNormalRelaySettings(); const tunnelProtocol = useTunnelProtocol(); const bridgeState = useSelector((state) => state.settings.bridgeState); const locations = useSelector((state) => state.settings.relayLocations); @@ -162,11 +159,10 @@ export function useFilteredProviders(providers: string[], ownership: Ownership): locations, endpointType, tunnelProtocol, - relaySettings, ); const relaylistForFilters = filterLocations(relayListForEndpointType, ownership, providers); return providersFromRelays(relaylistForFilters); - }, [endpointType, locations, ownership, providers, relaySettings, tunnelProtocol]); + }, [endpointType, locations, ownership, providers, tunnelProtocol]); return availableProviders; } @@ -188,12 +184,7 @@ function useProviders(): Record<string, boolean> { const endpointType = tunnelProtocol === 'openvpn' && bridgeState === 'on' ? EndpointType.any : EndpointType.exit; - const relays = filterLocationsByEndPointType( - relayLocations, - endpointType, - tunnelProtocol, - relaySettings, - ); + const relays = filterLocationsByEndPointType(relayLocations, endpointType, tunnelProtocol); const providers = providersFromRelays(relays); // Empty containt array means that all providers are selected. No selection isn't possible. diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/RelayListContext.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/RelayListContext.tsx index 693d1ae143..07b2aa9c62 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/select-location/RelayListContext.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/select-location/RelayListContext.tsx @@ -78,13 +78,8 @@ export function RelayListContextProvider(props: RelayListContextProviderProps) { const relayListForEndpointType = useMemo(() => { const endpointType = locationType === LocationType.entry ? EndpointType.entry : EndpointType.exit; - return filterLocationsByEndPointType( - fullRelayList, - endpointType, - tunnelProtocol, - relaySettings, - ); - }, [fullRelayList, locationType, relaySettings, tunnelProtocol]); + return filterLocationsByEndPointType(fullRelayList, endpointType, tunnelProtocol); + }, [fullRelayList, locationType, tunnelProtocol]); const relayListForDaita = useMemo(() => { return filterLocationsByDaita( diff --git a/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts b/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts index f4725a4d92..f73bd14a9e 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts +++ b/desktop/packages/mullvad-vpn/src/renderer/lib/filter-locations.ts @@ -16,7 +16,6 @@ import { IRelayLocationCityRedux, IRelayLocationCountryRedux, IRelayLocationRelayRedux, - NormalRelaySettingsRedux, } from '../redux/settings/reducers'; export enum EndpointType { @@ -29,12 +28,8 @@ export function filterLocationsByEndPointType( locations: IRelayLocationCountryRedux[], endpointType: EndpointType, tunnelProtocol: TunnelProtocol, - relaySettings?: NormalRelaySettingsRedux, ): IRelayLocationCountryRedux[] { - return filterLocationsImpl( - locations, - getTunnelProtocolFilter(endpointType, tunnelProtocol, relaySettings), - ); + return filterLocationsImpl(locations, getTunnelProtocolFilter(endpointType, tunnelProtocol)); } export function filterLocationsByDaita( @@ -78,7 +73,6 @@ export function filterLocations( function getTunnelProtocolFilter( endpointType: EndpointType, tunnelProtocol: TunnelProtocol, - relaySettings?: NormalRelaySettingsRedux, ): (relay: IRelayLocationRelayRedux) => boolean { const endpointTypes: Array<RelayEndpointType> = []; if (endpointType !== EndpointType.exit && tunnelProtocol === 'openvpn') { |
