mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 22:18:54 +08:00
Merge commit from fork
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { DebugLogger } from '@affine/debug';
|
import { DebugLogger } from '@affine/debug';
|
||||||
import { type LoaderFunction, Navigate, useLoaderData } from 'react-router-dom';
|
import { type LoaderFunction, Navigate, useLoaderData } from 'react-router-dom';
|
||||||
|
import { escapeRegExp } from 'lodash-es';
|
||||||
|
|
||||||
const trustedDomain = [
|
const trustedDomain = [
|
||||||
'google.com',
|
'google.com',
|
||||||
@@ -41,7 +42,7 @@ export const loader: LoaderFunction = async ({ request }) => {
|
|||||||
if (
|
if (
|
||||||
target.hostname === window.location.hostname ||
|
target.hostname === window.location.hostname ||
|
||||||
trustedDomain.some(domain =>
|
trustedDomain.some(domain =>
|
||||||
new RegExp(`.?${domain}$`).test(target.hostname)
|
new RegExp(`(^|\\.)${escapeRegExp(domain)}$`).test(target.hostname)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
location.href = redirectUri;
|
location.href = redirectUri;
|
||||||
|
|||||||
Reference in New Issue
Block a user