feat: support slido in embeddable
This commit is contained in:
parent
022c407e24
commit
20dae101e9
@ -44,6 +44,8 @@ const RE_TWITTER_EMBED =
|
|||||||
const RE_VALTOWN =
|
const RE_VALTOWN =
|
||||||
/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/;
|
/^https:\/\/(?:www\.)?val\.town\/(v|embed)\/[a-zA-Z_$][0-9a-zA-Z_$]+\.[a-zA-Z_$][0-9a-zA-Z_$]+/;
|
||||||
|
|
||||||
|
const RE_SLIDO = /^https:\/\/app\.sli\.do\/event\/([a-zA-Z0-9]+)/;
|
||||||
|
|
||||||
const RE_GENERIC_EMBED =
|
const RE_GENERIC_EMBED =
|
||||||
/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i;
|
/^<(?:iframe|blockquote)[\s\S]*?\s(?:src|href)=["']([^"']*)["'][\s\S]*?>$/i;
|
||||||
|
|
||||||
@ -74,6 +76,7 @@ const ALLOWED_DOMAINS = new Set([
|
|||||||
"forms.microsoft.com",
|
"forms.microsoft.com",
|
||||||
"forms.gle",
|
"forms.gle",
|
||||||
"docs.google.com/forms",
|
"docs.google.com/forms",
|
||||||
|
"app.sli.do",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const ALLOW_SAME_ORIGIN = new Set([
|
const ALLOW_SAME_ORIGIN = new Set([
|
||||||
@ -89,7 +92,8 @@ const ALLOW_SAME_ORIGIN = new Set([
|
|||||||
"reddit.com",
|
"reddit.com",
|
||||||
"forms.microsoft.com",
|
"forms.microsoft.com",
|
||||||
"forms.gle",
|
"forms.gle",
|
||||||
"docs.google.com",
|
"docs.google.com/forms",
|
||||||
|
"app.sli.do",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const createSrcDoc = (body: string) => {
|
export const createSrcDoc = (body: string) => {
|
||||||
@ -282,6 +286,23 @@ export const getEmbedLink = (
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RE_SLIDO.test(link)) {
|
||||||
|
const [, eventId] = link.match(RE_SLIDO)!;
|
||||||
|
link = `https://app.sli.do/event/${eventId}`;
|
||||||
|
embeddedLinkCache.set(originalLink, {
|
||||||
|
link,
|
||||||
|
intrinsicSize: aspectRatio,
|
||||||
|
type,
|
||||||
|
sandbox: { allowSameOrigin },
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
link,
|
||||||
|
intrinsicSize: aspectRatio,
|
||||||
|
type,
|
||||||
|
sandbox: { allowSameOrigin },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
embeddedLinkCache.set(link, {
|
embeddedLinkCache.set(link, {
|
||||||
link,
|
link,
|
||||||
intrinsicSize: aspectRatio,
|
intrinsicSize: aspectRatio,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user