Add favicon, fix caching

This commit is contained in:
Phillip Kühne 2021-10-09 00:03:46 +02:00
parent c203317320
commit d79eebc949
5 changed files with 21 additions and 4 deletions

View File

@ -1,4 +1,4 @@
from flask import Flask, render_template, Response, abort, request, redirect from flask import Flask, render_template, Response, abort, request, redirect, send_from_directory
import helpers import helpers
import database import database
import data_adapters import data_adapters
@ -20,6 +20,12 @@ def home():
return render_template('main.html', list=database.get_list(), auth=basic_auth.authenticate()) return render_template('main.html', list=database.get_list(), auth=basic_auth.authenticate())
@app.route("/favicon.ico")
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')
@app.route('/api/enqueue', methods=['POST']) @app.route('/api/enqueue', methods=['POST'])
def enqueue(): def enqueue():
if not request.json: if not request.json:
@ -209,6 +215,17 @@ def activate_job():
database.create_done_song_view() database.create_done_song_view()
helpers.setup_config(app) helpers.setup_config(app)
@app.after_request
def add_header(response):
"""
Add headers to both force latest IE rendering engine or Chrome Frame,
and also to cache the rendered page for 10 minutes.
"""
response.headers['Cache-Control'] = 'private, max-age=600'
return response
@app.context_processor @app.context_processor
def inject_version(): def inject_version():
return dict(karaoqueue_version=app.config['VERSION']) return dict(karaoqueue_version=app.config['VERSION'])

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -6,8 +6,8 @@
"background_color": "#343a40", "background_color": "#343a40",
"description": "Eine Karaokewarteliste.", "description": "Eine Karaokewarteliste.",
"icons": [{ "icons": [{
"src": "images/touch/homescreen192.png", "src": "images/touch/homescreen512.png",
"sizes": "192x192", "sizes": "512x512",
"type": "image/png" "type": "image/png"
}], }],
"related_applications": [{ "related_applications": [{

View File

@ -75,7 +75,7 @@
{% endif %} {% endif %}
<!--<a href="https://github.com/PhoenixTwoFive/karaoqueue" <!--<a href="https://github.com/PhoenixTwoFive/karaoqueue"
class="ml-1 mr-1"><i class="fab fa-github mr-1"></i><span>Github</span></a>--> class="ml-1 mr-1"><i class="fab fa-github mr-1"></i><span>Github</span></a>-->
<span class="text-muted">KaraoQueue {{karaoqueue_version}} -&nbsp;<span>&copy</span>&nbsp;2019-2021 - Phillip <span class="text-muted">KaraoQueue {{karaoqueue_version}} -&nbsp;<span>&copy</span>&nbsp;2019-21 - Phillip
Kühne</span> Kühne</span>
</div> </div>
</footer> </footer>