Merge f00668e1a2f5d4e1ed88dc918c811c9f12a56d31 into 749791cdf1316bc89415d27d503042d3f6b3f398

This commit is contained in:
Fijxu 2026-03-10 05:11:36 -04:00 committed by GitHub
commit 3136d0b22c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,13 +184,29 @@ def error_redirect_helper(env : HTTP::Server::Context)
locale = env.get("preferences").as(Preferences).locale
if request_path.starts_with?("/search") || request_path.starts_with?("/watch") ||
if request_path.starts_with?("/search") || (is_watch = request_path.starts_with?("/watch")) ||
request_path.starts_with?("/channel") || request_path.starts_with?("/playlist?list=PL")
next_steps_text = translate(locale, "next_steps_error_message")
refresh = translate(locale, "next_steps_error_message_refresh")
go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube")
go_to_youtube_embed = translate(locale, "videoinfo_youTube_embed_link")
switch_instance = translate(locale, "Switch Invidious Instance")
if is_watch
params = URI.parse(env.request.resource).query_params
video_id = params.fetch("v", nil)
if video_id.presence
params.delete("v")
if params.present?
embed_link = "https://youtube.com/embed/#{video_id}?#{params}"
else
embed_link = "https://youtube.com/embed/#{video_id}"
end
embed_html_element = "(<a rel=\"noopener\" referrerpolicy=\"origin-when-cross-origin\" href=\"#{embed_link}\">#{go_to_youtube_embed}</a>)"
end
end
return <<-END_HTML
<p style="margin-bottom: 4px;">#{next_steps_text}</p>
<ul>
@ -202,6 +218,7 @@ def error_redirect_helper(env : HTTP::Server::Context)
</li>
<li>
<a rel="noreferrer noopener" href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>
#{embed_html_element}
</li>
</ul>
END_HTML