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 30, 2022
1 parent 8a246e1 commit af95d4b
Show file tree
Hide file tree
Showing 190 changed files with 2,690 additions and 2,500 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ jobs:
- { name: envinfo, run: npx envinfo }
- { name: install node modules, run: "pnpm install --frozen-lockfile" }
# </common>
- { name: build, run: 'npm exec --package=npm-run-all -- npm-run-all lint build', if: runner.os == 'macOS', env: {RUSTFLAGS: "-C link-args=-Wl,-undefined,dynamic_lookup"} }
- { name: build, run: 'npm exec --package=npm-run-all -- npm-run-all lint build', if: runner.os != 'macOS' }
- { name: build, run: 'npm exec --package=npm-run-all -- npm-run-all lint build' }
- { name: print ./app files, shell: bash, run: ./scripts/ci/list-fs-content.sh ./app }
- { name: upload artifact, uses: actions/upload-artifact@v2, with: { name: 'app-artifact-${{ runner.os }}', path: ./app, if-no-files-found: error } }
package-app:
Expand Down
6 changes: 3 additions & 3 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 <[email protected]>",
"license": "GPL-3.0",
"homepage": "https://github.com/vladimiry/ElectronMail",
Expand All @@ -28,7 +28,7 @@
"build": "npm-run-all build:electron-main build:electron-preload build:web",
"build:dev": "cross-env NODE_ENV=development npm-run-all build",
"build:electron-main": "npm-run-all scripts/code-generation/electron-main build:electron-main:compile:zstd-native build:electron-main:compile",
"build:electron-main:compile:zstd-native": "pnpm run --filter zstd-native build",
"build:electron-main:compile:zstd-native": "pnpm run ts-node:shortcut -- ./scripts/electron-main-compile-zstd-native.ts",
"build:electron-main:compile": "pnpm run webpack:shortcut -- --config ./webpack-configs/electron-main.ts",
"build:electron-main:dev": "cross-env NODE_ENV=development npm-run-all build:electron-main",
"build:electron-main:watch": "cross-env WEBPACK_ENV_WATCH=1 npm-run-all build:electron-main",
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
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 af95d4b

Please sign in to comment.