mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-08-03 10:16:26 -04:00
refactor: rename
This commit is contained in:
parent
46c12a9f8c
commit
0ef2611633
@ -58,7 +58,7 @@ const RE_REDDIT =
|
|||||||
const RE_REDDIT_EMBED =
|
const RE_REDDIT_EMBED =
|
||||||
/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i;
|
/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i;
|
||||||
|
|
||||||
const ALLOWED_DOMAINS = new Set([
|
const ALLOWED_EMBED_HOSTS = new Set([
|
||||||
"youtube.com",
|
"youtube.com",
|
||||||
"youtu.be",
|
"youtu.be",
|
||||||
"vimeo.com",
|
"vimeo.com",
|
||||||
@ -92,7 +92,7 @@ const ALLOW_SAME_ORIGIN = new Set([
|
|||||||
"reddit.com",
|
"reddit.com",
|
||||||
"forms.microsoft.com",
|
"forms.microsoft.com",
|
||||||
"forms.gle",
|
"forms.gle",
|
||||||
"docs.google.com/forms",
|
"docs.google.com",
|
||||||
"app.sli.do",
|
"app.sli.do",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ const matchHostname = (
|
|||||||
|
|
||||||
if (allowedHostnames instanceof Set) {
|
if (allowedHostnames instanceof Set) {
|
||||||
// Check for exact domain match
|
// Check for exact domain match
|
||||||
if (ALLOWED_DOMAINS.has(bareDomain)) {
|
if (ALLOWED_EMBED_HOSTS.has(bareDomain)) {
|
||||||
return bareDomain;
|
return bareDomain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ const matchHostname = (
|
|||||||
const domainWithPath = `${bareDomain}${
|
const domainWithPath = `${bareDomain}${
|
||||||
pathname.split("/")[1] ? `/${pathname.split("/")[1]}` : ""
|
pathname.split("/")[1] ? `/${pathname.split("/")[1]}` : ""
|
||||||
}`;
|
}`;
|
||||||
if (ALLOWED_DOMAINS.has(domainWithPath)) {
|
if (ALLOWED_EMBED_HOSTS.has(domainWithPath)) {
|
||||||
return domainWithPath;
|
return domainWithPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ const matchHostname = (
|
|||||||
/^([^.]+)/,
|
/^([^.]+)/,
|
||||||
"*",
|
"*",
|
||||||
);
|
);
|
||||||
if (ALLOWED_DOMAINS.has(bareDomainWithFirstSubdomainWildcarded)) {
|
if (ALLOWED_EMBED_HOSTS.has(bareDomainWithFirstSubdomainWildcarded)) {
|
||||||
return bareDomainWithFirstSubdomainWildcarded;
|
return bareDomainWithFirstSubdomainWildcarded;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -459,5 +459,5 @@ export const embeddableURLValidator = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!matchHostname(url, ALLOWED_DOMAINS);
|
return !!matchHostname(url, ALLOWED_EMBED_HOSTS);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user