feat: add AllTube URL display on video load failure
Some checks are pending
Build and release container directly from master / release (push) Waiting to run
Invidious CI / build - crystal: 1.11.2, stable: true (push) Waiting to run
Invidious CI / build - crystal: 1.12.1, stable: true (push) Waiting to run
Invidious CI / build - crystal: 1.9.2, stable: true (push) Waiting to run
Invidious CI / build - crystal: nightly, stable: false (push) Waiting to run
Invidious CI / build-docker (push) Waiting to run
Invidious CI / build - crystal: 1.10.1, stable: true (push) Waiting to run
Invidious CI / build-docker-arm64 (push) Waiting to run
Invidious CI / ameba_lint (push) Waiting to run
Some checks are pending
Build and release container directly from master / release (push) Waiting to run
Invidious CI / build - crystal: 1.11.2, stable: true (push) Waiting to run
Invidious CI / build - crystal: 1.12.1, stable: true (push) Waiting to run
Invidious CI / build - crystal: 1.9.2, stable: true (push) Waiting to run
Invidious CI / build - crystal: nightly, stable: false (push) Waiting to run
Invidious CI / build-docker (push) Waiting to run
Invidious CI / build - crystal: 1.10.1, stable: true (push) Waiting to run
Invidious CI / build-docker-arm64 (push) Waiting to run
Invidious CI / ameba_lint (push) Waiting to run
Introduces a configuration property to specify an AllTube URL to be shown in error messages when video loading fails. Adds conditional logic to error handling to include a link to AllTube if the URL is configured and the request path meets criteria. This enhances user experience by providing an alternative viewing option.
This commit is contained in:
parent
743ba53822
commit
9d9a2d40e9
2 changed files with 15 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
<li>
|
||||
<a href="https://alltube.private.coffee#{env.request.resource}">#{go_to_alltube}</a>
|
||||
</li>
|
||||
END_HTML
|
||||
else
|
||||
alltube_part = ""
|
||||
end
|
||||
|
||||
return <<-END_HTML
|
||||
<p style="margin-bottom: 4px;">#{next_steps_text}</p>
|
||||
<ul>
|
||||
|
@ -190,9 +200,7 @@ def error_redirect_helper(env : HTTP::Server::Context)
|
|||
<li>
|
||||
<a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://alltube.private.coffee#{env.request.resource}">#{go_to_alltube}</a>
|
||||
</li>
|
||||
#{alltube_part}
|
||||
<li>
|
||||
<a rel="noreferrer noopener" href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue