summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2021-04-19 13:46:14 +0200
committerOskar Nyberg <oskar@mullvad.net>2021-07-02 16:15:01 +0200
commitdaf15f2916f99774429724aca4713734a85fee62 (patch)
treea8beff4d0e03a6245050255097747c46a6ee5f85 /gui/src
parentde95e3465268f0489b00bb1ee2c1a04fc54bb3e5 (diff)
downloadmullvadvpn-daf15f2916f99774429724aca4713734a85fee62.tar.xz
mullvadvpn-daf15f2916f99774429724aca4713734a85fee62.zip
Add warning about DNS not working for excluded apps when blocked
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/index.ts1
-rw-r--r--gui/src/main/notification-controller.ts3
-rw-r--r--gui/src/renderer/components/NotificationArea.tsx12
-rw-r--r--gui/src/shared/notifications/block-when-disconnected.ts11
-rw-r--r--gui/src/shared/notifications/error.ts53
5 files changed, 60 insertions, 20 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 37b7550cd5..77382451ea 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -732,6 +732,7 @@ class ApplicationMain {
this.notificationController.notifyTunnelState(
newState,
this.settings.blockWhenDisconnected,
+ this.settings.splitTunnel && this.settings.splitTunnelAppsList.length > 0,
this.accountData?.expiry,
);
diff --git a/gui/src/main/notification-controller.ts b/gui/src/main/notification-controller.ts
index 80eb14364a..ca0e12888f 100644
--- a/gui/src/main/notification-controller.ts
+++ b/gui/src/main/notification-controller.ts
@@ -51,6 +51,7 @@ export default class NotificationController {
public notifyTunnelState(
tunnelState: TunnelState,
blockWhenDisconnected: boolean,
+ hasExcludedApps: boolean,
accountExpiry?: string,
) {
const notificationProviders: SystemNotificationProvider[] = [
@@ -58,7 +59,7 @@ export default class NotificationController {
new ConnectedNotificationProvider(tunnelState),
new ReconnectingNotificationProvider(tunnelState),
new DisconnectedNotificationProvider({ tunnelState, blockWhenDisconnected }),
- new ErrorNotificationProvider({ tunnelState, accountExpiry }),
+ new ErrorNotificationProvider({ tunnelState, accountExpiry, hasExcludedApps }),
];
const notificationProvider = notificationProviders.find((notification) =>
diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx
index 2c2de14b35..40a553ac18 100644
--- a/gui/src/renderer/components/NotificationArea.tsx
+++ b/gui/src/renderer/components/NotificationArea.tsx
@@ -44,12 +44,20 @@ export default function NotificationArea(props: IProps) {
: undefined,
);
const wireGuardKey = useSelector((state: IReduxState) => state.settings.wireguardKeyState);
+ const hasExcludedApps = useSelector(
+ (state: IReduxState) =>
+ state.settings.splitTunneling && state.settings.splitTunnelingApplications.length > 0,
+ );
const notificationProviders: InAppNotificationProvider[] = [
new ConnectingNotificationProvider({ tunnelState }),
new ReconnectingNotificationProvider(tunnelState),
- new BlockWhenDisconnectedNotificationProvider({ tunnelState, blockWhenDisconnected }),
- new ErrorNotificationProvider({ tunnelState, accountExpiry }),
+ new BlockWhenDisconnectedNotificationProvider({
+ tunnelState,
+ blockWhenDisconnected,
+ hasExcludedApps,
+ }),
+ new ErrorNotificationProvider({ tunnelState, accountExpiry, hasExcludedApps }),
new NoValidKeyNotificationProvider({ tunnelProtocol, wireGuardKey }),
new InconsistentVersionNotificationProvider({ consistent: version.consistent }),
new UnsupportedVersionNotificationProvider(version),
diff --git a/gui/src/shared/notifications/block-when-disconnected.ts b/gui/src/shared/notifications/block-when-disconnected.ts
index fb19655993..6dcc3cc749 100644
--- a/gui/src/shared/notifications/block-when-disconnected.ts
+++ b/gui/src/shared/notifications/block-when-disconnected.ts
@@ -5,6 +5,7 @@ import { InAppNotification, InAppNotificationProvider } from './notification';
interface BlockWhenDisconnectedNotificationContext {
tunnelState: TunnelState;
blockWhenDisconnected: boolean;
+ hasExcludedApps: boolean;
}
export class BlockWhenDisconnectedNotificationProvider implements InAppNotificationProvider {
@@ -19,10 +20,18 @@ export class BlockWhenDisconnectedNotificationProvider implements InAppNotificat
}
public getInAppNotification(): InAppNotification {
+ let subtitle = messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.');
+ if (this.context.hasExcludedApps) {
+ subtitle = `${subtitle} ${messages.pgettext(
+ 'notifications',
+ 'The apps excluded with split tunneling might not work properly right now.',
+ )}`;
+ }
+
return {
indicator: 'warning',
title: messages.pgettext('in-app-notifications', 'BLOCKING INTERNET'),
- subtitle: messages.pgettext('in-app-notifications', '"Always require VPN" is enabled.'),
+ subtitle,
};
}
}
diff --git a/gui/src/shared/notifications/error.ts b/gui/src/shared/notifications/error.ts
index c5f15482dc..4ed97da301 100644
--- a/gui/src/shared/notifications/error.ts
+++ b/gui/src/shared/notifications/error.ts
@@ -11,6 +11,7 @@ import {
interface ErrorNotificationContext {
tunnelState: TunnelState;
accountExpiry?: string;
+ hasExcludedApps: boolean;
}
export class ErrorNotificationProvider
@@ -20,25 +21,45 @@ export class ErrorNotificationProvider
public mayDisplay = () => this.context.tunnelState.state === 'error';
public getSystemNotification() {
- return this.context.tunnelState.state === 'error'
- ? {
- message: getMessage(this.context.tunnelState.details, this.context.accountExpiry),
- critical: !!this.context.tunnelState.details.blockFailure,
- }
- : undefined;
+ if (this.context.tunnelState.state === 'error') {
+ let message = getMessage(this.context.tunnelState.details, this.context.accountExpiry);
+ if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) {
+ message = `${message} ${messages.pgettext(
+ 'notifications',
+ 'The apps excluded with split tunneling might not work properly right now.',
+ )}`;
+ }
+
+ return {
+ message,
+ critical: !!this.context.tunnelState.details.blockFailure,
+ };
+ } else {
+ return undefined;
+ }
}
public getInAppNotification(): InAppNotification | undefined {
- return this.context.tunnelState.state === 'error'
- ? {
- indicator:
- this.context.tunnelState.details.cause.reason === 'is_offline' ? 'warning' : 'error',
- title: !this.context.tunnelState.details.blockFailure
- ? messages.pgettext('in-app-notifications', 'BLOCKING INTERNET')
- : messages.pgettext('in-app-notifications', 'NETWORK TRAFFIC MIGHT BE LEAKING'),
- subtitle: getMessage(this.context.tunnelState.details, this.context.accountExpiry),
- }
- : undefined;
+ if (this.context.tunnelState.state === 'error') {
+ let subtitle = getMessage(this.context.tunnelState.details, this.context.accountExpiry);
+ if (!this.context.tunnelState.details.blockFailure && this.context.hasExcludedApps) {
+ subtitle = `${subtitle} ${messages.pgettext(
+ 'notifications',
+ 'The apps excluded with split tunneling might not work properly right now.',
+ )}`;
+ }
+
+ return {
+ indicator:
+ this.context.tunnelState.details.cause.reason === 'is_offline' ? 'warning' : 'error',
+ title: !this.context.tunnelState.details.blockFailure
+ ? messages.pgettext('in-app-notifications', 'BLOCKING INTERNET')
+ : messages.pgettext('in-app-notifications', 'NETWORK TRAFFIC MIGHT BE LEAKING'),
+ subtitle,
+ };
+ } else {
+ return undefined;
+ }
}
}