summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOliver <oliver@mohlin.dev>2025-01-31 10:43:47 +0100
committerMarkus Pettersson <markus.pettersson@mullvad.net>2025-02-03 08:56:15 +0100
commite5dd6b271d1e8b253e2b93ee9076e01819d7ff79 (patch)
tree79bf2ca038c6c6046e0c5cb6dfcc7045e6f3d91f
parentf42fd8310673177f98ac98993600ae6e6efecb0a (diff)
downloadmullvadvpn-e5dd6b271d1e8b253e2b93ee9076e01819d7ff79.tar.xz
mullvadvpn-e5dd6b271d1e8b253e2b93ee9076e01819d7ff79.zip
Rename link constants and types to url
-rw-r--r--desktop/packages/mullvad-vpn/src/main/index.ts4
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/app.tsx6
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx4
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx4
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx4
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/Login.tsx4
-rw-r--r--desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx4
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/constants/index.ts2
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/constants/urls.ts (renamed from desktop/packages/mullvad-vpn/src/shared/constants/links.ts)8
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/notifications/account-expired.ts4
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/notifications/close-to-account-expiry.ts6
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts4
-rw-r--r--desktop/packages/mullvad-vpn/src/shared/version.ts8
13 files changed, 31 insertions, 31 deletions
diff --git a/desktop/packages/mullvad-vpn/src/main/index.ts b/desktop/packages/mullvad-vpn/src/main/index.ts
index 2140817167..fbdd581a09 100644
--- a/desktop/packages/mullvad-vpn/src/main/index.ts
+++ b/desktop/packages/mullvad-vpn/src/main/index.ts
@@ -9,7 +9,7 @@ import {
ISplitTunnelingApplication,
ISplitTunnelingAppListRetriever,
} from '../shared/application-types';
-import { links } from '../shared/constants';
+import { urls } 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(links).find((link) => url.startsWith(link))) {
+ if (Object.values(urls).find((link) => url.startsWith(link))) {
await shell.openExternal(url);
}
});
diff --git a/desktop/packages/mullvad-vpn/src/renderer/app.tsx b/desktop/packages/mullvad-vpn/src/renderer/app.tsx
index 5f416e7bd4..a90efd8037 100644
--- a/desktop/packages/mullvad-vpn/src/renderer/app.tsx
+++ b/desktop/packages/mullvad-vpn/src/renderer/app.tsx
@@ -9,7 +9,7 @@ import {
ILinuxSplitTunnelingApplication,
ISplitTunnelingApplication,
} from '../shared/application-types';
-import { Link } from '../shared/constants';
+import { Url } from '../shared/constants';
import {
AccessMethodSetting,
AccountNumber,
@@ -359,7 +359,7 @@ export default class AppRenderer {
IpcRendererEventChannel.problemReport.collectLogs(toRedact);
public viewLog = (path: string) => IpcRendererEventChannel.problemReport.viewLog(path);
public quit = () => IpcRendererEventChannel.app.quit();
- public openUrl = (url: Link) => IpcRendererEventChannel.app.openUrl(url);
+ public openUrl = (url: Url) => IpcRendererEventChannel.app.openUrl(url);
public getPathBaseName = (path: string) => IpcRendererEventChannel.app.getPathBaseName(path);
public showOpenDialog = (options: Electron.OpenDialogOptions) =>
IpcRendererEventChannel.app.showOpenDialog(options);
@@ -463,7 +463,7 @@ export default class AppRenderer {
return devices;
};
- public openLinkWithAuth = async (link: Link): Promise<void> => {
+ public openLinkWithAuth = async (link: Url): Promise<void> => {
let token = '';
try {
token = await IpcRendererEventChannel.account.getWwwAuthToken();
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx
index ede19201a9..6a7da779e7 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 { formatDate, hasExpired } from '../../shared/account-expiry';
-import { links } from '../../shared/constants';
+import { urls } from '../../shared/constants';
import { messages } from '../../shared/gettext';
import { useAppContext } from '../context';
import { useHistory } from '../lib/history';
@@ -33,7 +33,7 @@ export default function Account() {
const { updateAccountData, openLinkWithAuth, logout } = useAppContext();
const onBuyMore = useCallback(async () => {
- await openLinkWithAuth(links.purchase);
+ await openLinkWithAuth(urls.purchase);
}, [openLinkWithAuth]);
const onMount = useEffectEvent(() => updateAccountData());
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx
index a3a94dd26e..62a79a2064 100644
--- a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx
+++ b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountAddTime.tsx
@@ -4,7 +4,7 @@ import { sprintf } from 'sprintf-js';
import styled from 'styled-components';
import { formatDate } from '../../shared/account-expiry';
-import { links } from '../../shared/constants';
+import { urls } from '../../shared/constants';
import { formatRelativeDate } from '../../shared/date-helper';
import { messages } from '../../shared/gettext';
import { useAppContext } from '../context';
@@ -201,7 +201,7 @@ export function SetupFinished() {
const finish = useFinishedCallback();
const { openUrl } = useAppContext();
- const openPrivacyLink = useCallback(() => openUrl(links.privacyGuide), [openUrl]);
+ const openPrivacyLink = useCallback(() => openUrl(urls.privacyGuide), [openUrl]);
return (
<Layout>
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ExpiredAccountErrorView.tsx
index 750268815e..cac8a07a8e 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 '../../shared/constants';
+import { urls } from '../../shared/constants';
import { messages } from '../../shared/gettext';
import log from '../../shared/logging';
import { capitalizeEveryWord } from '../../shared/string-helpers';
@@ -188,7 +188,7 @@ function ExternalPaymentButton() {
if (recoveryAction === RecoveryAction.disableBlockedWhenDisconnected) {
setShowBlockWhenDisconnectedAlert(true);
} else {
- await openLinkWithAuth(links.purchase);
+ await openLinkWithAuth(urls.purchase);
}
}, [openLinkWithAuth, recoveryAction, setShowBlockWhenDisconnectedAlert]);
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Login.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Login.tsx
index d71e53395b..d7a2473389 100644
--- a/desktop/packages/mullvad-vpn/src/renderer/components/Login.tsx
+++ b/desktop/packages/mullvad-vpn/src/renderer/components/Login.tsx
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { sprintf } from 'sprintf-js';
-import { Link } from '../../shared/constants';
+import { Url } from '../../shared/constants';
import { AccountDataError, AccountNumber } from '../../shared/daemon-rpc-types';
import { messages } from '../../shared/gettext';
import { useAppContext } from '../context';
@@ -75,7 +75,7 @@ interface IProps {
accountHistory?: AccountNumber;
loginState: LoginState;
showBlockMessage: boolean;
- openExternalLink: (type: Link) => void;
+ openExternalLink: (type: Url) => void;
login: (accountNumber: AccountNumber) => void;
resetLoginError: () => void;
updateAccountNumber: (accountNumber: AccountNumber) => void;
diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Support.tsx
index b2f34a89da..a5c29ae453 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 '../../shared/constants';
+import { urls } from '../../shared/constants';
import { messages } from '../../shared/gettext';
import { useAppContext } from '../context';
import { useHistory } from '../lib/history';
@@ -86,7 +86,7 @@ function FaqButton() {
const isOffline = useSelector((state) => state.connection.isBlocked);
const { openUrl } = useAppContext();
- const openFaq = useCallback(() => openUrl(links.faq), [openUrl]);
+ const openFaq = useCallback(() => openUrl(urls.faq), [openUrl]);
return (
<AriaDescriptionGroup>
diff --git a/desktop/packages/mullvad-vpn/src/shared/constants/index.ts b/desktop/packages/mullvad-vpn/src/shared/constants/index.ts
index 9326f8434e..d2cc15e20f 100644
--- a/desktop/packages/mullvad-vpn/src/shared/constants/index.ts
+++ b/desktop/packages/mullvad-vpn/src/shared/constants/index.ts
@@ -1,2 +1,2 @@
-export * from './links';
+export * from './urls';
export * from './strings';
diff --git a/desktop/packages/mullvad-vpn/src/shared/constants/links.ts b/desktop/packages/mullvad-vpn/src/shared/constants/urls.ts
index 2d99ebd22c..24851e0a4c 100644
--- a/desktop/packages/mullvad-vpn/src/shared/constants/links.ts
+++ b/desktop/packages/mullvad-vpn/src/shared/constants/urls.ts
@@ -1,12 +1,12 @@
// This should only contain links to the mullvad website
// No links to other websites should be added
-export const links = {
+export const urls = {
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;
-type LinkValue = (typeof links)[keyof typeof links];
-type LinkWithSuffix = `${LinkValue}${string}`;
-export type Link = LinkValue | LinkWithSuffix;
+type BaseUrl = (typeof urls)[keyof typeof urls];
+type ExtendedBaseUrl = `${BaseUrl}${string}`;
+export type Url = BaseUrl | ExtendedBaseUrl;
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 3c1684e15d..8eff5379db 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 { hasExpired } from '../account-expiry';
-import { links } from '../constants';
+import { urls } from '../constants';
import { TunnelState } from '../daemon-rpc-types';
import { messages } from '../gettext';
import {
@@ -33,7 +33,7 @@ export class AccountExpiredNotificationProvider implements SystemNotificationPro
presentOnce: { value: true, name: this.constructor.name },
action: {
type: 'open-url',
- url: links.purchase,
+ url: urls.purchase,
withAuth: true,
text: messages.pgettext('notifications', 'Buy more'),
},
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 c33cc1354e..2e72938fae 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
@@ -2,7 +2,7 @@ import { sprintf } from 'sprintf-js';
import { messages } from '../../shared/gettext';
import { closeToExpiry, formatRemainingTime } from '../account-expiry';
-import { links } from '../constants';
+import { urls } from '../constants';
import {
InAppNotification,
InAppNotificationProvider,
@@ -44,7 +44,7 @@ export class CloseToAccountExpiryNotificationProvider
severity: SystemNotificationSeverityType.medium,
action: {
type: 'open-url',
- url: links.purchase,
+ url: urls.purchase,
withAuth: true,
text: messages.pgettext('notifications', 'Buy more'),
},
@@ -66,7 +66,7 @@ export class CloseToAccountExpiryNotificationProvider
indicator: 'warning',
title: messages.pgettext('in-app-notifications', 'ACCOUNT CREDIT EXPIRES SOON'),
subtitle,
- action: { type: 'open-url', url: links.purchase, withAuth: true },
+ action: { type: 'open-url', url: urls.purchase, withAuth: true },
};
}
}
diff --git a/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts b/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts
index bff0e9e57c..d46f344a09 100644
--- a/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts
+++ b/desktop/packages/mullvad-vpn/src/shared/notifications/notification.ts
@@ -1,9 +1,9 @@
import { LinkProps } from '../../renderer/lib/components';
-import { Link } from '../constants';
+import { Url } from '../constants';
export type NotificationAction = {
type: 'open-url';
- url: Link;
+ url: Url;
text?: string;
withAuth?: boolean;
};
diff --git a/desktop/packages/mullvad-vpn/src/shared/version.ts b/desktop/packages/mullvad-vpn/src/shared/version.ts
index 338077e6ec..afdf7ee9ca 100644
--- a/desktop/packages/mullvad-vpn/src/shared/version.ts
+++ b/desktop/packages/mullvad-vpn/src/shared/version.ts
@@ -1,7 +1,7 @@
-import { Link, links } from './constants';
+import { Url, urls } from './constants';
-export function getDownloadUrl(suggestedIsBeta: boolean): Link {
- let url: Link = links.download;
+export function getDownloadUrl(suggestedIsBeta: boolean): Url {
+ let url: Url = urls.download;
switch (process.platform ?? window.env.platform) {
case 'win32':
url += 'windows/';
@@ -18,5 +18,5 @@ export function getDownloadUrl(suggestedIsBeta: boolean): Link {
url += 'beta/';
}
- return url as Link;
+ return url as Url;
}