mirror of
https://github.com/thelounge/thelounge
synced 2024-11-27 06:20:26 +00:00
Merge pull request #4040 from thelounge/xpaw/media-embed
Skip video/audio embeds if og:type exists but does not specify it
This commit is contained in:
commit
4307d2da9d
1 changed files with 14 additions and 0 deletions
|
@ -131,9 +131,23 @@ function parseHtmlMedia($, preview, client) {
|
|||
return new Promise((resolve, reject) => {
|
||||
if (Helper.config.disableMediaPreview) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
let foundMedia = false;
|
||||
const openGraphType = $('meta[property="og:type"]').attr("content");
|
||||
|
||||
// Certain news websites may include video and audio tags,
|
||||
// despite actually being an article (as indicated by og:type).
|
||||
// If there is og:type tag, we will only select video or audio if it matches
|
||||
if (
|
||||
openGraphType &&
|
||||
!openGraphType.startsWith("video") &&
|
||||
!openGraphType.startsWith("music")
|
||||
) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
["video", "audio"].forEach((type) => {
|
||||
if (foundMedia) {
|
||||
|
|
Loading…
Reference in a new issue