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 May 28, 2022
1 parent b13d824 commit 2599f1d
Show file tree
Hide file tree
Showing 162 changed files with 1,435 additions and 1,357 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "electron-mail",
"description": "Unofficial ProtonMail Desktop App",
"version": "4.15.1",
"version": "5.0.0",
"author": "Vladimir Yakovlev <desktop-app@protonmail.ch>",
"license": "GPL-3.0",
"homepage": "https://github.com/vladimiry/ElectronMail",
Expand Down Expand Up @@ -78,7 +78,7 @@
"lint:ts:base:eslint": "eslint",
"lint:ts:eslint": "pnpm run lint:ts:base:eslint \"./src/**/*.ts\" \"./scripts/**/*.ts\" \"./webpack-configs/**/*.ts\"",
"start:electron": "electron ./app/electron-main/index.cjs",
"start:electron:dev": "electron ./app-dev/electron-main/index.cjs",
"start:electron:dev": "electron --inspect-brk- ./app-dev/electron-main/index.cjs",
"test:e2e:build-code": "cross-env NODE_ENV=e2e npm-run-all build:electron-main build:electron-preload:browser-window build:electron-preload:webview-primary build:electron-preload:webview-calendar",
"test:e2e:run": "cross-env DEBUG=pw:api TS_NODE_PROJECT=./src/e2e/tsconfig.json pnpm run ts-node:shortcut -- ./node_modules/playwright/cli.js test --global-timeout 600000 --timeout 600000",
"test:e2e": "npm-run-all test:e2e:build-code test:e2e:run",
Expand Down
6 changes: 3 additions & 3 deletions patches/patch-package/ts-node+10.8.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ index 2fbd832..0f39f96 100644
--- a/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js
+++ b/node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js
@@ -307,11 +307,10 @@ function resolveExtensions(search) {

/** This replaces JS with TS extensions */
function resolveReplacementExtensions(search) {
- const lastDotIndex = search.pathname.lastIndexOf('.');
Expand All @@ -23,7 +23,7 @@ index 2fbd832..0f39f96 100644
}
+ } else {
+ const indexFile = `${search}/index.ts`;
+ return fileExists(indexFile) ? indexFile : `${search}.ts`;
+ return fileExists(indexFile) ? indexFile : `${search}.ts`;
}
return undefined;
}
Expand All @@ -45,6 +45,6 @@ index 2272275..98d3901 100644
+ options,
+ parseArgv(envArgv),
+ );
+ }
+ }
return options;
}
53 changes: 0 additions & 53 deletions patches/protonmail/captcha-3.patch

This file was deleted.

84 changes: 81 additions & 3 deletions patches/protonmail/common.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ index 55715b89d..c87879ad4 100755
stdio: 'inherit',
}

diff --git a/packages/pack/webpack/plugins.js b/packages/pack/webpack/plugins.js
index ec0febbc7..28181dc72 100644
--- a/packages/pack/webpack/plugins.js
+++ b/packages/pack/webpack/plugins.js
@@ -139,7 +139,7 @@ module.exports = ({ isProduction, publicPath, appMode, buildData, featureFlags,
},
}),

