WebHost: fix landing page caching and mention amount of multiworlds in the last week.
This commit is contained in:
parent
ac238d9b14
commit
d005f6e1e1
|
@ -1,8 +1,10 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from WebHostLib import app, cache
|
from WebHostLib import app, cache
|
||||||
|
from .models import *
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
|
||||||
@cache.memoize(timeout=300)
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
|
@cache.cached(timeout=300) # cache has to appear under app route for caching to work
|
||||||
def landing():
|
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)
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
<p>This website is under active development. As such, your hosted rooms may occasionally disappear,
|
<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
|
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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
<iframe src="https://discordapp.com/widget?id=731205301247803413&theme=light"
|
<iframe src="https://discordapp.com/widget?id=731205301247803413&theme=light"
|
||||||
|
|
Loading…
Reference in New Issue