- commit
- 2d7540d3e33460969c8cd1a92fae88a0c03eb27f
- parent
- 327dcf1d44170295023f6af4f4f8baacb8b1774b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-06-28 05:25
handle favicon
Diffstat
M | neddit.py | 5 | +++++ |
A | static/favicon.ico | 0 | |
A | static/favicon.svg | 6 | ++++++ |
M | templates/base.html | 2 | +- |
4 files changed, 12 insertions, 1 deletions
diff --git a/neddit.py b/neddit.py
@@ -92,6 +92,10 @@ async def fetch_subreddit(name): 92 92 return await fetch('https://www.reddit.com/r/%s/about.json' % name) 93 93 94 94 -1 95 async def favicon(request): -1 96 raise web.HTTPFound(location='/static/favicon.ico') -1 97 -1 98 95 99 async def generic(request): 96 100 if not request.path.endswith('/'): 97 101 raise web.HTTPPermanentRedirect(f'{request.raw_path}/') @@ -125,5 +129,6 @@ if __name__ == '__main__': 125 129 app = web.Application() 126 130 app.router.add_static('/static', BASE_DIR / 'static') 127 131 app.router.add_get('', generic) -1 132 app.router.add_get('/favicon.ico', favicon) 128 133 app.router.add_get('/{path:.*}', generic) 129 134 web.run_app(app, host='localhost', port=args.port)
diff --git a/static/favicon.ico b/static/favicon.ico
Binary files differ.diff --git a/static/favicon.svg b/static/favicon.svg
@@ -0,0 +1,5 @@ -1 1 <?xml version="1.0" encoding="utf-8"?> -1 2 <svg viewBox="-32 -32 64 64" xmlns="http://www.w3.org/2000/svg" > -1 3 <circle cx="0" cy="0" r="32" fill="#f40"/> -1 4 <polygon points="-6,-6 -6,15 -12,15 -12,-15 -5,-15 6,6 6,-15 12,-15 12,15 5,15" fill="#fff"/> -1 5 </svg -1 5 \ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
@@ -3,7 +3,7 @@ 3 3 <head> 4 4 <meta charset="utf-8" /> 5 5 <meta name="viewport" content="width=device-width">6 -1 <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src *.redditmedia.com *.redd.it; media-src *.redd.it">-1 6 <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src 'self' *.redditmedia.com *.redd.it; media-src *.redd.it"> 7 7 <title>{% block title %}neddit: the frontend of the frontpage of the internet{% endblock %}</title> 8 8 <link rel="stylesheet" href="/static/style.css"> 9 9 {% block meta %}{% endblock %}