Skip to content

Commit 7170eaa

Browse files
committed
update @ProtonMail web clients
1 parent 2720b0c commit 7170eaa

File tree

7 files changed

+80
-25
lines changed

7 files changed

+80
-25
lines changed

patches/protonmail/common.patch

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,32 @@ index c50ab972c..a505eb314 100644
8282

8383

8484
diff --git a/packages/shared/lib/helpers/browser.ts b/packages/shared/lib/helpers/browser.ts
85-
index 8c94fae..3602b68 100644
85+
index 9aaa78a28..f3d24b47c 100644
8686
--- a/packages/shared/lib/helpers/browser.ts
8787
+++ b/packages/shared/lib/helpers/browser.ts
88-
@@ -117,20 +117,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge();
88+
@@ -1,6 +1,21 @@
89+
import UAParser from 'ua-parser-js';
90+
91+
const uaParser = new UAParser();
92+
+{
93+
+ const platform = String(navigator.platform);
94+
+ const userAgents = {
95+
+ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
96+
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
97+
+ 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"
98+
+ } as const;
99+
+ uaParser.setUA(
100+
+ platform.startsWith("Linux")
101+
+ ? userAgents.linux
102+
+ : platform.startsWith("Win")
103+
+ ? userAgents.windows
104+
+ : userAgents.macos
105+
+ );
106+
+}
107+
const ua = uaParser.getResult();
108+
109+
export const hasModulesSupport = () => {
110+
@@ -89,20 +104,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge();
89111
* @links { https://mathiasbynens.github.io/rel-noopener/}
90112
*/
91113
export const openNewTab = (url: string) => {
@@ -112,6 +134,7 @@ index 8c94fae..3602b68 100644
112134
+ ),
113135
+ );
114136
};
137+
115138
diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts
116139
index 2bd472b..52cf521 100644
117140
--- a/packages/shared/lib/constants.ts

patches/protonmail/meta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
],
1515
"proton-drive": [
1616
"common.patch",
17-
"sentry-1.patch",
18-
"captcha-1.patch",
17+
"sentry-2.patch",
18+
"captcha-2.patch",
1919
"pack-api-arg.patch",
2020
"proton-drive.patch"
2121
],

