WebHost: fix landing page caching and mention amount of multiworlds in the last week.

This commit is contained in:
Fabian Dill 2020-07-21 06:35:47 +02:00
parent ac238d9b14
commit d005f6e1e1
2 changed files with 6 additions and 3 deletions

View File

@ -1,8 +1,10 @@
from flask import render_template
from WebHostLib import app, cache
from .models import *
from datetime import timedelta
@cache.memoize(timeout=300)
@app.route('/', methods=['GET', 'POST'])
@cache.cached(timeout=300) # cache has to appear under app route for caching to work
def landing():
return render_template("landing.html")
multiworlds = count(room for room in Room if room.creation_time >= datetime.utcnow() - timedelta(days=7))
return render_template("landing.html", multiworlds=multiworlds)

View File

@ -35,6 +35,7 @@
<p>This website is under active development. As such, your hosted rooms may occasionally disappear,
and there may be bugs. If you do happen to find a bug, please report it
<a href="https://github.com/Berserker66/MultiWorld-Utilities/issues">here</a>.</p>
<p>{{ multiworlds }} games were started in the last 7 days.</p>
</div>
</div>
<iframe src="https://discordapp.com/widget?id=731205301247803413&theme=light"