diff --git a/patches/protonmail/common.patch b/patches/protonmail/common-1.patch similarity index 95% rename from patches/protonmail/common.patch rename to patches/protonmail/common-1.patch index b93c1ae45..5f5fe2c4e 100644 --- a/patches/protonmail/common.patch +++ b/patches/protonmail/common-1.patch @@ -56,9 +56,9 @@ index 9aaa78a28..f3d24b47c 100644 +{ + const platform = String(navigator.platform); + const userAgents = { -+ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", -+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", -+ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36" ++ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", ++ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", ++ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" + } as const; + uaParser.setUA( + platform.startsWith("Linux") diff --git a/patches/protonmail/common-2.patch b/patches/protonmail/common-2.patch new file mode 100644 index 000000000..40c9df5ad --- /dev/null +++ b/patches/protonmail/common-2.patch @@ -0,0 +1,127 @@ +diff --git a/packages/pack/scripts/validate.sh b/packages/pack/scripts/validate.sh +index 1a2ea64..bae388c 100755 +--- a/packages/pack/scripts/validate.sh ++++ b/packages/pack/scripts/validate.sh +@@ -58,7 +58,7 @@ function main { + fi; + + if [ "$hasSourceMap" -eq 0 ]; then +- hasError=true; ++ #hasError=true; + echo "[error] no SourceMaps found inside the directory: $OUTPUT_DIR"; + fi; + +diff --git a/packages/pack/bin/protonPack.js b/packages/pack/bin/protonPack.js +index 55715b89d..c87879ad4 100755 +--- a/packages/pack/bin/protonPack.js ++++ b/packages/pack/bin/protonPack.js +@@ -81,7 +81,7 @@ addGlobalOptions(program.command('build').description('create an optimized produ + const outputPath = path.resolve('./dist'); + await commandWithLog(`rm -rf ${outputPath}`); + await commandWithLog( +- `${require.resolve('webpack-cli/bin/cli.js')} --progress --output-path=${outputPath} ${webpackArgs}`, ++ `${require.resolve('webpack-cli/bin/cli.js')} --output-path=${outputPath} ${webpackArgs}`, + { + stdio: 'inherit', + } + +diff --git a/packages/pack/webpack/css.loader.js b/packages/pack/webpack/css.loader.js +index c50ab972c..a505eb314 100644 +--- a/packages/pack/webpack/css.loader.js ++++ b/packages/pack/webpack/css.loader.js +@@ -44,11 +44,13 @@ module.exports = ({ browserslist }) => { + }, + { + loader: require.resolve('resolve-url-loader'), ++ options: {sourceMap: false}, + }, + { + loader: require.resolve('sass-loader'), + options: { + additionalData: PREPEND_SASS, ++ sourceMap: true, // to please "resolve-url-loader" + }, + }, + ].filter(Boolean); + + +diff --git a/packages/shared/lib/helpers/browser.ts b/packages/shared/lib/helpers/browser.ts +index 9aaa78a28..f3d24b47c 100644 +--- a/packages/shared/lib/helpers/browser.ts ++++ b/packages/shared/lib/helpers/browser.ts +@@ -1,6 +1,21 @@ + import UAParser from 'ua-parser-js'; + + const uaParser = new UAParser(); ++{ ++ const platform = String(navigator.platform); ++ const userAgents = { ++ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", ++ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", ++ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" ++ } as const; ++ uaParser.setUA( ++ platform.startsWith("Linux") ++ ? userAgents.linux ++ : platform.startsWith("Win") ++ ? userAgents.windows ++ : userAgents.macos ++ ); ++} + const ua = uaParser.getResult(); + + export const hasModulesSupport = () => { +@@ -89,20 +104,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge(); + * @links { https://mathiasbynens.github.io/rel-noopener/} + */ + export const openNewTab = (url: string) => { +- if (isIE11()) { +- const otherWindow = window.open(); +- if (!otherWindow) { +- return; +- } +- otherWindow.opener = null; +- otherWindow.location.href = url; +- return; +- } +- const anchor = document.createElement('a'); +- +- anchor.setAttribute('rel', 'noreferrer nofollow noopener'); +- anchor.setAttribute('target', '_blank'); +- anchor.href = url; +- +- return anchor.click(); ++ window.dispatchEvent( ++ new CustomEvent( ++ "electron-mail:packages/shared/lib/helpers/browser.ts:openNewTab", ++ {detail: {url}}, ++ ), ++ ); + }; + +diff --git a/packages/components/components/link/SettingsLink.tsx b/packages/components/components/link/SettingsLink.tsx +index ebce00d20..96498d8c8 100644 +--- a/packages/components/components/link/SettingsLink.tsx ++++ b/packages/components/components/link/SettingsLink.tsx +@@ -37,7 +37,7 @@ const SettingsLink = ({ path, app, children, ...rest }: Props, ref: Ref + {children} + +diff --git a/packages/components/helpers/earlyAccessDesynchronization.ts b/packages/components/helpers/earlyAccessDesynchronization.ts +index 36bd0c712..c2fb3681c 100644 +--- a/packages/components/helpers/earlyAccessDesynchronization.ts ++++ b/packages/components/helpers/earlyAccessDesynchronization.ts +@@ -42,6 +42,7 @@ export const handleEarlyAccessDesynchronization = ({ + earlyAccessScope: Feature | undefined; + appName: APP_NAMES; + }) => { ++ return; + if (doesNotSupportEarlyAccessVersion()) { + return; + } diff --git a/patches/protonmail/constants-5.patch b/patches/protonmail/constants-7.patch similarity index 74% rename from patches/protonmail/constants-5.patch rename to patches/protonmail/constants-7.patch index c622353fd..a0c674c67 100644 --- a/patches/protonmail/constants-5.patch +++ b/patches/protonmail/constants-7.patch @@ -1,17 +1,17 @@ diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts -index e98525020..9e27f7f97 100644 +index a5c634a9f..c1cbd799a 100644 --- a/packages/shared/lib/constants.ts +++ b/packages/shared/lib/constants.ts -@@ -52,7 +52,7 @@ export const APPS = { - } as const; +@@ -57,7 +57,7 @@ export const APPS = { + export const APPS_CONFIGURATION = { [APPS.PROTONACCOUNT]: { - publicPath: '', + publicPath: '/account', subdomain: 'account', - name: ACCOUNT_APP_NAME, + name: 'Proton Account', bareName: 'Account', -@@ -115,8 +115,8 @@ export const APPS_CONFIGURATION = { +@@ -129,8 +129,8 @@ export const APPS_CONFIGURATION = { settingsSlug: '', }, [APPS.PROTONVPN_SETTINGS]: { @@ -20,5 +20,5 @@ index e98525020..9e27f7f97 100644 + publicPath: 'account/vpn', + subdomain: 'account', name: VPN_APP_NAME, - bareName: 'VPN', + bareName: VPN_SHORT_APP_NAME, clientID: 'web-vpn-settings', diff --git a/patches/protonmail/embedded-verification-2.patch b/patches/protonmail/embedded-verification-2.patch deleted file mode 100644 index 8807b0e3b..000000000 --- a/patches/protonmail/embedded-verification-2.patch +++ /dev/null @@ -1,129 +0,0 @@ -diff --git a/packages/components/containers/index.ts b/packages/components/containers/index.ts -index 9bfef3d1f..546b273c8 100644 ---- a/packages/components/containers/index.ts -+++ b/packages/components/containers/index.ts -@@ -58,6 +58,5 @@ export * from './sessions'; - export * from './support'; - export * from './themes'; - export * from './topBanners'; --export * from './verification'; - export * from './v5WelcomeModal'; - export * from './vpn'; - -diff --git a/packages/components/containers/verification/EmbeddedVerification.tsx b/packages/components/containers/verification/EmbeddedVerification.tsx -deleted file mode 100644 -index 6425df9ec..000000000 ---- a/packages/components/containers/verification/EmbeddedVerification.tsx -+++ /dev/null -@@ -1,103 +0,0 @@ --import { useEffect, useMemo, useRef, useState } from 'react'; -- --import { APPS } from '@proton/shared/lib/constants'; --import { getAppUrlFromApiUrl, getAppUrlRelativeToOrigin, stringifySearchParams } from '@proton/shared/lib/helpers/url'; --import { localeCode } from '@proton/shared/lib/i18n'; --import { HumanVerificationMethodType } from '@proton/shared/lib/interfaces'; -- --import { useConfig, useNotifications } from '../../hooks'; -- --interface EmbeddedVerificationProps { -- token: string; -- methods: HumanVerificationMethodType[]; -- defaultCountry?: string; -- defaultEmail?: string; -- defaultPhone?: string; -- onSuccess: (token: string, tokenType: HumanVerificationMethodType) => void; --} -- --const EmbeddedVerification = ({ -- token, -- methods, -- onSuccess, -- defaultCountry, -- defaultEmail, -- defaultPhone, --}: EmbeddedVerificationProps) => { -- const iframeRef = useRef(null); -- const [iframeHeight, setIframeHeight] = useState(); -- const { API_URL } = useConfig(); -- const { createNotification } = useNotifications(); -- -- const embedUrl = useMemo(() => { -- if (window.location.origin.includes('localhost')) { -- return getAppUrlFromApiUrl(API_URL, APPS.PROTONVERIFICATION); -- } -- -- return getAppUrlRelativeToOrigin(window.location.origin, APPS.PROTONVERIFICATION); -- }, []); -- -- useEffect(() => { -- const handleMessage = (e: MessageEvent) => { -- const { origin, data, source } = e; -- -- const contentWindow = iframeRef.current?.contentWindow; -- -- if (!contentWindow || origin !== embedUrl.origin || !data || source !== contentWindow) { -- return; -- } -- -- const { type, payload } = JSON.parse(e.data); -- -- switch (type) { -- case 'RESIZE': { -- const { height } = payload; -- setIframeHeight(height); -- break; -- } -- -- case 'NOTIFICATION': { -- createNotification(payload); -- break; -- } -- -- case 'HUMAN_VERIFICATION_SUCCESS': { -- const { token, type } = payload; -- onSuccess(token, type); -- break; -- } -- -- default: -- } -- }; -- -- window.addEventListener('message', handleMessage); -- -- return () => { -- window.removeEventListener('message', handleMessage); -- }; -- }, [onSuccess]); -- -- const params = { -- methods, -- token, -- defaultCountry: defaultCountry || undefined, -- defaultEmail: defaultEmail || undefined, -- defaultPhone: defaultPhone || undefined, -- locale: localeCode, -- }; -- -- const src = `${embedUrl.toString()}?${stringifySearchParams(params)}`; -- -- return ( --