Support new video embed api format (fixes #709)

This commit is contained in:
Felix Ableitner 2022-10-04 12:55:48 +02:00
parent d412baf758
commit 7acff00d61
2 changed files with 3 additions and 9 deletions

View file

@ -33,7 +33,7 @@ if (!process.env["LEMMY_UI_DISABLE_CSP"] && !process.env["LEMMY_UI_DEBUG"]) {
server.use(function (_req, res, next) { server.use(function (_req, res, next) {
res.setHeader( res.setHeader(
"Content-Security-Policy", "Content-Security-Policy",
`default-src 'none'; connect-src *; img-src * data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; form-action 'self'; base-uri 'self'` `default-src 'none'; connect-src *; img-src * data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; form-action 'self'; base-uri 'self'; frame-src *`
); );
next(); next();
}); });

View file

@ -76,9 +76,8 @@ export class MetadataCard extends Component<
<button <button
className="mt-2 btn btn-secondary text-monospace" className="mt-2 btn btn-secondary text-monospace"
onClick={linkEvent(this, this.handleIframeExpand)} onClick={linkEvent(this, this.handleIframeExpand)}
data-tippy-content={i18n.t("expand_here")}
> >
{this.state.expanded ? "-" : "+"} {i18n.t("expand_here")}
</button> </button>
)} )}
</div> </div>
@ -92,12 +91,7 @@ export class MetadataCard extends Component<
})} })}
{this.state.expanded && {this.state.expanded &&
post.embed_video_url.match({ post.embed_video_url.match({
some: html => ( some: video_url => <iframe src={video_url}></iframe>,
<div
className="mt-3 mb-2"
dangerouslySetInnerHTML={{ __html: html }}
/>
),
none: <></>, none: <></>,
})} })}
</> </>