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 Nov 11, 2021
1 parent 335552f commit 0133434
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 12 deletions.
File renamed without changes.
12 changes: 12 additions & 0 deletions patches/protonmail/captcha-2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/packages/components/containers/api/humanVerification/Captcha.tsx b/packages/components/containers/api/humanVerification/Captcha.tsx
index 926c6bc01..66fb79063 100644
--- a/packages/components/containers/api/humanVerification/Captcha.tsx
+++ b/packages/components/containers/api/humanVerification/Captcha.tsx
@@ -5,6 +5,7 @@ const getIframeUrl = (token: string) => {
const url = getApiSubdomainUrl('/core/v4/captcha');
url.searchParams.set('Token', token);
url.searchParams.set('ForceWebMessaging', '1');
+ url.protocol = "https:";
return url;
};

16 changes: 8 additions & 8 deletions patches/protonmail/meta.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"proton-account": [
"common.patch",
"sentry.patch",
"captcha.patch",
"sentry-2.patch",
"captcha-2.patch",
"pack-api-arg.patch",
"proton-account.patch"
],
"proton-calendar": [
"common.patch",
"sentry.patch",
"captcha.patch",
"sentry-1.patch",
"captcha-1.patch",
"pack-api-arg.patch"
],
"proton-drive": [
"common.patch",
"sentry.patch",
"captcha.patch",
"sentry-1.patch",
"captcha-1.patch",
"pack-api-arg.patch",
"proton-drive.patch"
],
"proton-mail": [
"common.patch",
"sentry.patch",
"captcha.patch",
"sentry-2.patch",
"captcha-2.patch",
"pack-api-arg.patch",
"proton-mail.patch"
]
Expand Down
File renamed without changes.
102 changes: 102 additions & 0 deletions patches/protonmail/sentry-2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
diff --git a/packages/shared/lib/helpers/sentry.ts b/packages/shared/lib/helpers/sentry.ts
index 5664f0fa6..375d20e29 100644
--- a/packages/shared/lib/helpers/sentry.ts
+++ b/packages/shared/lib/helpers/sentry.ts
@@ -1,95 +1,12 @@
import * as Sentry from '@sentry/browser';

import { ProtonConfig } from '../interfaces';
-import { VPN_HOSTNAME } from '../constants';
-
-const isLocalhost = (host: string) => host.startsWith('localhost');
-
-const isProduction = (host: string) => host.endsWith('.protonmail.com') || host === VPN_HOSTNAME;

function main({ SENTRY_DSN, COMMIT, APP_VERSION }: Pick<ProtonConfig, 'SENTRY_DSN' | 'COMMIT' | 'APP_VERSION'>) {
- const { host } = window.location;
-
- // No need to configure it if we don't load the DSN
- if (!SENTRY_DSN || isLocalhost(host)) {
- return;
- }
-
- // Assumes SENTRY_DSN is: https://111b3eeaaec34cae8e812df705690a36@sentry/11
- // To get https://111b3eeaaec34cae8e812df705690a36@mail.protonmail.com/api/reports/sentry/11
- const dsn = SENTRY_DSN.replace('sentry', `${host}/api/reports/sentry`);
-
- Sentry.init({
- dsn,
- release: isProduction(host) ? APP_VERSION : COMMIT,
- environment: host,
- normalizeDepth: 5,
- beforeSend(event, hint) {
- const error = hint?.originalException;
- const stack = typeof error === 'string' ? error : error?.stack;
- // Filter out broken ferdi errors
- if (stack && stack.match(/ferdi|franz/i)) {
- 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;
- },
- ignoreErrors: [
- // Ignore random plugins/extensions
- 'top.GLOBALS',
- 'canvas.contentDocument',
- 'MyApp_RemoveAllHighlights',
- 'atomicFindClose',
- '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.',
- 'No network connection',
- '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.
- 'ChunkLoadError', // WebPack loading source code.
- ],
- });
-
- Sentry.configureScope((scope) => {
- scope.setTag('appVersion', APP_VERSION);
- });
}

-export const traceError = (...args: Parameters<typeof Sentry.captureException>) => {
- if (!isLocalhost(window.location.host)) {
- Sentry.captureException(...args);
- }
-};
+export const traceError = (...args: Parameters<typeof Sentry.captureException>) => console.error(...args);

-export const captureMessage = (...args: Parameters<typeof Sentry.captureMessage>) => {
- if (!isLocalhost(window.location.host)) {
- Sentry.captureMessage(...args);
- }
-};
+export const captureMessage = (...args: Parameters<typeof Sentry.captureMessage>) => console.log(...args);

export default main;
8 changes: 4 additions & 4 deletions src/shared/proton-apps-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const PROVIDER_REPO_MAP = {
[PROVIDER_APP_NAMES[0]]: {
repoRelativeDistDir: "./dist",
baseDirName: "",
tag: "proton-mail@4.10.0",
tag: "proton-mail@4.11.1",
protonPack: {
appConfig: {clientId: "WebMail"},
webpackIndexEntryItems: [
Expand Down Expand Up @@ -48,13 +48,13 @@ export const PROVIDER_REPO_MAP = {
[PROVIDER_APP_NAMES[1]]: {
repoRelativeDistDir: "./dist",
baseDirName: "account",
tag: "proton-account@4.12.1",
tag: "proton-account@4.12.8",
protonPack: {appConfig: {clientId: "WebAccount"}}
},
[PROVIDER_APP_NAMES[2]]: {
repoRelativeDistDir: "./dist",
baseDirName: "calendar",
tag: "proton-calendar@4.7.0",
tag: "proton-calendar@4.7.6",
protonPack: {
appConfig: {clientId: "WebCalendar"},
webpackIndexEntryItems: [
Expand All @@ -67,7 +67,7 @@ export const PROVIDER_REPO_MAP = {
[PROVIDER_APP_NAMES[3]]: {
repoRelativeDistDir: "./dist",
baseDirName: "drive",
tag: "proton-drive@4.6.0",
tag: "proton-drive@4.6.1",
protonPack: {appConfig: {clientId: "WebDrive"}},
},
} as const;
Expand Down

0 comments on commit 0133434

Please sign in to comment.