Skip to content

Commit

Permalink
Disable media context menus in IV.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Mar 14, 2024
1 parent fe4b853 commit d92418d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Telegram/Resources/iv_html/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ var IV = {
+ '" type="video/mp4" />'
+ '</video>';
var media = element.firstChild;
media.oncontextmenu = function () { return false; };
media.oncanplay = IV.checkVideos;
media.onloadeddata = IV.checkVideos;
}
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/iv/iv_prepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ QByteArray Parser::block(
const auto id = Number(photo.id);
result = tag("a", {
{ "href", href },
{ "oncontextmenu", data.vurl() ? QByteArray() : "return false;" },
{ "data-context", data.vurl() ? QByteArray() : "viewer-photo" + id },
}, result) + caption(data.vcaption());
return result;
Expand Down Expand Up @@ -576,6 +577,7 @@ QByteArray Parser::block(
const auto href = resource("video" + id);
result = tag("a", {
{ "href", href },
{ "oncontextmenu", "return false;" },
{ "data-context", "viewer-video" + id },
}, result);
}
Expand Down Expand Up @@ -745,6 +747,7 @@ QByteArray Parser::block(const MTPDpageBlockAudio &data) {
const auto src = documentFullUrl(audio);
return tag("figure", tag("audio", {
{ "src", src },
{ "oncontextmenu", "return false;" },
{ "controls", std::nullopt },
}) + caption(data.vcaption()));
}
Expand Down

0 comments on commit d92418d

Please sign in to comment.