diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 62ed3b84..e318b1a8 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -144,6 +144,9 @@ class Config # Playlist length limit property playlist_length_limit : Int32 = 500 + # Display AllTube URL in error messages when loading a video fails + property alltube_url : String? = nil + def disabled?(option) case disabled = CONFIG.disable_proxy when Bool diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index a1baf9d6..718ee3e1 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -177,10 +177,20 @@ def error_redirect_helper(env : HTTP::Server::Context) 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_alltube = translate(locale, "next_steps_error_message_go_to_alltube") go_to_youtube = translate(locale, "next_steps_error_message_go_to_youtube") switch_instance = translate(locale, "Switch Invidious Instance") + if request_path.startswith?("/watch") && CONFIG.alltube_url + go_to_alltube = translate(locale, "next_steps_error_message_go_to_alltube") + alltube_part = <<-END_HTML +
  • + #{go_to_alltube} +
  • + END_HTML + else + alltube_part = "" + end + return <<-END_HTML

    #{next_steps_text}