From b9802547c8a8ad8d190d73766472c28f57fdfecb Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 27 Feb 2026 02:04:03 -0300 Subject: [PATCH 1/3] Add embed youtube link for error_template_helper --- src/invidious/helpers/errors.cr | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 97e28022c..9c4a93e24 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -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 = I18n.translate(locale, "next_steps_error_message") refresh = I18n.translate(locale, "next_steps_error_message_refresh") go_to_youtube = I18n.translate(locale, "next_steps_error_message_go_to_youtube") + go_to_youtube_embed = I18n.translate(locale, "videoinfo_youTube_embed_link") switch_instance = I18n.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.to_s}" + else + embed_link = "https://youtube.com/embed/#{video_id}" + end + embed_html_element = "(#{go_to_youtube_embed})" + end + end + return <<-END_HTML

#{next_steps_text}

END_HTML From a61f577b277bac24b1a6fbe1cfc12965a4f10c64 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 27 Feb 2026 02:09:20 -0300 Subject: [PATCH 2/3] apply ameba correction --- src/invidious/helpers/errors.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 9c4a93e24..31d3aa505 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -199,7 +199,7 @@ def error_redirect_helper(env : HTTP::Server::Context) if video_id.presence params.delete("v") if params.present? - embed_link = "https://youtube.com/embed/#{video_id}?#{params.to_s}" + embed_link = "https://youtube.com/embed/#{video_id}?#{params}" else embed_link = "https://youtube.com/embed/#{video_id}" end From d4d6fb27ce49776c471dab757da5d675ef56b97d Mon Sep 17 00:00:00 2001 From: Fijxu Date: Fri, 13 Mar 2026 21:47:41 -0300 Subject: [PATCH 3/3] save --- src/invidious/helpers/errors.cr | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 31d3aa505..e2e0cb468 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -197,11 +197,17 @@ def error_redirect_helper(env : HTTP::Server::Context) 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}" + new_params = URI::Params.new + list = params["list"]?.presence + index = params["index"]?.presence + if list && index + new_params.add("list", list) + new_params.add("index", index) + embed_link = HTML.escape("https://youtube.com/embed/#{video_id}?#{new_params}") + end else - embed_link = "https://youtube.com/embed/#{video_id}" + embed_link = HTML.escape("https://youtube.com/embed/#{video_id}") end embed_html_element = "(#{go_to_youtube_embed})" end