diff --git a/patches/protonmail/common-1.patch b/patches/protonmail/common-1.patch deleted file mode 100644 index 5f5fe2c4..00000000 --- a/patches/protonmail/common-1.patch +++ /dev/null @@ -1,140 +0,0 @@ -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/containers/topBanners/NudgeTopBanner.tsx b/packages/components/containers/topBanners/NudgeTopBanner.tsx -index 38e76fbcd..cace56733 100644 ---- a/packages/components/containers/topBanners/NudgeTopBanner.tsx -+++ b/packages/components/containers/topBanners/NudgeTopBanner.tsx -@@ -14,7 +14,7 @@ const NudgeTopBanner = () => { - const [show] = useState(getIsProtonMailDomain); - const { feature } = useFeature(FeatureCode.NudgeProton); - -- if (!feature?.Value || !show) { -+ if (Boolean("1") || !feature?.Value || !show) { - return null; - } - -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/common-2.patch b/patches/protonmail/common-3.patch similarity index 93% rename from patches/protonmail/common-2.patch rename to patches/protonmail/common-3.patch index 40c9df5a..22290801 100644 --- a/patches/protonmail/common-2.patch +++ b/patches/protonmail/common-3.patch @@ -100,15 +100,15 @@ index 9aaa78a28..f3d24b47c 100644 }; diff --git a/packages/components/components/link/SettingsLink.tsx b/packages/components/components/link/SettingsLink.tsx -index ebce00d20..96498d8c8 100644 +index 5081c4003..cde37c0cb 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/patches/protonmail/constants-8.patch b/patches/protonmail/constants-8.patch new file mode 100644 index 00000000..67a6cd5b --- /dev/null +++ b/patches/protonmail/constants-8.patch @@ -0,0 +1,24 @@ +diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts +index d035e6c88..96af3775b 100644 +--- a/packages/shared/lib/constants.ts ++++ b/packages/shared/lib/constants.ts +@@ -69,7 +69,7 @@ interface AppConfiguration { + + export const APPS_CONFIGURATION: { [key in APP_NAMES]: AppConfiguration } = { + [APPS.PROTONACCOUNT]: { +- publicPath: '', ++ publicPath: '/account', + subdomain: 'account', + name: 'Proton Account', + bareName: 'Account', +@@ -141,8 +141,8 @@ export const APPS_CONFIGURATION: { [key in APP_NAMES]: AppConfiguration } = { + settingsSlug: '', + }, + [APPS.PROTONVPN_SETTINGS]: { +- publicPath: '', +- subdomain: '', ++ publicPath: 'account/vpn', ++ subdomain: 'account', + name: VPN_APP_NAME, + bareName: VPN_SHORT_APP_NAME, + clientID: 'web-vpn-settings', diff --git a/patches/protonmail/constants-7.patch b/patches/protonmail/constants-9.patch similarity index 83% rename from patches/protonmail/constants-7.patch rename to patches/protonmail/constants-9.patch index a0c674c6..771294ea 100644 --- a/patches/protonmail/constants-7.patch +++ b/patches/protonmail/constants-9.patch @@ -1,8 +1,8 @@ diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts -index a5c634a9f..c1cbd799a 100644 +index 632e91b83..fd463a184 100644 --- a/packages/shared/lib/constants.ts +++ b/packages/shared/lib/constants.ts -@@ -57,7 +57,7 @@ export const APPS = { +@@ -61,7 +61,7 @@ export const APPS = { export const APPS_CONFIGURATION = { [APPS.PROTONACCOUNT]: { @@ -11,7 +11,7 @@ index a5c634a9f..c1cbd799a 100644 subdomain: 'account', name: 'Proton Account', bareName: 'Account', -@@ -129,8 +129,8 @@ export const APPS_CONFIGURATION = { +@@ -133,8 +133,8 @@ export const APPS_CONFIGURATION = { settingsSlug: '', }, [APPS.PROTONVPN_SETTINGS]: { diff --git a/patches/protonmail/meta.json b/patches/protonmail/meta.json index 3a89210a..3ca66824 100644 --- a/patches/protonmail/meta.json +++ b/patches/protonmail/meta.json @@ -1,9 +1,9 @@ { "proton-mail": [ - "common-1.patch", + "common-3.patch", "url-3.patch", - "constants-7.patch", - "sentry-9.patch", + "constants-8.patch", + "sentry-10.patch", "pack-api-arg-4.patch", "pack-webpack-6.patch", "session-storage-5.patch", @@ -12,10 +12,10 @@ "proton-mail.patch" ], "proton-account": [ - "common-2.patch", + "common-3.patch", "url-3.patch", - "constants-7.patch", - "sentry-9.patch", + "constants-8.patch", + "sentry-10.patch", "pack-api-arg-4.patch", "pack-webpack-6.patch", "session-storage-5.patch", @@ -24,10 +24,10 @@ "proton-account.patch" ], "proton-calendar": [ - "common-1.patch", + "common-3.patch", "url-3.patch", - "constants-7.patch", - "sentry-9.patch", + "constants-8.patch", + "sentry-10.patch", "pack-api-arg-4.patch", "pack-webpack-6.patch", "session-storage-5.patch", @@ -35,9 +35,9 @@ "embedded-verification-3.patch" ], "proton-drive": [ - "common-1.patch", + "common-3.patch", "url-3.patch", - "constants-7.patch", + "constants-9.patch", "sentry-9.patch", "pack-api-arg-4.patch", "pack-webpack-6.patch", @@ -47,10 +47,10 @@ "proton-drive.patch" ], "proton-vpn-settings": [ - "common-1.patch", + "common-3.patch", "url-3.patch", - "constants-7.patch", - "sentry-9.patch", + "constants-8.patch", + "sentry-10.patch", "pack-api-arg-4.patch", "pack-webpack-6.patch", "session-storage-5.patch", diff --git a/patches/protonmail/sentry-10.patch b/patches/protonmail/sentry-10.patch new file mode 100644 index 00000000..bb30e883 --- /dev/null +++ b/patches/protonmail/sentry-10.patch @@ -0,0 +1,152 @@ +diff --git a/packages/shared/lib/helpers/sentry.ts b/packages/shared/lib/helpers/sentry.ts +index fb3124ec7..6d6a3fb2a 100644 +--- a/packages/shared/lib/helpers/sentry.ts ++++ b/packages/shared/lib/helpers/sentry.ts +@@ -1,14 +1,9 @@ + import { + captureException, +- configureScope, +- init, +- makeFetchTransport, + captureMessage as sentryCaptureMessage, + } from '@sentry/browser'; +-import { BrowserTransportOptions } from '@sentry/browser/types/transports/types'; + + import { VPN_HOSTNAME } from '../constants'; +-import { ApiError } from '../fetch/ApiError'; + import { getUIDHeaders } from '../fetch/headers'; + import { ProtonConfig } from '../interfaces'; + +@@ -61,21 +56,6 @@ export const getContentTypeHeaders = (input: RequestInfo | URL): HeadersInit => + return {}; + }; + +-const sentryFetch = (input: RequestInfo | URL, init?: RequestInit) => { +- return globalThis.fetch(input, { +- ...init, +- headers: { +- ...init?.headers, +- ...getContentTypeHeaders(input), +- ...context.authHeaders, +- }, +- }); +-}; +- +-const makeProtonFetchTransport = (options: BrowserTransportOptions) => { +- return makeFetchTransport(options, sentryFetch); +-}; +- + const isLocalhost = (host: string) => host.startsWith('localhost'); + const isProduction = (host: string) => host.endsWith('.proton.me') || host === VPN_HOSTNAME; + +@@ -94,107 +74,10 @@ function main({ + sessionTracking = false, + sentryConfig = getDefaultSentryConfig(config), + ignore = ({ host }) => isLocalhost(host), +-}: SentryOptions) { +- const { SENTRY_DSN, APP_VERSION } = config; +- const { host, release, environment } = sentryConfig; +- +- // No need to configure it if we don't load the DSN +- if (!SENTRY_DSN || ignore(sentryConfig)) { +- return; +- } ++}: SentryOptions) {} + +- setUID(uid); +- +- // Assumes SENTRY_DSN is: https://111b3eeaaec34cae8e812df705690a36@sentry/11 +- // To get https://111b3eeaaec34cae8e812df705690a36@protonmail.com/api/core/v4/reports/sentry/11 +- const dsn = SENTRY_DSN.replace('sentry', `${host}/api/core/v4/reports/sentry`); +- +- init({ +- dsn, +- release, +- environment, +- normalizeDepth: 5, +- transport: makeProtonFetchTransport, +- autoSessionTracking: sessionTracking, +- // Disable client reports. Client reports are used by sentry to retry events that failed to send on visibility change. +- // Unfortunately Sentry does not use the custom transport for those, and thus fails to add the headers the API requires. +- sendClientReports: false, +- beforeSend(event, hint) { +- const error = hint?.originalException; +- const stack = typeof error === 'string' ? error : error?.stack; +- // Filter out broken ferdi errors +- if (stack && stack.match(/ferdi|franz/i)) { +- return null; +- } +- +- // Not interested in uncaught API errors +- if (error instanceof ApiError) { +- return null; +- } +- +- if (!context.enabled) { +- return null; +- } +- +- // Remove the hash from the request URL and navigation breadcrumbs to avoid +- // leaking the search parameters of encrypted searches +- if (event.request && event.request.url) { +- [event.request.url] = event.request.url.split('#'); +- } +- if (event.breadcrumbs) { +- event.breadcrumbs = event.breadcrumbs.map((breadcrumb) => { +- if (breadcrumb.category === 'navigation' && breadcrumb.data) { +- [breadcrumb.data.from] = breadcrumb.data.from.split('#'); +- [breadcrumb.data.to] = breadcrumb.data.to.split('#'); +- } +- return breadcrumb; +- }); +- } +- +- return event; +- }, +- ignoreErrors: [ +- // Ignore random plugins/extensions +- 'top.GLOBALS', +- 'canvas.contentDocument', +- 'MyApp_RemoveAllHighlights', +- 'atomicFindClose', +- 'conduitPage', +- // https://bugzilla.mozilla.org/show_bug.cgi?id=1678243 +- 'XDR encoding failure', +- 'Request timed out', +- 'No network connection', +- 'Failed to fetch', +- 'NetworkError when attempting to fetch resource.', +- 'webkitExitFullScreen', // Bug in Firefox for iOS. +- 'InactiveSession', +- 'UnhandledRejection', // Happens too often in extensions and we have lints for that, so should be safe to ignore. +- /chrome-extension/, +- /moz-extension/, +- 'TransferCancel', // User action to interrupt upload or download in Drive. +- 'UploadConflictError', // User uploading the same file again in Drive. +- 'UploadUserError', // Upload error on user's side in Drive. +- 'ValidationError', // Validation error on user's side in Drive. +- 'ChunkLoadError', // WebPack loading source code. +- /ResizeObserver loop/, // Chromium bug https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded +- ], +- }); +- +- configureScope((scope) => { +- scope.setTag('appVersion', APP_VERSION); +- }); +-} +- +-export const traceError = (...args: Parameters) => { +- if (!isLocalhost(window.location.host)) { +- captureException(...args); +- } +-}; ++export const traceError = (...args: Parameters) => console.error(...args); + +-export const captureMessage = (...args: Parameters) => { +- if (!isLocalhost(window.location.host)) { +- sentryCaptureMessage(...args); +- } +-}; ++export const captureMessage = (...args: Parameters) => console.log(...args); + + export default main; diff --git a/src/shared/const/proton-apps.ts b/src/shared/const/proton-apps.ts index cdbc8761..bc20f61a 100644 --- a/src/shared/const/proton-apps.ts +++ b/src/shared/const/proton-apps.ts @@ -23,7 +23,7 @@ export const PROVIDER_REPO_MAP = { basePath: "", apiSubdomain: "mail-api", repoRelativeDistDir: "./dist", - tag: "proton-mail@5.0.14.13", + tag: "proton-mail@5.0.17.12", protonPack: { webpackIndexEntryItems: [ // immediate @@ -49,14 +49,14 @@ export const PROVIDER_REPO_MAP = { basePath: "account", apiSubdomain: "account-api", repoRelativeDistDir: "./dist", - tag: "proton-account@5.0.16.6", + tag: "proton-account@5.0.18.4", protonPack: {} }, [PROVIDER_APP_NAMES[2]]: { basePath: "calendar", apiSubdomain: "calendar-api", repoRelativeDistDir: "./dist", - tag: "proton-calendar@5.0.6.6", + tag: "proton-calendar@5.0.8.1", protonPack: { webpackIndexEntryItems: [ // immediate @@ -69,14 +69,14 @@ export const PROVIDER_REPO_MAP = { basePath: "drive", apiSubdomain: "drive-api", repoRelativeDistDir: "./dist", - tag: "proton-drive@5.0.9.11", + tag: "proton-drive@5.0.10.2", protonPack: {}, }, [PROVIDER_APP_NAMES[4]]: { basePath: "account/vpn", apiSubdomain: "account-api", repoRelativeDistDir: "./dist", - tag: "proton-vpn-settings@5.0.13.2", + tag: "proton-vpn-settings@5.0.15.1", protonPack: {}, }, } as const;