patches/protonmail/proton-drive.patch

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
diff --git a/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx b/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx
2-
index 3cb6545..4ad120b 100644
3-
--- a/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx
4-
+++ b/applications/drive/src/app/components/ShareLinkModal/GeneratedLinkState.tsx
5-
@@ -73,7 +73,7 @@ function GeneratedLinkState({
6-
}: Props) {
7-
const contentRef = useRef<HTMLDivElement>(null);
8-
const { createNotification } = useNotifications();
1+
diff --git a/applications/drive/src/app/utils/FileSaver/download.ts b/applications/drive/src/app/utils/FileSaver/download.ts
2+
index 92eb4e5e2..e1664fd78 100644
3+
--- a/applications/drive/src/app/utils/FileSaver/download.ts
4+
+++ b/applications/drive/src/app/utils/FileSaver/download.ts
5+
@@ -11,8 +11,7 @@ import { TransferMeta } from '@proton/shared/lib/interfaces/drive/transfer';
6+
* IOS - forces all browsers to use webkit, so same problems as safari in all browsers.
7+
* For them download is done in-memory using blob response.
8+
*/
9+
-export const isUnsupported = () =>
10+
- !('serviceWorker' in navigator) || isSafari() || (isEdge() && !isEdgeChromium()) || isIos();
11+
+export const isUnsupported = () => !('serviceWorker' in navigator)
12+
13+
// createDownloadIframe opens download URL created in service worker to
14+
// initialize the download in the browser. The response has headers to
15+
16+
diff --git a/applications/drive/src/app/utils/link.ts b/applications/drive/src/app/utils/link.ts
17+
index 31b5d775d..c08a2317d 100644
18+
--- a/applications/drive/src/app/utils/link.ts
19+
+++ b/applications/drive/src/app/utils/link.ts
20+
@@ -65,7 +65,7 @@ export const getSharedLink = (sharedURL?: { Token: string; Password: string; Fla
21+
22+
const [generatedPassword] = splitGeneratedAndCustomPassword(sharedURL.Password, sharedURL);
23+
924
- const baseUrl = `${window.location.origin}/urls`;
1025
+ const baseUrl = "https://drive.protonmail.com/urls";
26+
return `${baseUrl}/${sharedURL.Token}${generatedPassword !== '' ? `#${generatedPassword}` : ''}`;
27+
};
1128

12-
const [password, setPassword] = useState(customPassword);
13-
const [expiration, setExpiration] = useState(initialExpiration);

scripts/electron-builder/lib.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,14 @@ export async function build(
170170
await execShell([
171171
"npm",
172172
[
173-
"run", `electron-builder:dist:linux:${packageType}:do`,
173+
...`run electron-builder:shortcut -- --x64 --publish never --linux ${packageType}`.split(" "),
174174
],
175+
{
176+
env: {
177+
// see https://github.com/develar/app-builder/blob/e229f413d635b78a59b0d4ef1a9aa0f3967c0fd4/pkg/node-modules/rebuild.go#L377
178+
npm_config_user_agent: (process.env.npm_config_user_agent ?? "").replace(/yarn/i, ""),
179+
},
180+
},
175181
]);
176182

177183
// TODO move "fastGlob" to lib function with inner "sanitizeFastGlobPattern" call

scripts/lib.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ export async function execShell(
6868
printStdErr = true,
6969
printEnvWhitelist = [],
7070
doNotRethrow = false,
71+
doNotDropNodeOptionsRelatedEnvVars = false,
7172
}: {
7273
printStdOut?: boolean;
7374
printStdErr?: boolean;
7475
printEnvWhitelist?: readonly string[];
7576
doNotRethrow?: boolean
77+
doNotDropNodeOptionsRelatedEnvVars?: boolean
7678
} = {},
7779
): Promise<Unpacked<ReturnType<typeof spawnAsync>>> {
7880
{
@@ -92,7 +94,21 @@ export async function execShell(
9294
);
9395
}
9496

95-
const spawnPromise = spawnAsync(command, args, options);
97+
const spawnPromise = spawnAsync(
98+
command,
99+
args,
100+
{
101+
...options,
102+
env: {
103+
...process.env,
104+
...options?.env,
105+
...(!doNotDropNodeOptionsRelatedEnvVars && { // disable node options inheritance form the parent/own process
106+
NODE_OPTIONS: "",
107+
npm_config_node_options: "",
108+
}),
109+
},
110+
},
111+
);
96112
const {stdout, stderr} = spawnPromise.child;
97113
const print = (std: import("stream").Readable): void => {
98114
byline(std).on("data", (chunk) => {

scripts/prepare-webclient/webclients.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,7 @@ async function executeBuildFlow(
255255
}
256256
}
257257

258-
// TODO drop "yarn install" hacks when executing on CI env
259-
if (process.env.CI) {
258+
if (process.env.CI) { // TODO drop "yarn install" hacks when executing on CI env
260259
// hacks applied to avoid the following error:
261260
// eslint-disable-next-line max-len
262261
// 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(
268267
cwd: repoDir,
269268
env: {
270269
...process.env,
271-
...{ // disable node options inheritance form the parent/own process
272-
NODE_OPTIONS: "",
273-
npm_config_node_options: "",
274-
},
275270
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "1",
276271
YARN_CHECKSUM_BEHAVIOR: "update",
277272
YARN_ENABLE_IMMUTABLE_INSTALLS: "false",

src/shared/proton-apps-constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const PROVIDER_REPO_MAP = {
2020
[PROVIDER_APP_NAMES[0]]: {
2121
repoRelativeDistDir: "./dist",
2222
baseDirName: "",
23-
tag: "proton-mail@4.11.1",
23+
tag: "proton-mail@4.11.2",
2424
protonPack: {
2525
appConfig: {clientId: "WebMail"},
2626
webpackIndexEntryItems: [
@@ -48,7 +48,7 @@ export const PROVIDER_REPO_MAP = {
4848
[PROVIDER_APP_NAMES[1]]: {
4949
repoRelativeDistDir: "./dist",
5050
baseDirName: "account",
51-
tag: "proton-account@4.12.8",
51+
tag: "proton-account@4.13.0",
5252
protonPack: {appConfig: {clientId: "WebAccount"}}
5353
},
5454
[PROVIDER_APP_NAMES[2]]: {
@@ -67,7 +67,7 @@ export const PROVIDER_REPO_MAP = {
6767
[PROVIDER_APP_NAMES[3]]: {
6868
repoRelativeDistDir: "./dist",
6969
baseDirName: "drive",
70-
tag: "proton-drive@4.6.1",
70+
tag: "proton-drive@4.7.1",
7171
protonPack: {appConfig: {clientId: "WebDrive"}},
7272
},
7373
} as const;

0 commit comments

Comments
 (0)