Don't traceback when favicon.ico is requested, display a nice error instead
This commit is contained in:
parent
03ddeb2608
commit
d51a5089f5
2 changed files with 15 additions and 0 deletions
7
main.py
7
main.py
|
@ -149,6 +149,13 @@ async def simpleer_search(query, page):
|
||||||
|
|
||||||
@app.route("/<string:domain>/")
|
@app.route("/<string:domain>/")
|
||||||
async def instance(domain):
|
async def instance(domain):
|
||||||
|
# favicon.ico is not a domain name
|
||||||
|
if domain == "favicon.ico":
|
||||||
|
return await render_template(
|
||||||
|
"error.html",
|
||||||
|
error_number = "404",
|
||||||
|
error_reason = "We don't have a favicon yet. If you would like to contribute one, please send it to ~metalune/public-inbox@lists.sr.ht"
|
||||||
|
), 404
|
||||||
return redirect("/" + domain + "/videos/trending")
|
return redirect("/" + domain + "/videos/trending")
|
||||||
|
|
||||||
@app.route("/<string:domain>/videos/local", defaults = {"page": 1})
|
@app.route("/<string:domain>/videos/local", defaults = {"page": 1})
|
||||||
|
|
8
templates/error.html
Normal file
8
templates/error.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}ERROR: {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>Error {{ error_number }}</h1>
|
||||||
|
<p>{{ error_reason }}</p>
|
||||||
|
{% endblock %}
|
Loading…
Reference in a new issue