mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add links redirect inside channel description
This commit is contained in:
parent
6d3b907307
commit
3d2c4ea266
3 changed files with 13 additions and 3 deletions
|
@ -383,3 +383,11 @@ def fetch_random_instance
|
||||||
|
|
||||||
return filtered_instance_list.sample(1)[0]
|
return filtered_instance_list.sample(1)[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def make_html_with_links(baseText : String) : String
|
||||||
|
returnValue = baseText.dup
|
||||||
|
returnValue.scan(/https?:\/\/[^ \n]*/).each do |match|
|
||||||
|
returnValue = returnValue.sub(match[0], "<a href=\"#{match[0]}\">#{match[0]}</a>")
|
||||||
|
end
|
||||||
|
return returnValue
|
||||||
|
end
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Invidious::Routes::Channels
|
||||||
if !data.is_a?(Tuple)
|
if !data.is_a?(Tuple)
|
||||||
return data
|
return data
|
||||||
end
|
end
|
||||||
locale, user, subscriptions, continuation, ucid, channel = data
|
locale, user, subscriptions, continuation, ucid, channel, description = data
|
||||||
|
|
||||||
page = env.params.query["page"]?.try &.to_i?
|
page = env.params.query["page"]?.try &.to_i?
|
||||||
page ||= 1
|
page ||= 1
|
||||||
|
@ -201,6 +201,8 @@ module Invidious::Routes::Channels
|
||||||
return error_template(500, ex)
|
return error_template(500, ex)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {locale, user, subscriptions, continuation, ucid, channel}
|
description = make_html_with_links(channel.description_html)
|
||||||
|
|
||||||
|
return {locale, user, subscriptions, continuation, ucid, channel, description}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
<div class="h-box">
|
<div class="h-box">
|
||||||
<div id="descriptionWrapper">
|
<div id="descriptionWrapper">
|
||||||
<p><span style="white-space:pre-wrap"><%= channel.description_html %></span></p>
|
<p><span style="white-space:pre-wrap"><%= description %></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue