Added timestamp to ressources to avoid caching

This commit is contained in:
root 2023-06-02 22:34:43 +02:00
parent 618453713d
commit 87e3be4444
2 changed files with 9 additions and 3 deletions

View File

@ -66,6 +66,9 @@ def hello():
separator_char = config.get('main', 'separator_char')
ablines = []
now = datetime.now(tz=tz)
epoch = now.timestamp()
lines = getContent()
for line in lines:
ab = line.split(separator_char)
@ -76,7 +79,7 @@ def hello():
with open("ab.txt", "r") as f:
num_lines = sum(1 for _ in f)
return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines)
return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines, epoch=epoch)
def getContent():
lines = [a.strip() for a in open("ab.txt", "r").readlines()]

View File

@ -2,7 +2,7 @@
<html lang="de">
<head>
<title>{{ title }}</title>
<link rel="stylesheet" type="text/css" href="/css/ab.css">
<link rel="stylesheet" type="text/css" href="/css/ab.css?t={{ epoch }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='favicon-32x32.png') }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', filename='favicon-16x16.png') }}">
@ -30,7 +30,10 @@
<div id="footer">
<div id="questions">Es gibt derzeit {{ num_lines }} Fragen.</div>
<div class="separator">&nbsp;</div>
<form action="/"><button id="next" type="submit">Neue Fragen</button></form>
<form action="/" method="get">
<input type="hidden" name="t" value="{{ epoch }}">
<button id="next" type="submit">Neue Fragen</button>
</form>
</div>
</div>
</body>