diff --git a/patches/protonmail/common.patch b/patches/protonmail/common.patch index 3ec2ece61..7fc1e5003 100644 --- a/patches/protonmail/common.patch +++ b/patches/protonmail/common.patch @@ -82,10 +82,32 @@ index c50ab972c..a505eb314 100644 diff --git a/packages/shared/lib/helpers/browser.ts b/packages/shared/lib/helpers/browser.ts -index 8c94fae..3602b68 100644 +index 9aaa78a28..f3d24b47c 100644 --- a/packages/shared/lib/helpers/browser.ts +++ b/packages/shared/lib/helpers/browser.ts -@@ -117,20 +117,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge(); +@@ -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/96.0.4664.45 Safari/537.36", ++ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36", ++ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 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) => { @@ -112,6 +134,7 @@ index 8c94fae..3602b68 100644 + ), + ); }; + diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts index 2bd472b..52cf521 100644 --- a/packages/shared/lib/constants.ts diff --git a/patches/protonmail/meta.json b/patches/protonmail/meta.json index efd7e0cb0..2b67b4a35 100644 --- a/patches/protonmail/meta.json +++ b/patches/protonmail/meta.json @@ -14,8 +14,8 @@ ], "proton-drive": [ "common.patch", - "sentry-1.patch", - "captcha-1.patch", + "sentry-2.patch", + "captcha-2.patch", "pack-api-arg.patch", "proton-drive.patch" ], diff --git a/patches/protonmail/proton-drive.patch b/patches/protonmail/proton-drive.patch index 84db1ed44..862b3907b 100644 --- a/patches/protonmail/proton-drive.patch +++ b/patches/protonmail/proton-drive.patch @@ -1,13 +1,28 @@ -diff --git a/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx b/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx -index 3cb6545..4ad120b 100644 ---- a/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx -+++ b/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx -@@ -73,7 +73,7 @@ function GeneratedLinkState({ - }: Props) { - const contentRef = useRef(null); - const { createNotification } = useNotifications(); +diff --git a/applications/drive/src/app/utils/FileSaver/download.ts b/applications/drive/src/app/utils/FileSaver/download.ts +index 92eb4e5e2..e1664fd78 100644 +--- a/applications/drive/src/app/utils/FileSaver/download.ts ++++ b/applications/drive/src/app/utils/FileSaver/download.ts +@@ -11,8 +11,7 @@ import { TransferMeta } from '@proton/shared/lib/interfaces/drive/transfer'; + * IOS - forces all browsers to use webkit, so same problems as safari in all browsers. + * For them download is done in-memory using blob response. + */ +-export const isUnsupported = () => +- !('serviceWorker' in navigator) || isSafari() || (isEdge() && !isEdgeChromium()) || isIos(); ++export const isUnsupported = () => !('serviceWorker' in navigator) + + // createDownloadIframe opens download URL created in service worker to + // initialize the download in the browser. The response has headers to + +diff --git a/applications/drive/src/app/utils/link.ts b/applications/drive/src/app/utils/link.ts +index 31b5d775d..c08a2317d 100644 +--- a/applications/drive/src/app/utils/link.ts ++++ b/applications/drive/src/app/utils/link.ts +@@ -65,7 +65,7 @@ export const getSharedLink = (sharedURL?: { Token: string; Password: string; Fla + + const [generatedPassword] = splitGeneratedAndCustomPassword(sharedURL.Password, sharedURL); + - const baseUrl = `${window.location.origin}/urls`; + const baseUrl = "https://drive.protonmail.com/urls"; + return `${baseUrl}/${sharedURL.Token}${generatedPassword !== '' ? `#${generatedPassword}` : ''}`; + }; - const [password, setPassword] = useState(customPassword); - const [expiration, setExpiration] = useState(initialExpiration); diff --git a/scripts/electron-builder/lib.ts b/scripts/electron-builder/lib.ts index a471d76e6..d6fd89603 100644 --- a/scripts/electron-builder/lib.ts +++ b/scripts/electron-builder/lib.ts @@ -170,8 +170,14 @@ export async function build( await execShell([ "npm", [ - "run", `electron-builder:dist:linux:${packageType}:do`, + ...`run electron-builder:shortcut -- --x64 --publish never --linux ${packageType}`.split(" "), ], + { + env: { + // see https://github.com/develar/app-builder/blob/e229f413d635b78a59b0d4ef1a9aa0f3967c0fd4/pkg/node-modules/rebuild.go#L377 + npm_config_user_agent: (process.env.npm_config_user_agent ?? "").replace(/yarn/i, ""), + }, + }, ]); // TODO move "fastGlob" to lib function with inner "sanitizeFastGlobPattern" call diff --git a/scripts/lib.ts b/scripts/lib.ts index a0792f3a3..a972ec9b9 100644 --- a/scripts/lib.ts +++ b/scripts/lib.ts @@ -68,11 +68,13 @@ export async function execShell( printStdErr = true, printEnvWhitelist = [], doNotRethrow = false, + doNotDropNodeOptionsRelatedEnvVars = false, }: { printStdOut?: boolean; printStdErr?: boolean; printEnvWhitelist?: readonly string[]; doNotRethrow?: boolean + doNotDropNodeOptionsRelatedEnvVars?: boolean } = {}, ): Promise>> { { @@ -92,7 +94,21 @@ export async function execShell( ); } - const spawnPromise = spawnAsync(command, args, options); + const spawnPromise = spawnAsync( + command, + args, + { + ...options, + env: { + ...process.env, + ...options?.env, + ...(!doNotDropNodeOptionsRelatedEnvVars && { // disable node options inheritance form the parent/own process + NODE_OPTIONS: "", + npm_config_node_options: "", + }), + }, + }, + ); const {stdout, stderr} = spawnPromise.child; const print = (std: import("stream").Readable): void => { byline(std).on("data", (chunk) => { diff --git a/scripts/prepare-webclient/webclients.ts b/scripts/prepare-webclient/webclients.ts index 1b323d134..38251c138 100644 --- a/scripts/prepare-webclient/webclients.ts +++ b/scripts/prepare-webclient/webclients.ts @@ -255,8 +255,7 @@ async function executeBuildFlow( } } - // TODO drop "yarn install" hacks when executing on CI env - if (process.env.CI) { + if (process.env.CI) { // TODO drop "yarn install" hacks when executing on CI env // hacks applied to avoid the following error: // eslint-disable-next-line max-len // YN0018: │ sieve.js@https://github.com/ProtonMail/sieve.js.git#commit=a09ab52092164af74278e77612a091e730e9b7e9: The remote archive doesn't match the expected checksum @@ -268,10 +267,6 @@ async function executeBuildFlow( cwd: repoDir, env: { ...process.env, - ...{ // disable node options inheritance form the parent/own process - NODE_OPTIONS: "", - npm_config_node_options: "", - }, PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "1", YARN_CHECKSUM_BEHAVIOR: "update", YARN_ENABLE_IMMUTABLE_INSTALLS: "false", diff --git a/src/shared/proton-apps-constants.ts b/src/shared/proton-apps-constants.ts index e92018226..dadadecae 100644 --- a/src/shared/proton-apps-constants.ts +++ b/src/shared/proton-apps-constants.ts @@ -20,7 +20,7 @@ export const PROVIDER_REPO_MAP = { [PROVIDER_APP_NAMES[0]]: { repoRelativeDistDir: "./dist", baseDirName: "", - tag: "proton-mail@4.11.1", + tag: "proton-mail@4.11.2", protonPack: { appConfig: {clientId: "WebMail"}, webpackIndexEntryItems: [ @@ -48,7 +48,7 @@ export const PROVIDER_REPO_MAP = { [PROVIDER_APP_NAMES[1]]: { repoRelativeDistDir: "./dist", baseDirName: "account", - tag: "proton-account@4.12.8", + tag: "proton-account@4.13.0", protonPack: {appConfig: {clientId: "WebAccount"}} }, [PROVIDER_APP_NAMES[2]]: { @@ -67,7 +67,7 @@ export const PROVIDER_REPO_MAP = { [PROVIDER_APP_NAMES[3]]: { repoRelativeDistDir: "./dist", baseDirName: "drive", - tag: "proton-drive@4.6.1", + tag: "proton-drive@4.7.1", protonPack: {appConfig: {clientId: "WebDrive"}}, }, } as const;