diff --git a/README.md b/README.md index a53f74dfda6e..584447258ed8 100644 --- a/README.md +++ b/README.md @@ -283,7 +283,6 @@ If you're using GNOME, try installing one of these GNOME Shell extensions: - **app.tsx** - Entry file for the renderer process - **routes.tsx** - Routes configurator - **transitions.ts** - Transition rules between views - - **config.json** - App color definitions and URLs to external resources - **tasks/** - Gulp tasks used to build app and watch for changes during development - **distribution.js** - Configuration for `electron-builder` - **test/** - Electron GUI tests diff --git a/desktop/packages/mullvad-vpn/src/config.json b/desktop/packages/mullvad-vpn/src/config.json deleted file mode 100644 index a77c47de4501..000000000000 --- a/desktop/packages/mullvad-vpn/src/config.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "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/" - }, - "colors": { - "darkerBlue": "rgba(25, 38, 56, 0.95)", - "darkBlue": "rgb(25, 46, 69)", - "blue": "rgb(41, 77, 115)", - "darkGreen": "rgb(32, 84, 37)", - "green": "rgb(68, 173, 77)", - "red": "rgb(227, 64, 57)", - "darkYellow": "rgb(142, 78, 19)", - "yellow": "rgb(255, 213, 36)", - "black": "rgb(0, 0, 0)", - "white": "rgb(255, 255, 255)", - "white90": "rgba(255, 255, 255, 0.9)", - "white80": "rgba(255, 255, 255, 0.8)", - "white60": "rgba(255, 255, 255, 0.6)", - "white50": "rgba(255, 255, 255, 0.5)", - "white40": "rgba(255, 255, 255, 0.4)", - "white20": "rgba(255, 255, 255, 0.2)", - "white10": "rgba(255, 255, 255, 0.1)", - "blue10": "rgba(41, 77, 115, 0.1)", - "blue20": "rgba(41, 77, 115, 0.2)", - "blue40": "rgba(41, 77, 115, 0.4)", - "blue50": "rgba(41, 77, 115, 0.5)", - "blue60": "rgba(41, 77, 115, 0.6)", - "blue80": "rgba(41, 77, 115, 0.8)", - "red95": "rgba(227, 64, 57, 0.95)", - "red80": "rgba(227, 64, 57, 0.8)", - "red60": "rgba(227, 64, 57, 0.6)", - "red40": "rgba(227, 64, 57, 0.4)", - "red45": "rgba(227, 64, 57, 0.45)", - "green90": "rgba(68, 173, 77, 0.9)", - "green40": "rgba(68, 173, 77, 0.4)" - }, - "strings": { - "wireguard": "WireGuard", - "openvpn": "OpenVPN", - "splitTunneling": "Split tunneling", - "daita": "DAITA", - "daitaFull": "Defence against AI-guided Traffic Analysis" - } -} diff --git a/desktop/packages/mullvad-vpn/src/main/index.ts b/desktop/packages/mullvad-vpn/src/main/index.ts index f855278ba922..2186168379e8 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 { 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(config.links).find((link) => url.startsWith(link))) { + if (Object.values(urls).find((allowedUrl) => url.startsWith(allowedUrl))) { 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 b92dbd917925..14fdd537b0d0 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/app.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/app.tsx @@ -9,6 +9,7 @@ import { ILinuxSplitTunnelingApplication, ISplitTunnelingApplication, } from '../shared/application-types'; +import { Url } from '../shared/constants'; import { AccessMethodSetting, AccountNumber, @@ -358,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: string) => 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); @@ -462,7 +463,7 @@ export default class AppRenderer { return devices; }; - public openLinkWithAuth = async (link: string): Promise => { + public openUrlWithAuth = async (url: Url): Promise => { let token = ''; try { token = await IpcRendererEventChannel.account.getWwwAuthToken(); @@ -470,7 +471,7 @@ export default class AppRenderer { const error = e as Error; log.error(`Failed to get the WWW auth token: ${error.message}`); } - void this.openUrl(`${link}?token=${token}`); + void this.openUrl(`${url}?token=${token}`); }; public setAllowLan = async (allowLan: boolean) => { diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/Account.tsx index 115196a49d56..204a77501cc3 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 { urls } from '../../shared/constants'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import { useHistory } from '../lib/history'; @@ -30,11 +30,11 @@ import SettingsHeader, { HeaderTitle } from './SettingsHeader'; export default function Account() { const history = useHistory(); const isOffline = useSelector((state) => state.connection.isBlocked); - const { updateAccountData, openLinkWithAuth, logout } = useAppContext(); + const { updateAccountData, openUrlWithAuth, logout } = useAppContext(); const onBuyMore = useCallback(async () => { - await openLinkWithAuth(links.purchase); - }, [openLinkWithAuth]); + await openUrlWithAuth(urls.purchase); + }, [openUrlWithAuth]); const onMount = useEffectEvent(() => updateAccountData()); useEffect(() => onMount(), []); diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx index 228dd179dc93..155fb0465dea 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/AccountStyles.tsx @@ -1,6 +1,6 @@ import styled from 'styled-components'; -import { colors } from '../../config.json'; +import { Colors } from '../lib/foundations'; import { measurements, normalText, tinyText } from './common-styles'; export const AccountContainer = styled.div({ @@ -28,12 +28,12 @@ const AccountRowText = styled.span({ export const AccountRowLabel = styled(AccountRowText)(tinyText, { lineHeight: '20px', marginBottom: '5px', - color: colors.white60, + color: Colors.white60, }); export const AccountRowValue = styled(AccountRowText)(normalText, { fontWeight: 600, - color: colors.white, + color: Colors.white, }); export const DeviceRowValue = styled(AccountRowValue)({ @@ -41,7 +41,7 @@ export const DeviceRowValue = styled(AccountRowValue)({ }); export const AccountOutOfTime = styled(AccountRowValue)({ - color: colors.red, + color: Colors.red, }); export const StyledDeviceNameRow = styled.div({ diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx index e11eec5fad03..cdfb906ab42f 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ApiAccessMethods.tsx @@ -2,13 +2,12 @@ import { useCallback, useMemo } from 'react'; import { sprintf } from 'sprintf-js'; import styled from 'styled-components'; -import { colors } from '../../config.json'; import { AccessMethodSetting } from '../../shared/daemon-rpc-types'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; import { useApiAccessMethodTest } from '../lib/api-access-methods'; import { Container, Flex } from '../lib/components'; -import { Spacings } from '../lib/foundations'; +import { Colors, Spacings } from '../lib/foundations'; import { useHistory } from '../lib/history'; import { generateRoutePath } from '../lib/routeHelpers'; import { RoutePath } from '../lib/routes'; @@ -50,7 +49,7 @@ const StyledTestResultCircle = styled.div<{ $result: boolean }>((props) => ({ width: '10px', height: '10px', borderRadius: '50%', - backgroundColor: props.$result ? colors.green : colors.red, + backgroundColor: props.$result ? Colors.green : Colors.red, marginRight: Spacings.spacing2, })); @@ -300,8 +299,8 @@ function ApiAccessMethod(props: ApiAccessMethodProps) { diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx index f82b997cc4ec..26ddf6a21720 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/AppButton.tsx @@ -1,8 +1,8 @@ import React, { useCallback, useContext, useMemo, useState } from 'react'; import styled from 'styled-components'; -import { colors } from '../../config.json'; import log from '../../shared/logging'; +import { Colors } from '../lib/foundations'; import { useMounted } from '../lib/utility-hooks'; import { StyledButtonContent, @@ -32,7 +32,7 @@ interface IIconProps { } export function Icon(props: IIconProps) { - return ; + return ; } export interface IProps extends React.HTMLAttributes { @@ -157,37 +157,37 @@ export function BlockingButton(props: IBlockingProps) { } export const RedButton = styled(BaseButton)({ - backgroundColor: colors.red, + backgroundColor: Colors.red, '&&:not(:disabled):hover': { - backgroundColor: colors.red95, + backgroundColor: Colors.red95, }, }); export const GreenButton = styled(BaseButton)({ - backgroundColor: colors.green, + backgroundColor: Colors.green, '&&:not(:disabled):hover': { - backgroundColor: colors.green90, + backgroundColor: Colors.green90, }, }); export const BlueButton = styled(BaseButton)({ - backgroundColor: colors.blue80, + backgroundColor: Colors.blue80, '&&:not(:disabled):hover': { - backgroundColor: colors.blue60, + backgroundColor: Colors.blue60, }, }); export const TransparentButton = styled(BaseButton)(transparentButton, { - backgroundColor: colors.white20, + backgroundColor: Colors.white20, '&&:not(:disabled):hover': { - backgroundColor: colors.white40, + backgroundColor: Colors.white40, }, }); export const RedTransparentButton = styled(BaseButton)(transparentButton, { - backgroundColor: colors.red60, + backgroundColor: Colors.red60, '&&:not(:disabled):hover': { - backgroundColor: colors.red80, + backgroundColor: Colors.red80, }, }); diff --git a/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx b/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx index 6e16fdf6dbd4..c0ec34a592ac 100644 --- a/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx +++ b/desktop/packages/mullvad-vpn/src/renderer/components/ChevronButton.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import styled from 'styled-components'; -import { colors } from '../../config.json'; +import { Colors } from '../lib/foundations'; import { Icon } from './cell/Label'; interface IProps extends React.HTMLAttributes { @@ -25,8 +25,8 @@ export default function ChevronButton(props: IProps) { return (