fix the syntax

This commit is contained in:
Kagami Sascha Rosylight 2023-03-11 15:08:29 +01:00
parent 5153305bdd
commit 1ea7059a20
3 changed files with 5 additions and 4 deletions

View File

@ -71,9 +71,10 @@ async function getOEmbedRich($: cheerio.CheerioAPI, pageUrl: string): Promise<OE
return null; return null;
} }
const allowedFeatures = (iframe.attr('allow') ?? '').split(/\s+/g); // TODO: This implementation only allows basic syntax of `allow`.
// Might need to implement better later.
const allowedFeatures = (iframe.attr('allow') ?? '').split(/\s*;\s*/g).filter(s => s);
const safeList = [ const safeList = [
'',
'autoplay', 'autoplay',
'clipboard-write', 'clipboard-write',
'fullscreen', 'fullscreen',

View File

@ -1,6 +1,6 @@
{ {
"version": "1.0", "version": "1.0",
"type": "rich", "type": "rich",
"html": "<iframe src='https://example.com/' allow='fullscreen camera'></iframe>", "html": "<iframe src='https://example.com/' allow='fullscreen;camera'></iframe>",
"height": 300 "height": 300
} }

View File

@ -1,6 +1,6 @@
{ {
"version": "1.0", "version": "1.0",
"type": "rich", "type": "rich",
"html": "<iframe src='https://example.com/' allow='autoplay clipboard-write fullscreen encrypted-media picture-in-picture'></iframe>", "html": "<iframe src='https://example.com/' allow='autoplay;clipboard-write;fullscreen;encrypted-media;picture-in-picture'></iframe>",
"height": 300 "height": 300
} }