diff options
| author | Oliver <oliver@mohlin.dev> | 2025-01-22 08:36:20 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2025-02-03 08:56:15 +0100 |
| commit | 2ee27df9ceccb6c52bdb6f9851f2b745590744ce (patch) | |
| tree | 8a79787c3ae9ba850c0de04e460812c46dd7770f | |
| parent | 5058bd6ec2306d3337e4524bfd0c6872e05378af (diff) | |
| download | mullvadvpn-2ee27df9ceccb6c52bdb6f9851f2b745590744ce.tar.xz mullvadvpn-2ee27df9ceccb6c52bdb6f9851f2b745590744ce.zip | |
Move links to constants
11 files changed, 18 insertions, 15 deletions
diff --git a/desktop/packages/mullvad-vpn/src/config.json b/desktop/packages/mullvad-vpn/src/config.json index a603139ba9..8490c32bf7 100644 --- a/desktop/packages/mullvad-vpn/src/config.json +++ b/desktop/packages/mullvad-vpn/src/config.json @@ -1,11 +1,5 @@ { "supportEmail": "support@mullvadvpn.net", - "links": { - "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/vpn/" - }, "strings": { "wireguard": "WireGuard", "openvpn": "OpenVPN", diff --git a/desktop/packages/mullvad-vpn/src/main/index.ts b/desktop/packages/mullvad-vpn/src/main/index.ts index f855278ba9..2140817167 100644 --- a/desktop/packages/mullvad-vpn/src/main/index.ts +++ b/desktop/packages/mullvad-vpn/src/main/index.ts @@ -4,12 +4,12 @@ import fs from 'fs'; import * as path from 'path'; import util from 'util'; -import config from '../config.json'; import { hasExpired } from '../shared/account-expiry'; import { ISplitTunnelingApplication, ISplitTunnelingAppListRetriever, } from '../shared/application-types'; +import { links } from '../shared/constants'; import { AccessMethodSetting, DaemonEvent, @@ -855,7 +855,7 @@ class ApplicationMain IpcMainEventChannel.app.handleQuit(() => this.disconnectAndQuit()); IpcMainEventChannel.app.handleOpenUrl(async (url) => { - if (Object.values(config.links).find((link) => url.startsWith(link))) { + if (Object.values(links).find((link) => url.startsWith(link))) { await shell.openExternal(url); } }); diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx index 115196a49d..ede19201a9 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect } from 'react'; -import { links } from '../../config.json'; import { formatDate, hasExpired } from '../../shared/account-expiry'; +import { links } from '../../shared/constants'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import { useHistory } from '../lib/history'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx index e1d6002d29..a3a94dd26e 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx @@ -3,8 +3,8 @@ import { useParams } from 'react-router'; import { sprintf } from 'sprintf-js'; import styled from 'styled-components'; -import { links } from '../../config.json'; import { formatDate } from '../../shared/account-expiry'; +import { links } from '../../shared/constants'; import { formatRelativeDate } from '../../shared/date-helper'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx index 744632c6ed..750268815e 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx @@ -1,7 +1,7 @@ import { createContext, ReactNode, useCallback, useContext, useMemo, useState } from 'react'; import { sprintf } from 'sprintf-js'; -import { links } from '../../config.json'; +import { links } from '../../shared/constants'; import { messages } from '../../shared/gettext'; import log from '../../shared/logging'; import { capitalizeEveryWord } from '../../shared/string-helpers'; diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx index 34f49a1c30..b2f34a89da 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import styled from 'styled-components'; -import { links } from '../../config.json'; +import { links } from '../../shared/constants'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import { useHistory } from '../lib/history'; diff --git a/desktop/packages/mullvad-vpn/src/shared/constants/index.ts b/desktop/packages/mullvad-vpn/src/shared/constants/index.ts new file mode 100644 index 0000000000..26f360af9e --- /dev/null +++ b/desktop/packages/mullvad-vpn/src/shared/constants/index.ts @@ -0,0 +1 @@ +export * from './links'; diff --git a/desktop/packages/mullvad-vpn/src/shared/constants/links.ts b/desktop/packages/mullvad-vpn/src/shared/constants/links.ts new file mode 100644 index 0000000000..e55adad68c --- /dev/null +++ b/desktop/packages/mullvad-vpn/src/shared/constants/links.ts @@ -0,0 +1,8 @@ +// This should only contain links to the mullvad website +// No links to other websites should be added +export const links = { + 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/vpn/', +} as const; diff --git a/desktop/packages/mullvad-vpn/src/shared/notifications/account-expired.ts b/desktop/packages/mullvad-vpn/src/shared/notifications/account-expired.ts index a7af4f2c8b..3c1684e15d 100644 --- a/desktop/packages/mullvad-vpn/src/shared/notifications/account-expired.ts +++ b/desktop/packages/mullvad-vpn/src/shared/notifications/account-expired.ts @@ -1,5 +1,5 @@ -import { links } from '../../config.json'; import { hasExpired } from '../account-expiry'; +import { links } from '../constants'; import { TunnelState } from '../daemon-rpc-types'; import { messages } from '../gettext'; import { diff --git a/desktop/packages/mullvad-vpn/src/shared/notifications/close-to-account-expiry.ts b/desktop/packages/mullvad-vpn/src/shared/notifications/close-to-account-expiry.ts index 4fde6ab395..c33cc1354e 100644 --- a/desktop/packages/mullvad-vpn/src/shared/notifications/close-to-account-expiry.ts +++ b/desktop/packages/mullvad-vpn/src/shared/notifications/close-to-account-expiry.ts @@ -1,8 +1,8 @@ import { sprintf } from 'sprintf-js'; -import { links } from '../../config.json'; import { messages } from '../../shared/gettext'; import { closeToExpiry, formatRemainingTime } from '../account-expiry'; +import { links } from '../constants'; import { InAppNotification, InAppNotificationProvider, diff --git a/desktop/packages/mullvad-vpn/src/shared/version.ts b/desktop/packages/mullvad-vpn/src/shared/version.ts index dc87afaae0..e8a3bc5b19 100644 --- a/desktop/packages/mullvad-vpn/src/shared/version.ts +++ b/desktop/packages/mullvad-vpn/src/shared/version.ts @@ -1,4 +1,4 @@ -import { links } from '../config.json'; +import { links } from './constants'; export function getDownloadUrl(suggestedIsBeta: boolean): string { let url = links.download; |
