summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorJonathan <jonathan@mullvad.net>2023-06-22 09:46:15 +0200
committerJonathan <jonathan@mullvad.net>2023-06-29 15:00:08 +0200
commit521d4e30fcd2bd52484ddb3d41ecbcfbf353b28f (patch)
treed5c9296e25a90ce6c8d7391053a9c7ad40924c7d /gui/src
parent432b0016b2c7b27f0a254507b20a464a9f4cf111 (diff)
downloadmullvadvpn-521d4e30fcd2bd52484ddb3d41ecbcfbf353b28f.tar.xz
mullvadvpn-521d4e30fcd2bd52484ddb3d41ecbcfbf353b28f.zip
Update changelog, sync naming in .proto update gui
Updates the changelog, syncs naming to be consistent inside the .proto file with rust in regards to newly added message types for custom lists. Update the gui so that it does not break when using a custom list daemon. However does not let gui actually use custom lists, only has CLI support.
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/daemon-rpc.ts32
1 files changed, 21 insertions, 11 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index f3b744e522..e2a909b756 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -1228,15 +1228,25 @@ function convertFromConnectionConfig(
}
}
-function convertFromLocation(location: grpcTypes.RelayLocation.AsObject): RelayLocation {
- if (location.hostname) {
- return { hostname: [location.country, location.city, location.hostname] };
- }
- if (location.city) {
- return { city: [location.country, location.city] };
+function convertFromLocation(location: grpcTypes.LocationConstraint.AsObject): RelayLocation {
+ // FIXME: This is a hack that assumes that the LocationConstraint is not a custom list.
+ // If it is we just set the country to "any" even if that isn't correct.
+ if (location.location == undefined) {
+ return { country: "any" };
}
+ else {
+ const loc = location.location;
+
+ if (loc.hostname) {
+ return { hostname: [loc.country, loc.city, loc.hostname] };
+ }
- return { country: location.country };
+ if (loc.city) {
+ return { city: [loc.country, loc.city] };
+ }
+
+ return { country: loc.country };
+ }
}
function convertFromTunnelOptions(tunnelOptions: grpcTypes.TunnelOptions.AsObject): ITunnelOptions {
@@ -1455,24 +1465,24 @@ function convertToNormalBridgeSettings(
function convertToLocation(
constraint: RelayLocation | undefined,
-): grpcTypes.RelayLocation | undefined {
+): grpcTypes.LocationConstraint | undefined {
+ const locationConstraint = new grpcTypes.LocationConstraint();
const location = new grpcTypes.RelayLocation();
if (constraint && 'hostname' in constraint) {
const [countryCode, cityCode, hostname] = constraint.hostname;
location.setCountry(countryCode);
location.setCity(cityCode);
location.setHostname(hostname);
- return location;
} else if (constraint && 'city' in constraint) {
location.setCountry(constraint.city[0]);
location.setCity(constraint.city[1]);
- return location;
} else if (constraint && 'country' in constraint) {
location.setCountry(constraint.country);
- return location;
} else {
return undefined;
}
+ locationConstraint.setLocation(location);
+ return locationConstraint;
}
function convertToTunnelTypeConstraint(