Skip to content

Commit e60fbed

Browse files
committed
update @ProtonMail web clients
1 parent 09d6bc5 commit e60fbed

File tree

8 files changed

+145
-48
lines changed

8 files changed

+145
-48
lines changed

patches/protonmail/common.patch

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,6 @@ index 38e76fbcd..cace56733 100644
126126
return null;
127127
}
128128

129-
diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts
130-
index 6edb249f3..738c4da33 100644
131-
--- a/packages/shared/lib/fetch/helpers.ts
132-
+++ b/packages/shared/lib/fetch/helpers.ts
133-
@@ -10,11 +10,13 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => {
134-
});
135-
};
136-
137-
+/* <electron-mail-mark> */
138-
export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => {
139-
const url = new URL(urlString, window.location.origin);
140-
appendQueryParams(url, params);
141-
return url;
142-
};
143-
+/* </electron-mail-mark> */
144-
145-
export const checkStatus = (response: Response, config: any) => {
146-
const { status } = response;
147-
148129
diff --git a/packages/components/helpers/earlyAccessDesynchronization.ts b/packages/components/helpers/earlyAccessDesynchronization.ts
149130
index 36bd0c712..c2fb3681c 100644
150131
--- a/packages/components/helpers/earlyAccessDesynchronization.ts
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/packages/shared/lib/constants.ts b/packages/shared/lib/constants.ts
2+
index e98525020..9e27f7f97 100644
3+
--- a/packages/shared/lib/constants.ts
4+
+++ b/packages/shared/lib/constants.ts
5+
@@ -52,7 +52,7 @@ export const APPS = {
6+
} as const;
7+
export const APPS_CONFIGURATION = {
8+
[APPS.PROTONACCOUNT]: {
9+
- publicPath: '',
10+
+ publicPath: '/account',
11+
subdomain: 'account',
12+
name: ACCOUNT_APP_NAME,
13+
bareName: 'Account',
14+
@@ -115,8 +115,8 @@ export const APPS_CONFIGURATION = {
15+
settingsSlug: '',
16+
},
17+
[APPS.PROTONVPN_SETTINGS]: {
18+
- publicPath: '',
19+
- subdomain: '',
20+
+ publicPath: 'account/vpn',
21+
+ subdomain: 'account',
22+
name: VPN_APP_NAME,
23+
bareName: 'VPN',
24+
clientID: 'web-vpn-settings',

patches/protonmail/meta.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
"constants-4.patch",
66
"sentry-8.patch",
77
"pack-api-arg-3.patch",
8-
"pack-webpack-4.patch",
8+
"pack-webpack-5.patch",
99
"session-storage-3.patch",
1010
"link-handler-5.patch",
1111
"embedded-verification-1.patch",
1212
"proton-mail.patch"
1313
],
1414
"proton-account": [
1515
"common.patch",
16-
"url-2.patch",
17-
"constants-4.patch",
16+
"url-3.patch",
17+
"constants-5.patch",
1818
"sentry-8.patch",
1919
"pack-api-arg-3.patch",
2020
"pack-webpack-5.patch",

patches/protonmail/proton-account.patch

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ index 8f5e56ef0..a40d9dc17 100644
3838
export default Setup;
3939

4040
diff --git a/applications/account/src/app/content/MainContainer.tsx b/applications/account/src/app/content/MainContainer.tsx
41-
index f14e76d5a..b21b54c97 100644
41+
index ceb51ba56..7656f38f6 100644
4242
--- a/applications/account/src/app/content/MainContainer.tsx
4343
+++ b/applications/account/src/app/content/MainContainer.tsx
44-
@@ -91,7 +91,7 @@ const MainContainer = () => {
45-
setExpand(false);
46-
}, [location.pathname, location.hash]);
44+
@@ -119,7 +119,7 @@ const MainContainer = () => {
45+
46+
useDeviceRecovery();
4747

4848
- const app = getAppFromPathnameSafe(location.pathname) || DEFAULT_APP;
4949
+ const app = getAppFromPathnameSafe(window.location.pathname) || DEFAULT_APP;
5050
const appSlug = getSlugFromApp(app);
5151

5252
/*
53-

patches/protonmail/proton-mail.patch

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
diff --git a/packages/shared/lib/api/events.ts b/packages/shared/lib/api/events.ts
2-
index 263d640ff..d1944c66e 100644
2+
index 7c263575d..6d696e5f4 100644
33
--- a/packages/shared/lib/api/events.ts
44
+++ b/packages/shared/lib/api/events.ts
5-
@@ -1,9 +1,11 @@
6-
export const getLatestID = () => ({
7-
url: 'v4/events/latest',
8-
method: 'get',
9-
+ params: { MessageCounts: "", ConversationCounts: "", },
10-
});
11-
12-
export const getEvents = (eventID: string) => ({
5+
@@ -6,5 +6,9 @@ export const getLatestID = () => ({
6+
export const getEvents = (eventID: string, params?: { ConversationCounts: 1 | 0; MessageCounts: 1 | 0 }) => ({
137
url: `v4/events/${eventID}`,
148
method: 'get',
15-
+ params: { MessageCounts: "", ConversationCounts: "", },
9+
- params,
10+
+ params: {
11+
+ ...params,
12+
+ ConversationCounts: 1,
13+
+ MessageCounts: 1,
14+
+ },
1615
});
1716

1817
diff --git a/packages/components/containers/login/MinimalLoginContainer.tsx b/packages/components/containers/login/MinimalLoginContainer.tsx
@@ -324,18 +323,18 @@ index bdabb99e0..a56b8cdcb 100644
324323
};
325324

326325
diff --git a/applications/mail/src/app/components/header/MailHeader.tsx b/applications/mail/src/app/components/header/MailHeader.tsx
327-
index e68f73cd8..6a69bfb1f 100644
326+
index d86dc9880..e75180b46 100644
328327
--- a/applications/mail/src/app/components/header/MailHeader.tsx
329328
+++ b/applications/mail/src/app/components/header/MailHeader.tsx
330-
@@ -34,7 +34,6 @@ import { getLabelName } from '../../helpers/labels';
331-
import { useEncryptedSearchContext } from '../../containers/EncryptedSearchProvider';
332-
import { useOnCompose, useOnMailTo } from '../../containers/ComposeProvider';
333-
import { MESSAGE_ACTIONS } from '../../constants';
334-
-import MailDefaultHandlerModal from './MailDefaultHandlerModal';
329+
@@ -38,7 +38,6 @@ import { setParamsInUrl } from '../../helpers/mailboxUrl';
330+
import { Breakpoints } from '../../models/utils';
331+
import MailOnboardingModal from '../onboarding/MailOnboardingModal';
335332
import ClearBrowserDataModal from './ClearBrowserDataModal';
333+
-import MailDefaultHandlerModal from './MailDefaultHandlerModal';
336334
import MailSearch from './search/MailSearch';
337-
import MailOnboardingModal from '../onboarding/MailOnboardingModal';
338-
@@ -191,7 +190,6 @@ const MailHeader = ({ labelID, elementID, breakpoints, expanded, onToggleExpand
335+
336+
interface Props {
337+
@@ -192,7 +191,6 @@ const MailHeader = ({ labelID, elementID, breakpoints, expanded, onToggleExpand
339338
<MailViewLayoutModal {...mailViewLayoutProps} />
340339
<MailDensityModal {...mailDensityProps} />
341340
<MailComposerModeModal {...mailComposerModeProps} />

patches/protonmail/url-2.patch

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,22 @@ index 11cd310f6..8019c07f5 100644
5252
let cache = '';
5353
export const getStaticURL = (path: string) => {
5454
if (window.location.hostname === 'localhost' || getIsDohDomain(window.location.origin)) {
55+
56+
diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts
57+
index 6edb249f3..738c4da33 100644
58+
--- a/packages/shared/lib/fetch/helpers.ts
59+
+++ b/packages/shared/lib/fetch/helpers.ts
60+
@@ -10,11 +10,13 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => {
61+
});
62+
};
63+
64+
+/* <electron-mail-mark> */
65+
export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => {
66+
const url = new URL(urlString, window.location.origin);
67+
appendQueryParams(url, params);
68+
return url;
69+
};
70+
+/* </electron-mail-mark> */
71+
72+
export const checkStatus = (response: Response, config: any) => {
73+
const { status } = response;

patches/protonmail/url-3.patch

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
diff --git a/packages/shared/lib/helpers/url.ts b/packages/shared/lib/helpers/url.ts
2+
index 11cd310f6..8019c07f5 100644
3+
--- a/packages/shared/lib/helpers/url.ts
4+
+++ b/packages/shared/lib/helpers/url.ts
5+
@@ -175,48 +175,16 @@ export const getSecondLevelDomain = (hostname: string) => {
6+
return hostname.slice(hostname.indexOf('.') + 1);
7+
};
8+
9+
-export const getRelativeApiHostname = (hostname: string) => {
10+
- const idx = hostname.indexOf('.');
11+
- const first = hostname.slice(0, idx);
12+
- const second = hostname.slice(idx + 1);
13+
- return `${first}-api.${second}`;
14+
-};
15+
-
16+
export const getIsDohDomain = (origin: string) => {
17+
return DOH_DOMAINS.some((dohDomain) => origin.endsWith(dohDomain));
18+
};
19+
20+
export const getApiSubdomainUrl = (pathname: string) => {
21+
- const url = new URL('/', window.location.origin);
22+
- if (url.hostname === 'localhost' || getIsDohDomain(url.origin)) {
23+
- url.pathname = `/api${pathname}`;
24+
- return url;
25+
- }
26+
- url.hostname = getRelativeApiHostname(url.hostname);
27+
+ const url = new URL('/', '___ELECTRON_MAIL_PROTON_API_ENTRY_URL_PLACEHOLDER___');
28+
url.pathname = pathname;
29+
return url;
30+
};
31+
32+
-export const getAppUrlFromApiUrl = (apiUrl: string, appName: APP_NAMES) => {
33+
- const { subdomain } = APPS_CONFIGURATION[appName];
34+
- const url = new URL(apiUrl);
35+
- const { hostname } = url;
36+
- const index = hostname.indexOf('.');
37+
- const tail = hostname.slice(index + 1);
38+
- url.pathname = '';
39+
- url.hostname = `${subdomain}.${tail}`;
40+
- return url;
41+
-};
42+
-
43+
-export const getAppUrlRelativeToOrigin = (origin: string, appName: APP_NAMES) => {
44+
- const { subdomain } = APPS_CONFIGURATION[appName];
45+
- const url = new URL(origin);
46+
- const segments = url.host.split('.');
47+
- segments[0] = subdomain;
48+
- url.hostname = segments.join('.');
49+
- return url;
50+
-};
51+
-
52+
let cache = '';
53+
export const getStaticURL = (path: string) => {
54+
if (window.location.hostname === 'localhost' || getIsDohDomain(window.location.origin)) {
55+
56+
diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts
57+
index f0b3e2e31..90995e1fc 100644
58+
--- a/packages/shared/lib/fetch/helpers.ts
59+
+++ b/packages/shared/lib/fetch/helpers.ts
60+
@@ -10,6 +10,7 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => {
61+
});
62+
};
63+
64+
+/* <electron-mail-mark> */
65+
export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => {
66+
let url: URL;
67+
if (typeof window !== 'undefined') {
68+
@@ -20,6 +21,7 @@ export const createUrl = (urlString: string, params: { [key: string]: any } = {}
69+
appendQueryParams(url, params);
70+
return url;
71+
};
72+
+/* </electron-mail-mark> */
73+
74+
export const checkStatus = (response: Response, config: any) => {
75+
const { status } = response;

src/shared/const/proton-apps.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const PROVIDER_REPO_MAP = {
2323
basePath: "",
2424
apiSubdomain: "mail-api",
2525
repoRelativeDistDir: "./dist",
26-
tag: "[email protected].6.9",
26+
tag: "[email protected].7.9",
2727
protonPack: {
2828
webpackIndexEntryItems: [
2929
// immediate
@@ -49,14 +49,14 @@ export const PROVIDER_REPO_MAP = {
4949
basePath: "account",
5050
apiSubdomain: "account-api",
5151
repoRelativeDistDir: "./dist",
52-
tag: "[email protected].6.0",
52+
tag: "[email protected].7.3",
5353
protonPack: {}
5454
},
5555
[PROVIDER_APP_NAMES[2]]: {
5656
basePath: "calendar",
5757
apiSubdomain: "calendar-api",
5858
repoRelativeDistDir: "./dist",
59-
59+
6060
protonPack: {
6161
webpackIndexEntryItems: [
6262
// immediate

0 commit comments

Comments
 (0)