diff --git a/patches/protonmail/common-4.patch b/patches/protonmail/common-4.patch index 81d3dbee..d1dd74ce 100644 --- a/patches/protonmail/common-4.patch +++ b/patches/protonmail/common-4.patch @@ -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", + ); + }); + }; diff --git a/patches/protonmail/drop-circular-dependency.patch b/patches/protonmail/drop-circular-dependency.patch deleted file mode 100644 index 4f983178..00000000 --- a/patches/protonmail/drop-circular-dependency.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/packages/components/hooks/usePendingUserInvitations.ts b/packages/components/hooks/usePendingUserInvitations.ts -index 6044196e1..b35ae94f5 100644 ---- a/packages/components/hooks/usePendingUserInvitations.ts -+++ b/packages/components/hooks/usePendingUserInvitations.ts -@@ -2,11 +2,11 @@ import { useCallback } from 'react'; - - import { getInvitations } from '@proton/shared/lib/api/user'; - import { Api, PendingInvitation as PendingUserInvitation } from '@proton/shared/lib/interfaces'; --import { UserInvitationModel } from '@proton/shared/lib/models'; - - import useApi from './useApi'; - import useCache from './useCache'; - import useCachedModelResult from './useCachedModelResult'; -+import { UserInvitationModelKey } from '@proton/shared/lib/models/userInvitationModel.key'; - - export const fetchPendingUserInvitations = (api: Api) => - api<{ UserInvitations: PendingUserInvitation[] }>(getInvitations()).then(({ UserInvitations }) => { -@@ -18,7 +18,7 @@ const usePendingUserInvitations = (): [PendingUserInvitation[] | undefined, bool - const cache = useCache(); - - const miss = useCallback(() => fetchPendingUserInvitations(api), [api]); -- return useCachedModelResult(cache, UserInvitationModel.key, miss); -+ return useCachedModelResult(cache, UserInvitationModelKey, miss); - }; - - export default usePendingUserInvitations; -diff --git a/packages/shared/lib/models/userInvitationModel.js b/packages/shared/lib/models/userInvitationModel.js -index 1fa9690b7..a9035e06d 100644 ---- a/packages/shared/lib/models/userInvitationModel.js -+++ b/packages/shared/lib/models/userInvitationModel.js -@@ -1,9 +1,10 @@ - import { fetchPendingUserInvitations } from '@proton/components/hooks/usePendingUserInvitations'; - - import updateCollection from '../helpers/updateCollection'; -+import { UserInvitationModelKey as key } from './userInvitationModel.key'; - - export const UserInvitationModel = { -- key: 'UserInvitations', -+ key, - get: fetchPendingUserInvitations, - update: (model, events) => updateCollection({ model, events, itemKey: 'UserInvitation' }), - }; -diff --git a/packages/shared/lib/models/userInvitationModel.key.js b/packages/shared/lib/models/userInvitationModel.key.js -new file mode 100644 -index 000000000..c07ff03fa ---- /dev/null -+++ b/packages/shared/lib/models/userInvitationModel.key.js -@@ -0,0 +1 @@ -+export const UserInvitationModelKey = 'UserInvitations'; diff --git a/patches/protonmail/meta.json b/patches/protonmail/meta.json index fdc76b60..9aa8a5c4 100644 --- a/patches/protonmail/meta.json +++ b/patches/protonmail/meta.json @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/patches/protonmail/pack-api-arg-5.patch b/patches/protonmail/pack-api-arg-5.patch new file mode 100644 index 00000000..3eb65783 --- /dev/null +++ b/patches/protonmail/pack-api-arg-5.patch @@ -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'; diff --git a/patches/protonmail/proton-account.patch b/patches/protonmail/proton-account.patch index 2046bee7..6bebf98a 100644 --- a/patches/protonmail/proton-account.patch +++ b/patches/protonmail/proton-account.patch @@ -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); - /* diff --git a/patches/protonmail/proton-drive.patch b/patches/protonmail/proton-drive.patch index 7808c17a..9d148fee 100644 --- a/patches/protonmail/proton-drive.patch +++ b/patches/protonmail/proton-drive.patch @@ -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}` : ''}`; }; diff --git a/patches/protonmail/proton-mail.patch b/patches/protonmail/proton-mail.patch index 310b683c..0c8cb8dc 100644 --- a/patches/protonmail/proton-mail.patch +++ b/patches/protonmail/proton-mail.patch @@ -86,10 +86,10 @@ 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; @@ -97,10 +97,19 @@ index 0531de00e..665b8d087 100644 /** * Pinned public keys of the sender which can verify, if any */ -@@ -58,6 +59,7 @@ export interface MessageVerification { + senderPinnedKeys: PublicKeyReference[] | undefined; ++ /* */ + + /** + * Sender public keys retrieved from API which can are not pinned + */ + senderPinnableKeys: PublicKeyReference[] | undefined; + ++ /* */ + /** * If the sender is in the list of contacts, whether its contact signature has been verified */ - senderVerified: boolean | undefined; + pinnedKeysVerified: boolean | undefined; + /* */ /** @@ -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 = () => { - - + diff --git a/applications/mail/src/app/helpers/url.ts b/applications/mail/src/app/helpers/url.ts @@ -329,21 +338,37 @@ 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(); const searchParams = extractSearchParameters(location); const [searchInputValue, setSearchInputValue] = useState(searchParams.keyword || ''); @@ -351,11 +376,11 @@ index 6318e40be..ebbce0086 100644 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 diff --git a/patches/protonmail/sentry-13.patch b/patches/protonmail/sentry-13.patch new file mode 100644 index 00000000..051471cc --- /dev/null +++ b/patches/protonmail/sentry-13.patch @@ -0,0 +1,189 @@ +diff --git a/packages/shared/lib/helpers/sentry.ts b/packages/shared/lib/helpers/sentry.ts +index eebbf3817f..6d6a3fb2a8 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,144 +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 as any; +- 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; +- }, +- // Some ignoreErrors and denyUrls are taken from this gist: https://gist.github.com/Chocksy/e9b2cdd4afc2aadc7989762c4b8b495a +- // This gist is suggested in the Sentry documentation: https://docs.sentry.io/clients/javascript/tips/#decluttering-sentry +- ignoreErrors: [ +- // Ignore random plugins/extensions +- 'top.GLOBALS', +- 'canvas.contentDocument', +- 'MyApp_RemoveAllHighlights', +- 'atomicFindClose', +- // See http://toolbar.conduit.com/Developer/HtmlAndGadget/Methods/JSInjection.aspx +- '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 +- // See: http://blog.errorception.com/2012/03/tale-of-unfindable-js-error.html +- 'originalCreateNotification', +- 'http://tt.epicplay.com', +- "Can't find variable: ZiteReader", +- 'jigsaw is not defined', +- 'ComboSearch is not defined', +- 'http://loading.retry.widdit.com/', +- // Facebook borked +- 'fb_xd_fragment', +- // ISP "optimizing" proxy - `Cache-Control: no-transform` seems to reduce this. (thanks @acdha) +- // See http://stackoverflow.com/questions/4113268/how-to-stop-javascript-injection-from-vodafone-proxy +- 'bmi_SafeAddOnload', +- 'EBCallBackMessageReceived', +- // Avast extension error +- '_avast_submit', +- 'AbortError', +- ], +- denyUrls: [ +- // Google Adsense +- /pagead\/js/i, +- // Facebook flakiness +- /graph\.facebook\.com/i, +- // Facebook blocked +- /connect\.facebook\.net\/en_US\/all\.js/i, +- // Woopra flakiness +- /eatdifferent\.com\.woopra-ns\.com/i, +- /static\.woopra\.com\/js\/woopra\.js/i, +- // Chrome extensions +- /extensions\//i, +- /^chrome:\/\//i, +- // Other plugins +- /127\.0\.0\.1:4001\/isrunning/i, // Cacaoweb +- /webappstoolbarba\.texthelp\.com\//i, +- /metrics\.itunes\.apple\.com\.edgesuite\.net\//i, +- ], +- }); +- +- 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/patches/protonmail/url-5.patch b/patches/protonmail/url-5.patch new file mode 100644 index 00000000..201d5185 --- /dev/null +++ b/patches/protonmail/url-5.patch @@ -0,0 +1,75 @@ +diff --git a/packages/shared/lib/helpers/url.ts b/packages/shared/lib/helpers/url.ts +index 0c21c0f042..8ccd5ce82b 100644 +--- a/packages/shared/lib/helpers/url.ts ++++ b/packages/shared/lib/helpers/url.ts +@@ -183,48 +183,16 @@ export const getSecondLevelDomain = (hostname: string) => { + return hostname.slice(hostname.indexOf('.') + 1); + }; + +-export const getRelativeApiHostname = (hostname: string) => { +- const idx = hostname.indexOf('.'); +- const first = hostname.slice(0, idx); +- const second = hostname.slice(idx + 1); +- return `${first}-api.${second}`; +-}; +- + export const getIsDohDomain = (origin: string) => { + return DOH_DOMAINS.some((dohDomain) => origin.endsWith(dohDomain)); + }; + + export const getApiSubdomainUrl = (pathname: string) => { +- const url = new URL('/', window.location.origin); +- if (url.hostname === 'localhost' || getIsDohDomain(url.origin)) { +- url.pathname = `/api${pathname}`; +- return url; +- } +- url.hostname = getRelativeApiHostname(url.hostname); ++ const url = new URL('/', '___ELECTRON_MAIL_PROTON_API_ENTRY_URL_PLACEHOLDER___'); + url.pathname = pathname; + return url; + }; + +-export const getAppUrlFromApiUrl = (apiUrl: string, appName: APP_NAMES) => { +- const { subdomain } = APPS_CONFIGURATION[appName]; +- const url = new URL(apiUrl); +- const { hostname } = url; +- const index = hostname.indexOf('.'); +- const tail = hostname.slice(index + 1); +- url.pathname = ''; +- url.hostname = `${subdomain}.${tail}`; +- return url; +-}; +- +-export const getAppUrlRelativeToOrigin = (origin: string, appName: APP_NAMES) => { +- const { subdomain } = APPS_CONFIGURATION[appName]; +- const url = new URL(origin); +- const segments = url.host.split('.'); +- segments[0] = subdomain; +- url.hostname = segments.join('.'); +- return url; +-}; +- + let cache = ''; + export const getStaticURL = (path: string) => { + if ( + +diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts +index 666b9f56c6..246f0e03b4 100644 +--- a/packages/shared/lib/fetch/helpers.ts ++++ b/packages/shared/lib/fetch/helpers.ts +@@ -11,6 +11,7 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => { + }); + }; + ++/* */ + export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => { + let url: URL; + if (typeof window !== 'undefined') { +@@ -21,6 +22,7 @@ export const createUrl = (urlString: string, params: { [key: string]: any } = {} + appendQueryParams(url, params); + return url; + }; ++/* */ + + export const checkStatus = (response: Response, config: any) => { + const { status } = response; diff --git a/src/electron-preload/webview/primary/provider-api/index.ts b/src/electron-preload/webview/primary/provider-api/index.ts index 5e11119d..7d5e483b 100644 --- a/src/electron-preload/webview/primary/provider-api/index.ts +++ b/src/electron-preload/webview/primary/provider-api/index.ts @@ -208,7 +208,7 @@ export const initProviderApi = async (): Promise => { ): NoExtraProps => { const result = { senderPinnedKeys: encryptionPreferences.pinnedKeys, - senderVerified: Boolean(encryptionPreferences.isContactSignatureVerified), + pinnedKeysVerified: Boolean(encryptionPreferences.isContactSignatureVerified), } as const; // this proxy helps early detecting unexpected/not-yet-reviewed protonmail's "getDecryptedAttachment" behaviour // if/likely-when the behaviour gets changed by protonmail diff --git a/src/electron-preload/webview/primary/provider-api/model.ts b/src/electron-preload/webview/primary/provider-api/model.ts index 87a73c1e..8645b021 100644 --- a/src/electron-preload/webview/primary/provider-api/model.ts +++ b/src/electron-preload/webview/primary/provider-api/model.ts @@ -196,7 +196,7 @@ export interface MessageKeys { export interface MessageVerification { senderPinnedKeys: EncryptionPreferences["pinnedKeys"] | undefined; - senderVerified: boolean | undefined; + pinnedKeysVerified: boolean | undefined; } export type MessageExtended = NoExtraProps<{ diff --git a/src/shared/const/proton-apps.ts b/src/shared/const/proton-apps.ts index e27c6359..26413380 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.22.7", + tag: "proton-mail@5.0.24.15", protonPack: { webpackIndexEntryItems: [ // immediate @@ -49,14 +49,14 @@ export const PROVIDER_REPO_MAP = { basePath: "account", apiSubdomain: "account-api", repoRelativeDistDir: "./dist", - tag: "proton-account@5.0.31.3", + tag: "proton-account@5.0.41.1", protonPack: {} }, [PROVIDER_APP_NAMES[2]]: { basePath: "calendar", apiSubdomain: "calendar-api", repoRelativeDistDir: "./dist", - tag: "proton-calendar@5.0.10.15", + tag: "proton-calendar@5.0.11.9", protonPack: { webpackIndexEntryItems: [ // immediate @@ -69,14 +69,14 @@ export const PROVIDER_REPO_MAP = { basePath: "drive", apiSubdomain: "drive-api", repoRelativeDistDir: "./dist", - tag: "proton-drive@5.0.13.8", + tag: "proton-drive@5.0.14.5", protonPack: {}, }, [PROVIDER_APP_NAMES[4]]: { basePath: "account/vpn", apiSubdomain: "account-api", repoRelativeDistDir: "./dist", - tag: "proton-vpn-settings@5.0.30.2", + tag: "proton-vpn-settings@5.0.35.1", protonPack: {}, }, } as const;