Skip to content

Commit 36904fa

Browse files
authored
Merge pull request #2351 from iv-org/add-faq-link
Add FAQ link to readme
2 parents 38697ad + 8c2495a commit 36904fa

File tree

4 files changed

+57
-10
lines changed

4 files changed

+57
-10
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ assignees: ''
77

88
---
99

10-
<!-- Please use the search function to check if the bug you found has already been reported by someone else -->
11-
<!-- If you want to suggest a new feature please use "Feature request" instead -->
12-
<!-- If you want to suggest an enhancement to an existing feature please use "Enhancement" instead -->
10+
<!--
11+
BEFORE TRYING TO REPORT A BUG:
12+
13+
* Read the FAQ!
14+
* Use the search function to check if there is already an issue open for your problem!
15+
16+
If you want to suggest a new feature please use "Feature request" instead
17+
If you want to suggest an enhancement to an existing feature please use "Enhancement" instead
18+
-->
19+
1320

1421
**Describe the bug**
1522
<!-- A clear and concise description of what the bug is. -->

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<a href="https://invidious.io/">Website</a>
3131
&nbsp;&nbsp;
3232
<a href="https://instances.invidious.io/">Instances list</a>
33+
&nbsp;&nbsp;
34+
<a href="https://docs.invidious.io/FAQ.md">FAQ</a>
3335
&nbsp;&nbsp;
3436
<a href="https://docs.invidious.io/">Documentation</a>
3537
&nbsp;&nbsp;

locales/en-US.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,5 +430,12 @@
430430
"user_created_playlists": "`x` created playlists",
431431
"user_saved_playlists": "`x` saved playlists",
432432
"Video unavailable": "Video unavailable",
433-
"preferences_save_player_pos_label": "Save playback position: "
433+
"preferences_save_player_pos_label": "Save playback position: ",
434+
"crash_page_you_found_a_bug": "It looks like you found a bug in Invidious!",
435+
"crash_page_before_reporting": "Before reporting a bug, make sure that you have:",
436+
"crash_page_refresh": "tried to <a href=\"`x`\">refresh the page</a>",
437+
"crash_page_switch_instance": "tried to <a href=\"`x`\">use another instance</a>",
438+
"crash_page_read_the_faq": "read the <a href=\"`x`\">Frenquently Asked Questions (FAQ)</a>",
439+
"crash_page_search_issue": "searched for <a href=\"`x`\">existing issues on Github</a>",
440+
"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):"
434441
}

src/invidious/helpers/errors.cr

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,53 @@ def error_template_helper(env : HTTP::Server::Context, locale : String?, status_
2626
if exception.is_a?(InfoException)
2727
return error_template_helper(env, locale, status_code, exception.message || "")
2828
end
29+
2930
env.response.content_type = "text/html"
3031
env.response.status_code = status_code
31-
issue_template = %(Title: `#{exception.message} (#{exception.class})`)
32+
33+
issue_title = "#{exception.message} (#{exception.class})"
34+
35+
issue_template = %(Title: `#{issue_title}`)
3236
issue_template += %(\nDate: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`)
3337
issue_template += %(\nRoute: `#{env.request.resource}`)
3438
issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`)
3539
# issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json)
3640
issue_template += github_details("Backtrace", exception.inspect_with_backtrace)
41+
42+
# URLs for the error message below
43+
url_faq = "https://github.com/iv-org/documentation/blob/master/FAQ.md"
44+
url_search_issues = "https://github.com/iv-org/invidious/issues"
45+
46+
url_switch = "https://redirect.invidious.io" + env.request.resource
47+
48+
url_new_issue = "https://github.com/iv-org/invidious/issues/new"
49+
url_new_issue += "?labels=bug&template=bug_report.md&title="
50+
url_new_issue += URI.encode_www_form("[Bug] " + issue_title)
51+
3752
error_message = <<-END_HTML
38-
Looks like you've found a bug in Invidious. Please open a new issue
39-
<a href="https://github.com/iv-org/invidious/issues">on GitHub</a>
40-
and include the following text in your message:
41-
<pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{issue_template}</pre>
53+
<div class="error_message">
54+
<h2>#{translate(locale, "crash_page_you_found_a_bug")}</h2>
55+
<br/><br/>
56+
57+
<p><b>#{translate(locale, "crash_page_before_reporting")}</b></p>
58+
<ul>
59+
<li>#{translate(locale, "crash_page_refresh", env.request.resource)}</li>
60+
<li>#{translate(locale, "crash_page_switch_instance", url_switch)}</li>
61+
<li>#{translate(locale, "crash_page_read_the_faq", url_faq)}</li>
62+
<li>#{translate(locale, "crash_page_search_issue", url_search_issues)}</li>
63+
</ul>
64+
65+
<br/>
66+
<p>#{translate(locale, "crash_page_report_issue", url_new_issue)}</p>
67+
68+
<!-- TODO: Add a "copy to clipboard" button -->
69+
<pre style="padding: 20px; background: rgba(0, 0, 0, 0.12345);">#{issue_template}</pre>
70+
</div>
4271
END_HTML
4372

44-
next_steps = error_redirect_helper(env, locale)
73+
# Don't show the usual "next steps" widget. The same options are
74+
# proposed above the error message, just worded differently.
75+
next_steps = ""
4576

4677
return templated "error"
4778
end

0 commit comments

Comments
 (0)