feat: add support for simplePDF in Web-Embeds (#6810)
This commit is contained in:
parent
1acc646534
commit
9ca27c62c7
@ -941,7 +941,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
title="Excalidraw Embedded Content"
|
title="Excalidraw Embedded Content"
|
||||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||||
allowFullScreen={true}
|
allowFullScreen={true}
|
||||||
sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation"
|
sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,6 +55,7 @@ const ALLOWED_DOMAINS = new Set([
|
|||||||
"link.excalidraw.com",
|
"link.excalidraw.com",
|
||||||
"gist.github.com",
|
"gist.github.com",
|
||||||
"twitter.com",
|
"twitter.com",
|
||||||
|
"*.simplepdf.eu",
|
||||||
"stackblitz.com",
|
"stackblitz.com",
|
||||||
"val.town",
|
"val.town",
|
||||||
]);
|
]);
|
||||||
@ -274,9 +275,16 @@ const validateHostname = (
|
|||||||
const { hostname } = new URL(url);
|
const { hostname } = new URL(url);
|
||||||
|
|
||||||
const bareDomain = hostname.replace(/^www\./, "");
|
const bareDomain = hostname.replace(/^www\./, "");
|
||||||
|
const bareDomainWithFirstSubdomainWildcarded = bareDomain.replace(
|
||||||
|
/^([^.]+)/,
|
||||||
|
"*",
|
||||||
|
);
|
||||||
|
|
||||||
if (allowedHostnames instanceof Set) {
|
if (allowedHostnames instanceof Set) {
|
||||||
return ALLOWED_DOMAINS.has(bareDomain);
|
return (
|
||||||
|
ALLOWED_DOMAINS.has(bareDomain) ||
|
||||||
|
ALLOWED_DOMAINS.has(bareDomainWithFirstSubdomainWildcarded)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bareDomain === allowedHostnames.replace(/^www\./, "")) {
|
if (bareDomain === allowedHostnames.replace(/^www\./, "")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user