feat: replace View channel on YouTube and channel's description external links

This commit is contained in:
unlxam 2024-08-24 13:16:02 -03:00
parent 0fd38e52ef
commit effb642948
2 changed files with 7 additions and 1 deletions

View File

@ -159,6 +159,9 @@ def get_about_info(ucid, locale) : AboutChannel
end end
end end
# use comments link_utils to replace external links with the confirmation page
description_html = Invidious::Comments.replace_external_links(description_html)
sub_count = 0 sub_count = 0
if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a) if (metadata_rows = initdata.dig?("header", "pageHeaderRenderer", "content", "pageHeaderViewModel", "metadata", "contentMetadataViewModel", "metadataRows").try &.as_a)

View File

@ -37,7 +37,10 @@
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1-2"> <div class="pure-u-1-2">
<div class="pure-u-1 pure-md-1-3"> <div class="pure-u-1 pure-md-1-3">
<a href="<%= youtube_url %>"><%= translate(locale, "View channel on YouTube") %></a> <%-
confirm_view_yt = "/confirm_leave?link=#{URI.encode_path(youtube_url)}"
-%>
<a href="<%= confirm_view_yt %>"><%= translate(locale, "View channel on YouTube") %></a>
</div> </div>
<div class="pure-u-1 pure-md-1-3"> <div class="pure-u-1 pure-md-1-3">
<a href="<%= redirect_url %>"><%= translate(locale, "Switch Invidious Instance") %></a> <a href="<%= redirect_url %>"><%= translate(locale, "Switch Invidious Instance") %></a>