From c9532bea8e60d462ecdfd82f58240b5ab7274f5f Mon Sep 17 00:00:00 2001 From: Danh Date: Mon, 16 Oct 2023 13:36:44 +0700 Subject: [PATCH] rename var rename var --- src/theme/components.tsx | 6 +++--- src/utils/redirect.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/theme/components.tsx b/src/theme/components.tsx index 963a5df9f5..fdea5c1bd6 100644 --- a/src/theme/components.tsx +++ b/src/theme/components.tsx @@ -206,7 +206,7 @@ export function ExternalLink({ @@ -227,7 +227,7 @@ export function ExternalLinkIcon({ console.debug('Fired outbound link event', href) } else { event.preventDefault() - navigateToUrl(href, { whitelistKyberSwap: false, allowRelativePath: true }) + navigateToUrl(href, { _dangerousCheckWhitelist: false, allowRelativePath: true }) } }, [href, target], @@ -236,7 +236,7 @@ export function ExternalLinkIcon({ diff --git a/src/utils/redirect.ts b/src/utils/redirect.ts index 905efea415..f7bf6d5dab 100644 --- a/src/utils/redirect.ts +++ b/src/utils/redirect.ts @@ -7,10 +7,10 @@ import { useChangeNetwork } from 'hooks/web3/useChangeNetwork' const whiteListDomains = [/https:\/\/(.+?\.)?kyberswap\.com$/, /https:\/\/(.+)\.kyberengineering\.io$/] -type Options = { whitelistKyberSwap?: boolean; allowRelativePath?: boolean } +type Options = { _dangerousCheckWhitelist?: boolean; allowRelativePath?: boolean } export const validateRedirectURL = ( url: string | undefined, - { whitelistKyberSwap = true, allowRelativePath = false }: Options = {}, + { _dangerousCheckWhitelist = true, allowRelativePath = false }: Options = {}, ) => { try { if (!url || url.endsWith('.js')) throw new Error() @@ -18,7 +18,7 @@ export const validateRedirectURL = ( if ( newUrl.pathname.endsWith('.js') || !['https:', 'http:'].includes(newUrl.protocol) || - (whitelistKyberSwap && !whiteListDomains.some(regex => newUrl.origin.match(regex))) + (_dangerousCheckWhitelist && !whiteListDomains.some(regex => newUrl.origin.match(regex))) ) { throw new Error() } @@ -50,7 +50,7 @@ export const useNavigateToUrl = () => { return } const { pathname, host, search } = new URL(actionURL) - if (!validateRedirectURL(actionURL, { whitelistKyberSwap: false })) return + if (!validateRedirectURL(actionURL, { _dangerousCheckWhitelist: false })) return if (window.location.host === host) { navigate(`${pathname}${search}`) } else {