summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-09-28 13:10:32 +0200
committerOskar Nyberg <oskar@mullvad.net>2023-09-28 13:10:32 +0200
commitf5eaa62914c0353c7c6920b2881ada004fb76658 (patch)
treeaaae7dd7294bbde3ff3f9710b81777e142b3b5c7 /gui
parent8943529291df32a7ed4a35304f972b1d66860d22 (diff)
parent11942b1d08285aad439fd40a4a4806815e740cad (diff)
downloadmullvadvpn-f5eaa62914c0353c7c6920b2881ada004fb76658.tar.xz
mullvadvpn-f5eaa62914c0353c7c6920b2881ada004fb76658.zip
Merge branch 'open-download-urls-for-correct-platform-des-372'
Diffstat (limited to 'gui')
-rw-r--r--gui/src/config.json3
-rw-r--r--gui/src/renderer/components/ProblemReport.tsx4
-rw-r--r--gui/src/renderer/components/Settings.tsx11
-rw-r--r--gui/src/shared/notifications/unsupported-version.ts6
-rw-r--r--gui/src/shared/notifications/update-available.ts6
-rw-r--r--gui/src/shared/version.ts22
6 files changed, 37 insertions, 15 deletions
diff --git a/gui/src/config.json b/gui/src/config.json
index 117d99cbeb..b5d454fe4a 100644
--- a/gui/src/config.json
+++ b/gui/src/config.json
@@ -4,8 +4,7 @@
"purchase": "https://mullvad.net/account/",
"faq": "https://mullvad.net/help/tag/mullvad-app/",
"privacyGuide": "https://mullvad.net/help/first-steps-towards-online-privacy/",
- "download": "https://mullvad.net/download/",
- "betaDownload": "https://mullvad.net/download/beta"
+ "download": "https://mullvad.net/download/vpn/"
},
"colors": {
"darkBlue": "rgb(25, 46, 69)",
diff --git a/gui/src/renderer/components/ProblemReport.tsx b/gui/src/renderer/components/ProblemReport.tsx
index 907f9cb9e4..3a0a9bbd0e 100644
--- a/gui/src/renderer/components/ProblemReport.tsx
+++ b/gui/src/renderer/components/ProblemReport.tsx
@@ -12,8 +12,8 @@ import {
useState,
} from 'react';
-import { links } from '../../config.json';
import { messages } from '../../shared/gettext';
+import { getDownloadUrl } from '../../shared/version';
import { useAppContext } from '../context';
import useActions from '../lib/actionsHook';
import { useHistory } from '../lib/history';
@@ -326,7 +326,7 @@ function OutdatedVersionWarningDialog() {
}, []);
const openDownloadLink = useCallback(async () => {
- await openUrl(suggestedIsBeta ? links.betaDownload : links.download);
+ await openUrl(getDownloadUrl(suggestedIsBeta));
}, [suggestedIsBeta]);
const onClose = useCallback(() => history.pop(), [history.pop]);
diff --git a/gui/src/renderer/components/Settings.tsx b/gui/src/renderer/components/Settings.tsx
index 01becd27b6..26d40fb134 100644
--- a/gui/src/renderer/components/Settings.tsx
+++ b/gui/src/renderer/components/Settings.tsx
@@ -1,7 +1,8 @@
import { useCallback } from 'react';
-import { colors, links } from '../../config.json';
+import { colors } from '../../config.json';
import { messages } from '../../shared/gettext';
+import { getDownloadUrl } from '../../shared/version';
import { useAppContext } from '../context';
import { useHistory } from '../lib/history';
import { RoutePath } from '../lib/routes';
@@ -148,10 +149,10 @@ function AppVersionButton() {
const isOffline = useSelector((state) => state.connection.isBlocked);
const { openUrl } = useAppContext();
- const openDownloadLink = useCallback(
- () => openUrl(suggestedIsBeta ? links.betaDownload : links.download),
- [openUrl, suggestedIsBeta],
- );
+ const openDownloadLink = useCallback(() => openUrl(getDownloadUrl(suggestedIsBeta)), [
+ openUrl,
+ suggestedIsBeta,
+ ]);
let icon;
let footer;
diff --git a/gui/src/shared/notifications/unsupported-version.ts b/gui/src/shared/notifications/unsupported-version.ts
index 8c2f87460b..9d41bc268c 100644
--- a/gui/src/shared/notifications/unsupported-version.ts
+++ b/gui/src/shared/notifications/unsupported-version.ts
@@ -1,5 +1,5 @@
-import { links } from '../../config.json';
import { messages } from '../../shared/gettext';
+import { getDownloadUrl } from '../version';
import {
InAppNotification,
InAppNotificationProvider,
@@ -31,7 +31,7 @@ export class UnsupportedVersionNotificationProvider
severity: SystemNotificationSeverityType.high,
action: {
type: 'open-url',
- url: this.context.suggestedIsBeta ? links.betaDownload : links.download,
+ url: getDownloadUrl(this.context.suggestedIsBeta ?? false),
text: messages.pgettext('notifications', 'Upgrade'),
},
presentOnce: { value: true, name: this.constructor.name },
@@ -46,7 +46,7 @@ export class UnsupportedVersionNotificationProvider
subtitle: this.getMessage(),
action: {
type: 'open-url',
- url: this.context.suggestedIsBeta ? links.betaDownload : links.download,
+ url: getDownloadUrl(this.context.suggestedIsBeta ?? false),
},
};
}
diff --git a/gui/src/shared/notifications/update-available.ts b/gui/src/shared/notifications/update-available.ts
index 0394ef15a5..6f63bafd89 100644
--- a/gui/src/shared/notifications/update-available.ts
+++ b/gui/src/shared/notifications/update-available.ts
@@ -1,7 +1,7 @@
import { sprintf } from 'sprintf-js';
-import { links } from '../../config.json';
import { messages } from '../../shared/gettext';
+import { getDownloadUrl } from '../version';
import {
InAppNotification,
InAppNotificationProvider,
@@ -33,7 +33,7 @@ export class UpdateAvailableNotificationProvider
subtitle: this.inAppMessage(),
action: {
type: 'open-url',
- url: this.context.suggestedIsBeta ? links.betaDownload : links.download,
+ url: getDownloadUrl(this.context.suggestedIsBeta ?? false),
},
};
}
@@ -45,7 +45,7 @@ export class UpdateAvailableNotificationProvider
severity: SystemNotificationSeverityType.medium,
action: {
type: 'open-url',
- url: this.context.suggestedIsBeta ? links.betaDownload : links.download,
+ url: getDownloadUrl(this.context.suggestedIsBeta ?? false),
text: messages.pgettext('notifications', 'Upgrade'),
},
presentOnce: { value: true, name: this.constructor.name },
diff --git a/gui/src/shared/version.ts b/gui/src/shared/version.ts
new file mode 100644
index 0000000000..dc87afaae0
--- /dev/null
+++ b/gui/src/shared/version.ts
@@ -0,0 +1,22 @@
+import { links } from '../config.json';
+
+export function getDownloadUrl(suggestedIsBeta: boolean): string {
+ let url = links.download;
+ switch (process.platform ?? window.env.platform) {
+ case 'win32':
+ url += 'windows/';
+ break;
+ case 'linux':
+ url += 'linux/';
+ break;
+ case 'darwin':
+ url += 'macos/';
+ break;
+ }
+
+ if (suggestedIsBeta) {
+ url += 'beta/';
+ }
+
+ return url;
+}