mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-12-18 22:51:59 +01:00
Add favicon, fix caching
This commit is contained in:
@@ -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 database
|
||||
import data_adapters
|
||||
@@ -20,6 +20,12 @@ def home():
|
||||
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'])
|
||||
def enqueue():
|
||||
if not request.json:
|
||||
@@ -209,6 +215,17 @@ def activate_job():
|
||||
database.create_done_song_view()
|
||||
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
|
||||
def inject_version():
|
||||
return dict(karaoqueue_version=app.config['VERSION'])
|
||||
|
||||
Reference in New Issue
Block a user