summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-10-07 16:25:58 +0200
committerLinus Färnstrand <linus@mullvad.net>2019-10-07 16:25:58 +0200
commit48d9e233e6bbe9c56372ee59324b786f770363d0 (patch)
tree00ed94738e56b11e77023e5d95ddc54a1a5b7116 /gui/src
parent2db11de43396abfe1f6a295d9fd22511898f7a07 (diff)
parent4c8ff3f8ec7baf674b95536a94e18e79440b428f (diff)
downloadmullvadvpn-48d9e233e6bbe9c56372ee59324b786f770363d0.tar.xz
mullvadvpn-48d9e233e6bbe9c56372ee59324b786f770363d0.zip
Merge branch 'cache-version-check-in-daemon'
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/main/daemon-rpc.ts3
-rw-r--r--gui/src/main/index.ts26
-rw-r--r--gui/src/shared/daemon-rpc-types.ts3
3 files changed, 7 insertions, 25 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts
index 6105f75c56..5fcc9171e0 100644
--- a/gui/src/main/daemon-rpc.ts
+++ b/gui/src/main/daemon-rpc.ts
@@ -368,6 +368,9 @@ const daemonEventSchema = oneOf(
object({
wireguard_key: keygenEventSchema,
}),
+ object({
+ app_version_info: appVersionInfoSchema,
+ }),
);
export class ResponseParseError extends Error {
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 9397d45467..0672effcca 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -48,8 +48,6 @@ import ReconnectionBackoff from './reconnection-backoff';
import TrayIconController, { TrayIconType } from './tray-icon-controller';
import WindowController from './window-controller';
-const VERSION_UPDATE_INTERVAL = 24 * 60 * 60 * 1000;
-
const DAEMON_RPC_PATH =
process.platform === 'win32' ? '//./pipe/Mullvad VPN' : '/var/run/mullvad-vpn';
@@ -141,7 +139,6 @@ class ApplicationMain {
latest: '',
nextUpgrade: undefined,
};
- private latestVersionInterval?: NodeJS.Timeout;
// The UI locale which is set once from onReady handler
private locale = 'en';
@@ -446,9 +443,6 @@ class ApplicationMain {
// fetch the latest version info in background
this.fetchLatestVersion();
- // start periodic updates
- this.startLatestVersionPeriodicUpdates();
-
// notify user about inconsistent version
if (
process.env.NODE_ENV !== 'development' &&
@@ -478,9 +472,6 @@ class ApplicationMain {
if (wasConnected) {
this.connectedToDaemon = false;
- // stop periodic updates
- this.stopLatestVersionPeriodicUpdates();
-
// update the tray icon to indicate that the computer is not secure anymore
this.updateTrayIcon({ state: 'disconnected' }, false);
@@ -540,6 +531,8 @@ class ApplicationMain {
);
} else if ('wireguardKey' in daemonEvent) {
this.handleWireguardKeygenEvent(daemonEvent.wireguardKey);
+ } else if ('appVersionInfo' in daemonEvent) {
+ this.setLatestVersion(daemonEvent.appVersionInfo);
}
},
(error: Error) => {
@@ -795,21 +788,6 @@ class ApplicationMain {
}
}
- private startLatestVersionPeriodicUpdates() {
- const handler = () => {
- this.fetchLatestVersion();
- };
- this.latestVersionInterval = global.setInterval(handler, VERSION_UPDATE_INTERVAL);
- }
-
- private stopLatestVersionPeriodicUpdates() {
- if (this.latestVersionInterval) {
- clearInterval(this.latestVersionInterval);
-
- this.latestVersionInterval = undefined;
- }
- }
-
private shouldSuppressNotifications(isCriticalNotification: boolean): boolean {
const isVisible = this.windowController ? this.windowController.isVisible() : false;
diff --git a/gui/src/shared/daemon-rpc-types.ts b/gui/src/shared/daemon-rpc-types.ts
index 346b766e1b..7ce5e93111 100644
--- a/gui/src/shared/daemon-rpc-types.ts
+++ b/gui/src/shared/daemon-rpc-types.ts
@@ -86,7 +86,8 @@ export type DaemonEvent =
| { tunnelState: TunnelState }
| { settings: ISettings }
| { relayList: IRelayList }
- | { wireguardKey: KeygenEvent };
+ | { wireguardKey: KeygenEvent }
+ | { appVersionInfo: IAppVersionInfo };
export interface ITunnelStateRelayInfo {
endpoint: ITunnelEndpoint;