Skip to content

Commit

Permalink
update @ProtonMail web clients
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimiry committed Jul 13, 2023
1 parent 9400e35 commit 7ea9d00
Show file tree
Hide file tree
Showing 12 changed files with 372 additions and 103 deletions.
16 changes: 16 additions & 0 deletions patches/protonmail/common-4.patch
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,19 @@ index 36bd0c712..c2fb3681c 100644
if (doesNotSupportEarlyAccessVersion()) {
return;
}

diff --git a/packages/components/containers/api/ApiProvider.js b/packages/components/containers/api/ApiProvider.js
index 3d1b81941c..6ac2f748fa 100644
--- a/packages/components/containers/api/ApiProvider.js
+++ b/packages/components/containers/api/ApiProvider.js
@@ -120,7 +120,9 @@ const ApiProvider = ({ config, onLogout, children, UID, noErrorState }) => {
error.cancel = true;
reject(error);
}}
- />
+ />,
+ // trying to force single instance, see https://github.com/vladimiry/ElectronMail/issues/621#issuecomment-1627389416
+ "HumanVerificationModal_ID",
);
});
};
49 changes: 0 additions & 49 deletions patches/protonmail/drop-circular-dependency.patch

This file was deleted.

26 changes: 13 additions & 13 deletions patches/protonmail/meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"proton-mail": [
"common-4.patch",
"drop-circular-dependency.patch",
"url-4.patch",
"drop-circular-dependency-2.patch",
"url-5.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"pack-api-arg-5.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
"link-handler-7.patch",
Expand All @@ -15,10 +15,10 @@
"proton-account": [
"common-4.patch",
"drop-circular-dependency-2.patch",
"url-4.patch",
"url-5.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"sentry-13.patch",
"pack-api-arg-5.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
"link-handler-7.patch",
Expand All @@ -27,7 +27,7 @@
],
"proton-calendar": [
"common-4.patch",
"drop-circular-dependency.patch",
"drop-circular-dependency-2.patch",
"url-4.patch",
"constants-10.patch",
"sentry-12.patch",
Expand All @@ -39,11 +39,11 @@
],
"proton-drive": [
"common-4.patch",
"drop-circular-dependency.patch",
"url-4.patch",
"drop-circular-dependency-2.patch",
"url-5.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"pack-api-arg-5.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
"link-handler-7.patch",
Expand All @@ -53,10 +53,10 @@
"proton-vpn-settings": [
"common-4.patch",
"drop-circular-dependency-2.patch",
"url-4.patch",
"url-5.patch",
"constants-10.patch",
"sentry-12.patch",
"pack-api-arg-4.patch",
"sentry-13.patch",
"pack-api-arg-5.patch",
"pack-webpack-6.patch",
"session-storage-5.patch",
"link-handler-7.patch",
Expand Down
13 changes: 13 additions & 0 deletions patches/protonmail/pack-api-arg-5.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/packages/pack/lib/config.js b/packages/pack/lib/config.js
index 5bb7fe50df..ff19c4f032 100644
--- a/packages/pack/lib/config.js
+++ b/packages/pack/lib/config.js
@@ -131,7 +131,7 @@ const getConfigFile = ({ buildData, appData }) => {
export const BRANCH = '${buildData.branch}';
export const DATE_VERSION = '${buildData.date}';
export const APP_NAME = '${appData.appName}';
- export const API_URL = '${(!appData.apiProxy && appData.api) || '/api'}';
+ export const API_URL = '${appData.api}';
export const SSO_URL = '${appData.sso || ''}';
export const LOCALES = ${JSON.stringify(LOCALES)};
export const VERSION_PATH = '${appData.publicPath}assets/version.json';
12 changes: 6 additions & 6 deletions patches/protonmail/proton-account.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ index 8f5e56ef0..a40d9dc17 100644
export default Setup;

diff --git a/applications/account/src/app/content/MainContainer.tsx b/applications/account/src/app/content/MainContainer.tsx
index 32a57aa6d..472a7c9c9 100644
index 575b59dcec..5e774e01a1 100644
--- a/applications/account/src/app/content/MainContainer.tsx
+++ b/applications/account/src/app/content/MainContainer.tsx
@@ -132,7 +132,7 @@ const MainContainer = () => {
const loadingFeatures = featuresFlags.some(({ loading }) => loading) || loadingDataRecovery;
const recoveryNotification = useRecoveryNotification(false);

useDeviceRecovery();

- const app = getAppFromPathnameSafe(location.pathname) || DEFAULT_APP;
+ const app = getAppFromPathnameSafe(window.location.pathname) || DEFAULT_APP;
- const appFromPathname = getAppFromPathnameSafe(location.pathname);
+ const appFromPathname = getAppFromPathnameSafe(window.location.pathname);
const app = appFromPathname || getToApp(undefined, user);
const appSlug = getSlugFromApp(app);

/*
10 changes: 5 additions & 5 deletions patches/protonmail/proton-drive.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ index 7bef98525..0650e8019 100644
// initialize the download in the browser. The response has headers to

diff --git a/applications/drive/src/app/store/_shares/shareUrl.ts b/applications/drive/src/app/store/_shares/shareUrl.ts
index 733cf9242..ab5781793 100644
index 76b907e2a1..a267a2d50c 100644
--- a/applications/drive/src/app/store/_shares/shareUrl.ts
+++ b/applications/drive/src/app/store/_shares/shareUrl.ts
@@ -40,6 +40,6 @@ export const getSharedLink = (sharedURL?: {
@@ -36,6 +36,6 @@ export const getSharedLink = (sharedURL?: {

const [generatedPassword] = splitGeneratedAndCustomPassword(sharedURL.Password, sharedURL);
const [generatedPassword] = splitGeneratedAndCustomPassword(sharedURL.password, sharedURL);

- const url = sharedURL.PublicUrl ? sharedURL.PublicUrl : `${window.location.origin}/urls/${sharedURL.Token}`;
+ const url = sharedURL.PublicUrl ? sharedURL.PublicUrl : `https://drive.protonmail.com/urls/${sharedURL.Token}`;
- const url = sharedURL.publicUrl ? sharedURL.publicUrl : `${window.location.origin}/urls/${sharedURL.token}`;
+ const url = sharedURL.publicUrl ? sharedURL.publicUrl : `https://drive.protonmail.com/urls/${sharedURL.token}`;
return `${url}${generatedPassword !== '' ? `#${generatedPassword}` : ''}`;
};
71 changes: 48 additions & 23 deletions patches/protonmail/proton-mail.patch
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,30 @@ index acfa71607..216229b0f 100644
* Verify the extracted `signature` of a decryption result against its `decryptedRawContent`

diff --git a/applications/mail/src/app/logic/messages/messagesTypes.ts b/applications/mail/src/app/logic/messages/messagesTypes.ts
index 0531de00e..665b8d087 100644
index 29d48870ab..fc19436f55 100644
--- a/applications/mail/src/app/logic/messages/messagesTypes.ts
+++ b/applications/mail/src/app/logic/messages/messagesTypes.ts
@@ -44,6 +44,7 @@ export interface MessageVerification {
@@ -49,20 +49,24 @@ export interface MessageVerification {
*/
verificationErrors: Error[] | undefined;

+ /* <electron-mail-mark> */
/**
* Pinned public keys of the sender which can verify, if any
*/
@@ -58,6 +59,7 @@ export interface MessageVerification {
senderPinnedKeys: PublicKeyReference[] | undefined;
+ /* </electron-mail-mark> */

/**
* Sender public keys retrieved from API which can are not pinned
*/
senderPinnableKeys: PublicKeyReference[] | undefined;

+ /* <electron-mail-mark> */
/**
* If the sender is in the list of contacts, whether its contact signature has been verified
*/
senderVerified: boolean | undefined;
pinnedKeysVerified: boolean | undefined;
+ /* </electron-mail-mark> */

/**
Expand Down Expand Up @@ -284,25 +293,25 @@ index bdabb99e0..a56b8cdcb 100644
onClose?.();
};

diff --git a/applications/mail/src/app/components/header/MailHeader.tsx b/applications/mail/src/app/components/header/MailHeader.tsx
index d86dc9880..e75180b46 100644
--- a/applications/mail/src/app/components/header/MailHeader.tsx
+++ b/applications/mail/src/app/components/header/MailHeader.tsx
@@ -38,7 +38,6 @@ import { setParamsInUrl } from '../../helpers/mailboxUrl';
import { Breakpoints } from '../../models/utils';
import MailOnboardingModal from '../onboarding/MailOnboardingModal';
diff --git a/applications/mail/src/app/components/header/MailHeaderSettingsButton.tsx b/applications/mail/src/app/components/header/MailHeaderSettingsButton.tsx
index 7254d20edd..90bf7324da 100644
--- a/applications/mail/src/app/components/header/MailHeaderSettingsButton.tsx
+++ b/applications/mail/src/app/components/header/MailHeaderSettingsButton.tsx
@@ -14,7 +14,6 @@ import { isFirefox } from '@proton/shared/lib/helpers/browser';

import { useEncryptedSearchContext } from '../../containers/EncryptedSearchProvider';
import ClearBrowserDataModal from './ClearBrowserDataModal';
-import MailDefaultHandlerModal from './MailDefaultHandlerModal';
import MailSearch from './search/MailSearch';
import OnboardingChecklistModal from './OnboardingChecklistModal';

interface Props {
@@ -192,7 +191,6 @@ const MailHeader = ({ labelID, elementID, breakpoints, expanded, onToggleExpand
const MailHeaderSettingsButton = () => {
@@ -126,7 +125,6 @@ const MailHeaderSettingsButton = () => {
<MailViewLayoutModal {...mailViewLayoutProps} />
<MailDensityModal {...mailDensityProps} />
<MailComposerModeModal {...mailComposerModeProps} />
- <MailDefaultHandlerModal {...mailDefaultHandlerProps} />
<ClearBrowserDataModal {...clearBrowserDataProps} />
<RebrandingFeedbackModal {...feedbackModalProps} />
<OnboardingChecklistModal {...onboardingChecklistProps} />
</>

diff --git a/applications/mail/src/app/helpers/url.ts b/applications/mail/src/app/helpers/url.ts
Expand All @@ -329,33 +338,49 @@ index 2aaa779d3..487f54ff3 100644
};

diff --git a/applications/mail/src/app/components/header/search/MailSearch.tsx b/applications/mail/src/app/components/header/search/MailSearch.tsx
index 6318e40be..ebbce0086 100644
index 6751a5c4e4..3eaa8effd6 100644
--- a/applications/mail/src/app/components/header/search/MailSearch.tsx
+++ b/applications/mail/src/app/components/header/search/MailSearch.tsx
@@ -11,10 +11,7 @@ import {
@@ -3,7 +3,6 @@ import { useEffect, useState } from 'react';
import { Location } from 'history';

import {
- FeatureCode,
TopNavbarListItemSearchButton,
generateUID,
useAddresses,
@@ -11,14 +10,11 @@ import {
useLabels,
useMailSettings,
usePopperAnchor,
- useProgressiveRollout,
useToggle,
- useUser,
} from '@proton/components';
-import { isMobile } from '@proton/shared/lib/helpers/browser';
-import { isPaid } from '@proton/shared/lib/user/helpers';

import { ADVANCED_SEARCH_OVERLAY_CLOSE_EVENT } from '../../../constants';
import { useEncryptedSearchContext } from '../../../containers/EncryptedSearchProvider';
@@ -40,7 +37,6 @@ const MailSearch = ({ breakpoints, labelID, location }: Props) => {
-import { isEncryptedSearchAvailable } from '../../../helpers/encryptedSearch/esUtils';
import { extractSearchParameters } from '../../../helpers/mailboxUrl';
import { useClickMailContent } from '../../../hooks/useClickMailContent';
import { Breakpoints } from '../../../models/utils';
@@ -38,11 +34,9 @@ interface Props {

const MailSearch = ({ breakpoints, labelID, location }: Props) => {
const [uid] = useState(generateUID('advanced-search-overlay'));
- const isESUserInterfaceAvailable = useProgressiveRollout(FeatureCode.ESUserInterface);
const { anchorRef, isOpen, open, close } = usePopperAnchor<HTMLInputElement>();
const searchParams = extractSearchParameters(location);
const [searchInputValue, setSearchInputValue] = useState(searchParams.keyword || '');
- const [user] = useUser();
const [, loadingMailSettings] = useMailSettings();
const [, loadingLabels] = useLabels();
const [, loadingFolders] = useFolders();
@@ -49,7 +45,7 @@ const MailSearch = ({ breakpoints, labelID, location }: Props) => {
@@ -50,7 +44,7 @@ const MailSearch = ({ breakpoints, labelID, location }: Props) => {
const { getESDBStatus, cacheIndexedDB, closeDropdown } = useEncryptedSearchContext();
const { dropdownOpened } = getESDBStatus();
const esState = useEncryptedSearchToggleState(isOpen);

- const showEncryptedSearch = !isMobile() && !!isPaid(user);
- const showEncryptedSearch = isEncryptedSearchAvailable(user, isESUserInterfaceAvailable);
+ const showEncryptedSearch = false;

// Show more from inside AdvancedSearch to persist the state when the overlay is closed
Expand Down
Loading

0 comments on commit 7ea9d00

Please sign in to comment.