Merge pull request #2351 from iv-org/add-faq-link

Add FAQ link to readme
This commit is contained in:
Samantaz Fox 2022-01-18 00:46:49 +01:00 committed by GitHub
commit 36904fa72e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 10 deletions

View file

@ -7,9 +7,16 @@ assignees: ''
--- ---
<!-- Please use the search function to check if the bug you found has already been reported by someone else --> <!--
<!-- If you want to suggest a new feature please use "Feature request" instead --> BEFORE TRYING TO REPORT A BUG:
<!-- If you want to suggest an enhancement to an existing feature please use "Enhancement" instead -->
* Read the FAQ!
* Use the search function to check if there is already an issue open for your problem!
If you want to suggest a new feature please use "Feature request" instead
If you want to suggest an enhancement to an existing feature please use "Enhancement" instead
-->
**Describe the bug** **Describe the bug**
<!-- A clear and concise description of what the bug is. --> <!-- A clear and concise description of what the bug is. -->

View file

@ -31,6 +31,8 @@
&nbsp;&nbsp; &nbsp;&nbsp;
<a href="https://instances.invidious.io/">Instances list</a> <a href="https://instances.invidious.io/">Instances list</a>
&nbsp;&nbsp; &nbsp;&nbsp;
<a href="https://docs.invidious.io/FAQ.md">FAQ</a>
&nbsp;&nbsp;
<a href="https://docs.invidious.io/">Documentation</a> <a href="https://docs.invidious.io/">Documentation</a>
&nbsp;&nbsp; &nbsp;&nbsp;
<a href="#contribute">Contribute</a> <a href="#contribute">Contribute</a>

View file

@ -430,5 +430,12 @@
"user_created_playlists": "`x` created playlists", "user_created_playlists": "`x` created playlists",
"user_saved_playlists": "`x` saved playlists", "user_saved_playlists": "`x` saved playlists",
"Video unavailable": "Video unavailable", "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 <a href=\"`x`\">refresh the page</a>",
"crash_page_switch_instance": "tried to <a href=\"`x`\">use another instance</a>",
"crash_page_read_the_faq": "read the <a href=\"`x`\">Frenquently Asked Questions (FAQ)</a>",
"crash_page_search_issue": "searched for <a href=\"`x`\">existing issues on Github</a>",
"crash_page_report_issue": "If none of the above helped, please <a href=\"`x`\">open a new issue on GitHub</a> (preferably in English) and include the following text in your message (do NOT translate that text):"
} }

View file

@ -26,22 +26,53 @@ def error_template_helper(env : HTTP::Server::Context, locale : String?, status_
if exception.is_a?(InfoException) if exception.is_a?(InfoException)
return error_template_helper(env, locale, status_code, exception.message || "") return error_template_helper(env, locale, status_code, exception.message || "")
end end
env.response.content_type = "text/html" env.response.content_type = "text/html"
env.response.status_code = status_code 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 += %(\nDate: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`)
issue_template += %(\nRoute: `#{env.request.resource}`) issue_template += %(\nRoute: `#{env.request.resource}`)
issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`) issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`)
# issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json) # issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json)
issue_template += github_details("Backtrace", exception.inspect_with_backtrace) 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 error_message = <<-END_HTML
Looks like you've found a bug in Invidious. Please open a new issue <div class="error_message">
<a href="https://github.com/iv-org/invidious/issues">on GitHub</a> <h2>#{translate(locale, "crash_page_you_found_a_bug")}</h2>
and include the following text in your message: <br/><br/>
<p><b>#{translate(locale, "crash_page_before_reporting")}</b></p>
<ul>
<li>#{translate(locale, "crash_page_refresh", env.request.resource)}</li>
<li>#{translate(locale, "crash_page_switch_instance", url_switch)}</li>
<li>#{translate(locale, "crash_page_read_the_faq", url_faq)}</li>
<li>#{translate(locale, "crash_page_search_issue", url_search_issues)}</li>
</ul>
<br/>
<p>#{translate(locale, "crash_page_report_issue", url_new_issue)}</p>
<!-- TODO: Add a "copy to clipboard" button -->
<pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{issue_template}</pre> <pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{issue_template}</pre>
</div>
END_HTML 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" return templated "error"
end end