- ...(writeSRI
+ ...(false
? [
new SubresourceIntegrityPlugin(),
new SriStripPlugin({

diff --git a/packages/pack/webpack/css.loader.js b/packages/pack/webpack/css.loader.js
index c50ab972c..a505eb314 100644
--- a/packages/pack/webpack/css.loader.js
Expand Down Expand Up @@ -56,9 +70,9 @@ index 9aaa78a28..f3d24b47c 100644
+{
+ const platform = String(navigator.platform);
+ const userAgents = {
+ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36",
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36",
+ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36"
+ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61/63 Safari/537.36",
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61/63 Safari/537.36",
+ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61/63 Safari/537.36"
+ } as const;
+ uaParser.setUA(
+ platform.startsWith("Linux")
Expand Down Expand Up @@ -112,3 +126,67 @@ index ebce00d20..96498d8c8 100644
{...rest}
>
{children}

diff --git a/packages/components/containers/topBanners/NudgeTopBanner.tsx b/packages/components/containers/topBanners/NudgeTopBanner.tsx
index 38e76fbcd..cace56733 100644
--- a/packages/components/containers/topBanners/NudgeTopBanner.tsx
+++ b/packages/components/containers/topBanners/NudgeTopBanner.tsx
@@ -14,7 +14,7 @@ const NudgeTopBanner = () => {
const [show] = useState(getIsProtonMailDomain);
const { feature } = useFeature(FeatureCode.NudgeProton);

- if (!feature?.Value || !show) {
+ if (Boolean("1") || !feature?.Value || !show) {
return null;
}

diff --git a/packages/shared/lib/fetch/helpers.ts b/packages/shared/lib/fetch/helpers.ts
index 6edb249f3..738c4da33 100644
--- a/packages/shared/lib/fetch/helpers.ts
+++ b/packages/shared/lib/fetch/helpers.ts
@@ -10,11 +10,13 @@ const appendQueryParams = (url: URL, params: { [key: string]: any }) => {
});
};

+/* electron-mail mark */
export const createUrl = (urlString: string, params: { [key: string]: any } = {}) => {
const url = new URL(urlString, window.location.origin);
appendQueryParams(url, params);
return url;
};
+/* electron-mail mark */

export const checkStatus = (response: Response, config: any) => {
const { status } = response;

diff --git a/packages/components/helpers/earlyAccessDesynchronization.ts b/packages/components/helpers/earlyAccessDesynchronization.ts
index 36bd0c712..c2fb3681c 100644
--- a/packages/components/helpers/earlyAccessDesynchronization.ts
+++ b/packages/components/helpers/earlyAccessDesynchronization.ts
@@ -42,6 +42,7 @@ export const handleEarlyAccessDesynchronization = ({
earlyAccessScope: Feature<Environment> | undefined;
appName: APP_NAMES;
}) => {
+ return;
if (doesNotSupportEarlyAccessVersion()) {
return;
}

diff --git a/packages/shared/lib/helpers/url.ts b/packages/shared/lib/helpers/url.ts
index d01e07cc6..74af6c896 100644
--- a/packages/shared/lib/helpers/url.ts
+++ b/packages/shared/lib/helpers/url.ts
@@ -183,12 +183,7 @@ export const getRelativeApiHostname = (hostname: string) => {
};

export const getApiSubdomainUrl = (pathname: string) => {
- const url = new URL('/', window.location.origin);
- if (url.hostname === 'localhost') {
- 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;
};
51 changes: 0 additions & 51 deletions patches/protonmail/constants-2.patch

This file was deleted.

38 changes: 0 additions & 38 deletions patches/protonmail/link-handler-3.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/packages/components/hooks/useLinkHandler.tsx b/packages/components/hooks/useLinkHandler.tsx
index 7fdec1d3b..256ddf8be 100644
index 5b7079cf3..782372313 100644
--- a/packages/components/hooks/useLinkHandler.tsx
+++ b/packages/components/hooks/useLinkHandler.tsx
@@ -4,7 +4,7 @@ import punycode from 'punycode.js';
Expand All @@ -11,7 +11,7 @@ index 7fdec1d3b..256ddf8be 100644
import isTruthy from '@proton/shared/lib/helpers/isTruthy';
import { PROTON_DOMAINS } from '@proton/shared/lib/constants';

@@ -163,6 +163,10 @@ export const useLinkHandler: UseLinkHandler = (
@@ -164,6 +164,10 @@ export const useLinkHandler: UseLinkHandler = (
return;
}

Expand All @@ -20,9 +20,9 @@ index 7fdec1d3b..256ddf8be 100644
+ const encodedLink = await encoder(src);
+
if (
askForConfirmation &&
(askForConfirmation || isPhishingAttempt) &&
isExternal(src.raw) &&
@@ -170,13 +174,10 @@ export const useLinkHandler: UseLinkHandler = (
@@ -171,13 +175,10 @@ export const useLinkHandler: UseLinkHandler = (
.filter(isTruthy) // currentDomain can be null
.some((domain) => isSubDomain(hostname, domain))
) {
Expand All @@ -38,4 +38,4 @@ index 7fdec1d3b..256ddf8be 100644
+ openNewTab(encodedLink);
}
});

37 changes: 16 additions & 21 deletions patches/protonmail/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,49 @@
"proton-mail": [
"common.patch",
"constants-3.patch",
"sentry-5.patch",
"captcha-3.patch",
"sentry-6.patch",
"pack-api-arg-3.patch",
"pack-webpack-config-3.patch",
"session-storage-2.patch",
"link-handler-2.patch",
"session-storage-3.patch",
"link-handler-4.patch",
"proton-mail.patch"
],
"proton-account": [
"common.patch",
"constants-3.patch",
"sentry-5.patch",
"captcha-3.patch",
"sentry-6.patch",
"pack-api-arg-3.patch",
"pack-webpack-config-3.patch",
"session-storage-2.patch",
"link-handler-3.patch",
"session-storage-3.patch",
"link-handler-4.patch",
"proton-account.patch"
],
"proton-calendar": [
"common.patch",
"constants-2.patch",
"sentry-4.patch",
"captcha-3.patch",
"constants-3.patch",
"sentry-6.patch",
"pack-api-arg-3.patch",
"pack-webpack-config-3.patch",
"link-handler-2.patch",
"session-storage-2.patch"
"link-handler-4.patch",
"session-storage-3.patch"
],
"proton-drive": [
"common.patch",
"constants-3.patch",
"sentry-4.patch",
"captcha-3.patch",
"sentry-6.patch",
"pack-api-arg-3.patch",
"pack-webpack-config-3.patch",
"session-storage-2.patch",
"link-handler-2.patch",
"session-storage-3.patch",
"link-handler-4.patch",
"proton-drive.patch"
],
"proton-vpn-settings": [
"common.patch",
"constants-3.patch",
"sentry-5.patch",
"captcha-3.patch",
"sentry-6.patch",
"pack-api-arg-3.patch",
"pack-webpack-config-3.patch",
"session-storage-2.patch",
"link-handler-3.patch"
"session-storage-3.patch",
"link-handler-4.patch"
]
}
Loading

0 comments on commit 2599f1d

Please sign in to comment.