Add both favicons and routing
Some checks failed
continuous-integration/drone/push Build is failing

Fix bad sed in Dockerfiles COPY
This commit is contained in:
kleph 2020-04-09 00:42:46 +02:00
parent cb2552a7c3
commit 9694eb66b4
3 changed files with 12 additions and 3 deletions

View file

@ -2,7 +2,7 @@ FROM python:slim
RUN pip install flask
COPY /beer/beer.py /beer.py
COPY /beer/static /static
COPY /beer/templates /templates
COPY /beer/static /static
EXPOSE 5000

View file

@ -28,9 +28,18 @@ def index(hours=None, minutes=None):
@app.route('/favicon.ico')
def favicon():
""" serve the favicon """
""" serve default favicon """
return send_from_directory('static', 'clock-icon.png')
@app.route('/favicon/<mode>')
def favicon():
""" serve the favicon according to the timer """
if mode == 'beer':
return send_from_directory('static', 'beer-icon.png')
else:
return send_from_directory('static', 'clock-icon.png')
def main():
""" main func """
app.run(host='::')

View file

@ -85,7 +85,7 @@ var x = setInterval(function() {
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "<blink>BEER TIME !</blink>";
changeFavicon('beer-icon.png')
changeFavicon('/favicon/beer')
}
}, 1000);
</script>