diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c0485266..4c1a6330 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,9 +7,16 @@ assignees: '' --- - - - + + **Describe the bug** diff --git a/README.md b/README.md index 5e3d3fdd..4e3c7a77 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ Website  •  Instances list +  •  + FAQ  •  Documentation  •  diff --git a/locales/en-US.json b/locales/en-US.json index 91af3d72..f733f7db 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -430,5 +430,12 @@ "user_created_playlists": "`x` created playlists", "user_saved_playlists": "`x` saved playlists", "Video unavailable": "Video unavailable", - "preferences_save_player_pos_label": "Save playback position: " + "preferences_save_player_pos_label": "Save playback position: ", + "crash_page_you_found_a_bug": "It looks like you found a bug in Invidious!", + "crash_page_before_reporting": "Before reporting a bug, make sure that you have:", + "crash_page_refresh": "tried to refresh the page", + "crash_page_switch_instance": "tried to use another instance", + "crash_page_read_the_faq": "read the Frenquently Asked Questions (FAQ)", + "crash_page_search_issue": "searched for existing issues on Github", + "crash_page_report_issue": "If none of the above helped, please open a new issue on GitHub (preferably in English) and include the following text in your message (do NOT translate that text):" } diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index d10762c5..26c38669 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -26,22 +26,53 @@ def error_template_helper(env : HTTP::Server::Context, locale : String?, status_ if exception.is_a?(InfoException) return error_template_helper(env, locale, status_code, exception.message || "") end + env.response.content_type = "text/html" env.response.status_code = status_code - issue_template = %(Title: `#{exception.message} (#{exception.class})`) + + issue_title = "#{exception.message} (#{exception.class})" + + issue_template = %(Title: `#{issue_title}`) issue_template += %(\nDate: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`) issue_template += %(\nRoute: `#{env.request.resource}`) issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`) # issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json) issue_template += github_details("Backtrace", exception.inspect_with_backtrace) + + # URLs for the error message below + url_faq = "https://github.com/iv-org/documentation/blob/master/FAQ.md" + url_search_issues = "https://github.com/iv-org/invidious/issues" + + url_switch = "https://redirect.invidious.io" + env.request.resource + + url_new_issue = "https://github.com/iv-org/invidious/issues/new" + url_new_issue += "?labels=bug&template=bug_report.md&title=" + url_new_issue += URI.encode_www_form("[Bug] " + issue_title) + error_message = <<-END_HTML - Looks like you've found a bug in Invidious. Please open a new issue - on GitHub - and include the following text in your message: -
#{issue_template}
+
+

#{translate(locale, "crash_page_you_found_a_bug")}

+

+ +

#{translate(locale, "crash_page_before_reporting")}

+ + +
+

#{translate(locale, "crash_page_report_issue", url_new_issue)}

+ + +
#{issue_template}
+
END_HTML - next_steps = error_redirect_helper(env, locale) + # Don't show the usual "next steps" widget. The same options are + # proposed above the error message, just worded differently. + next_steps = "" return templated "error" end