-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
190 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
diff --git a/packages/pack/scripts/validate.sh b/packages/pack/scripts/validate.sh | ||
index 1a2ea64..bae388c 100755 | ||
--- a/packages/pack/scripts/validate.sh | ||
+++ b/packages/pack/scripts/validate.sh | ||
@@ -58,7 +58,7 @@ function main { | ||
fi; | ||
|
||
if [ "$hasSourceMap" -eq 0 ]; then | ||
- hasError=true; | ||
+ #hasError=true; | ||
echo "[error] no SourceMaps found inside the directory: $OUTPUT_DIR"; | ||
fi; | ||
|
||
diff --git a/packages/pack/bin/protonPack.js b/packages/pack/bin/protonPack.js | ||
index 55715b89d..c87879ad4 100755 | ||
--- a/packages/pack/bin/protonPack.js | ||
+++ b/packages/pack/bin/protonPack.js | ||
@@ -81,7 +81,7 @@ addGlobalOptions(program.command('build').description('create an optimized produ | ||
const outputPath = path.resolve('./dist'); | ||
await commandWithLog(`rm -rf ${outputPath}`); | ||
await commandWithLog( | ||
- `${require.resolve('webpack-cli/bin/cli.js')} --progress --output-path=${outputPath} ${webpackArgs}`, | ||
+ `${require.resolve('webpack-cli/bin/cli.js')} --output-path=${outputPath} ${webpackArgs}`, | ||
{ | ||
stdio: 'inherit', | ||
} | ||
|
||
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 | ||
+++ b/packages/pack/webpack/css.loader.js | ||
@@ -44,11 +44,13 @@ module.exports = ({ browserslist }) => { | ||
}, | ||
{ | ||
loader: require.resolve('resolve-url-loader'), | ||
+ options: {sourceMap: false}, | ||
}, | ||
{ | ||
loader: require.resolve('sass-loader'), | ||
options: { | ||
additionalData: PREPEND_SASS, | ||
+ sourceMap: true, // to please "resolve-url-loader" | ||
}, | ||
}, | ||
].filter(Boolean); | ||
|
||
|
||
diff --git a/packages/shared/lib/helpers/browser.ts b/packages/shared/lib/helpers/browser.ts | ||
index 9aaa78a28..f3d24b47c 100644 | ||
--- a/packages/shared/lib/helpers/browser.ts | ||
+++ b/packages/shared/lib/helpers/browser.ts | ||
@@ -1,6 +1,21 @@ | ||
import UAParser from 'ua-parser-js'; | ||
|
||
const uaParser = new UAParser(); | ||
+{ | ||
+ const platform = String(navigator.platform); | ||
+ const userAgents = { | ||
+ linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", | ||
+ windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", | ||
+ macos: "Mozilla/5.0 (Macintosh; Intel Mac OS X 13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" | ||
+ } as const; | ||
+ uaParser.setUA( | ||
+ platform.startsWith("Linux") | ||
+ ? userAgents.linux | ||
+ : platform.startsWith("Win") | ||
+ ? userAgents.windows | ||
+ : userAgents.macos | ||
+ ); | ||
+} | ||
const ua = uaParser.getResult(); | ||
|
||
export const hasModulesSupport = () => { | ||
@@ -89,20 +104,10 @@ export const requireDirectAction = () => isSafari() || isFirefox() || isEdge(); | ||
* @links { https://mathiasbynens.github.io/rel-noopener/} | ||
*/ | ||
export const openNewTab = (url: string) => { | ||
- if (isIE11()) { | ||
- const otherWindow = window.open(); | ||
- if (!otherWindow) { | ||
- return; | ||
- } | ||
- otherWindow.opener = null; | ||
- otherWindow.location.href = url; | ||
- return; | ||
- } | ||
- const anchor = document.createElement('a'); | ||
- | ||
- anchor.setAttribute('rel', 'noreferrer nofollow noopener'); | ||
- anchor.setAttribute('target', '_blank'); | ||
- anchor.href = url; | ||
- | ||
- return anchor.click(); | ||
+ window.dispatchEvent( | ||
+ new CustomEvent( | ||
+ "electron-mail:packages/shared/lib/helpers/browser.ts:openNewTab", | ||
+ {detail: {url}}, | ||
+ ), | ||
+ ); | ||
}; | ||
|
||
diff --git a/packages/components/components/link/SettingsLink.tsx b/packages/components/components/link/SettingsLink.tsx | ||
index ebce00d20..96498d8c8 100644 | ||
--- a/packages/components/components/link/SettingsLink.tsx | ||
+++ b/packages/components/components/link/SettingsLink.tsx | ||
@@ -37,7 +37,7 @@ const SettingsLink = ({ path, app, children, ...rest }: Props, ref: Ref<HTMLAnch | ||
ref={ref} | ||
toApp={APPS.PROTONACCOUNT} | ||
// If going to settings for the same app | ||
- target={isGoingToSameSettings ? '_self' : '_blank'} | ||
+ target={isGoingToSameSettings || app === APPS.PROTONVPN_SETTINGS ? '_self' : '_blank'} | ||
{...rest} | ||
> | ||
{children} | ||
|
||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
20 changes: 9 additions & 11 deletions
20
patches/protonmail/link-handler-6.patch → patches/protonmail/link-handler-7.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,39 @@ | ||
diff --git a/packages/components/hooks/useLinkHandler.tsx b/packages/components/hooks/useLinkHandler.tsx | ||
index cd4a0af3a..7d192d8d6 100644 | ||
index 4038ff8b0..8faca2d95 100644 | ||
--- a/packages/components/hooks/useLinkHandler.tsx | ||
+++ b/packages/components/hooks/useLinkHandler.tsx | ||
@@ -4,7 +4,7 @@ import punycode from 'punycode.js'; | ||
@@ -2,6 +2,7 @@ import { ReactNode, RefObject, useEffect, useState } from 'react'; | ||
|
||
import { c } from 'ttag'; | ||
|
||
+import { openNewTab } from '@proton/shared/lib/helpers/browser'; | ||
import { PROTON_DOMAINS } from '@proton/shared/lib/constants'; | ||
-import { isEdge, isIE11 } from '@proton/shared/lib/helpers/browser'; | ||
+import { isEdge, isIE11, openNewTab } from '@proton/shared/lib/helpers/browser'; | ||
import { getSecondLevelDomain } from '@proton/shared/lib/helpers/url'; | ||
import { MailSettings } from '@proton/shared/lib/interfaces'; | ||
import isTruthy from '@proton/utils/isTruthy'; | ||
@@ -165,6 +165,10 @@ export const useLinkHandler: UseLinkHandler = ( | ||
@@ -128,6 +129,10 @@ export const useLinkHandler: UseLinkHandler = ( | ||
return; | ||
} | ||
|
||
+ event.preventDefault(); | ||
+ event.stopPropagation(); // Required for Safari | ||
+ const encodedLink = await encoder(src); | ||
+ const encodedLink = await punycodeUrl(src.encoded || src.raw); | ||
+ | ||
if ( | ||
(askForConfirmation || isPhishingAttempt) && | ||
isExternal(src.raw) && | ||
@@ -172,13 +176,10 @@ export const useLinkHandler: UseLinkHandler = ( | ||
@@ -135,12 +140,10 @@ export const useLinkHandler: UseLinkHandler = ( | ||
.filter(isTruthy) // currentDomain can be null | ||
.some((domain) => isSubDomain(hostname, domain)) | ||
) { | ||
- event.preventDefault(); | ||
- event.stopPropagation(); // Required for Safari | ||
- | ||
- const link = await encoder(src); | ||
- const link = punycodeUrl(src.encoded || src.raw); | ||
- setLink(link); | ||
- | ||
+ setLink(encodedLink); | ||
setLinkConfirmationModalOpen(true); | ||
+ } else { | ||
+ openNewTab(encodedLink ?? src.raw); | ||
+ openNewTab(encodedLink); | ||
} | ||
}); | ||
|
Oops, something went wrong.