diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-03-10 20:15:36 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2021-03-24 16:42:37 +0100 |
| commit | 60f78f5d4fdaeeee2e69bbe7c8026130902c80fd (patch) | |
| tree | 965ba7bade6a543623f30d09ccf957b0d691b5e3 /gui/src | |
| parent | 2cdb8b3839440a32f099f981638f9db7454f3e91 (diff) | |
| download | mullvadvpn-60f78f5d4fdaeeee2e69bbe7c8026130902c80fd.tar.xz mullvadvpn-60f78f5d4fdaeeee2e69bbe7c8026130902c80fd.zip | |
Limit openUrl to predefined URLs
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/config.json | 4 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 7 | ||||
| -rw-r--r-- | gui/src/renderer/components/ErrorBoundary.tsx | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/gui/src/config.json b/gui/src/config.json index 456da1ad02..59a214b604 100644 --- a/gui/src/config.json +++ b/gui/src/config.json @@ -1,11 +1,11 @@ { + "supportEmail": "support@mullvad.net", "links": { "purchase": "https://mullvad.net/account/", "manageKeys": "https://mullvad.net/account/ports/", "faq": "https://mullvad.net/help/tag/mullvad-app/", "download": "https://mullvad.net/download/", - "betaDownload": "https://mullvad.net/download/beta", - "supportEmail": "support@mullvad.net" + "betaDownload": "https://mullvad.net/download/beta" }, "colors": { "darkBlue": "rgb(25, 46, 69)", diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 84d5daaba1..a9ffc2175d 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -14,6 +14,7 @@ import moment from 'moment'; import * as path from 'path'; import { sprintf } from 'sprintf-js'; import * as uuid from 'uuid'; +import config from '../config.json'; import { hasExpired } from '../shared/account-expiry'; import BridgeSettingsBuilder from '../shared/bridge-settings-builder'; import { @@ -1186,7 +1187,11 @@ class ApplicationMain { }); IpcMainEventChannel.app.handleQuit(() => app.quit()); - IpcMainEventChannel.app.handleOpenUrl((url) => shell.openExternal(url)); + IpcMainEventChannel.app.handleOpenUrl(async (url) => { + if (Object.values(config.links).find((link) => url.startsWith(link))) { + await shell.openExternal(url); + } + }); IpcMainEventChannel.app.handleOpenPath((path) => shell.openPath(path)); IpcMainEventChannel.app.handleShowOpenDialog((options) => dialog.showOpenDialog(options)); } diff --git a/gui/src/renderer/components/ErrorBoundary.tsx b/gui/src/renderer/components/ErrorBoundary.tsx index 040ff71826..82e2910cc0 100644 --- a/gui/src/renderer/components/ErrorBoundary.tsx +++ b/gui/src/renderer/components/ErrorBoundary.tsx @@ -1,6 +1,6 @@ import React from 'react'; import styled from 'styled-components'; -import { colors, links } from '../../config.json'; +import { colors, supportEmail } from '../../config.json'; import { messages } from '../../shared/gettext'; import log from '../../shared/logging'; import PlatformWindowContainer from '../containers/PlatformWindowContainer'; @@ -71,7 +71,7 @@ export default class ErrorBoundary extends React.Component<IProps, IState> { messages .pgettext('error-boundary-view', 'Something went wrong. Please contact us at %(email)s') .split('%(email)s', 2); - reachBackMessage.splice(1, 0, <Email>{links.supportEmail}</Email>); + reachBackMessage.splice(1, 0, <Email>{supportEmail}</Email>); return ( <PlatformWindowContainer> |
