summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsyeopite <syeopite@syeopite.dev>2021-05-15 22:36:10 -0700
committersyeopite <syeopite@syeopite.dev>2021-06-19 04:17:46 -0700
commit2f54ec4e18d20a0d3a36e8e192389819b57d8dc3 (patch)
tree07cad65b749c802dfa084e49b301fb18a4f57ec2 /src
parentb9cd40fe1e095f72440bb64180314b71d4f3f185 (diff)
downloadinvidious-2f54ec4e18d20a0d3a36e8e192389819b57d8dc3.tar.gz
invidious-2f54ec4e18d20a0d3a36e8e192389819b57d8dc3.tar.bz2
invidious-2f54ec4e18d20a0d3a36e8e192389819b57d8dc3.zip
Fix locale consistency for err template redirects
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/errors.cr52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr
index 714e0670..e1d02563 100644
--- a/src/invidious/helpers/errors.cr
+++ b/src/invidious/helpers/errors.cr
@@ -108,35 +108,33 @@ def error_json_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::A
error_json_helper(env, locale, status_code, message, nil)
end
-def error_redirect_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::Any) | Nil)
+def error_redirect_helper(env : HTTP::Server::Context, locale : Hash(String, JSON::Any) | Nil)
request_path = env.request.path
- if request_path.starts_with?("/search") || 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")
- switch_instance = translate(locale, "Switch Invidious Instance")
-
-
- return <<-END_HTML
- <p style="margin-bottom: 4px;">#{next_steps_text}</p>
- <ul>
- <li>
- <a href="#{env.request.resource}">#{refresh}</a>
- </li>
- <li>
- <a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>
- </li>
- <li>
- <a href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>
- </li>
- </ul>
- END_HTML
-
- return next_step_html
+ if request_path.starts_with?("/search") || 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")
+ switch_instance = translate(locale, "Switch Invidious Instance")
+
+ return <<-END_HTML
+ <p style="margin-bottom: 4px;">#{next_steps_text}</p>
+ <ul>
+ <li>
+ <a href="#{env.request.resource}">#{refresh}</a>
+ </li>
+ <li>
+ <a href="/redirect?referer=#{env.get("current_page")}">#{switch_instance}</a>
+ </li>
+ <li>
+ <a href="https://youtube.com#{env.request.resource}">#{go_to_youtube}</a>
+ </li>
+ </ul>
+ END_HTML
+
+ return next_step_html
else
return ""
end
-end \ No newline at end of file
+end