WebHost: cache static misc pages (#2245)

This commit is contained in:
Fabian Dill 2023-10-02 20:06:56 +02:00 committed by GitHub
parent 17127a4117
commit 18bf7425c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -32,29 +32,34 @@ def page_not_found(err):
# Start Playing Page # Start Playing Page
@app.route('/start-playing') @app.route('/start-playing')
@cache.cached()
def start_playing(): def start_playing():
return render_template(f"startPlaying.html") return render_template(f"startPlaying.html")
@app.route('/weighted-settings') @app.route('/weighted-settings')
@cache.cached()
def weighted_settings(): def weighted_settings():
return render_template(f"weighted-settings.html") return render_template(f"weighted-settings.html")
# Player settings pages # Player settings pages
@app.route('/games/<string:game>/player-settings') @app.route('/games/<string:game>/player-settings')
@cache.cached()
def player_settings(game): def player_settings(game):
return render_template(f"player-settings.html", game=game, theme=get_world_theme(game)) return render_template(f"player-settings.html", game=game, theme=get_world_theme(game))
# Game Info Pages # Game Info Pages
@app.route('/games/<string:game>/info/<string:lang>') @app.route('/games/<string:game>/info/<string:lang>')
@cache.cached()
def game_info(game, lang): def game_info(game, lang):
return render_template('gameInfo.html', game=game, lang=lang, theme=get_world_theme(game)) return render_template('gameInfo.html', game=game, lang=lang, theme=get_world_theme(game))
# List of supported games # List of supported games
@app.route('/games') @app.route('/games')
@cache.cached()
def games(): def games():
worlds = {} worlds = {}
for game, world in AutoWorldRegister.world_types.items(): for game, world in AutoWorldRegister.world_types.items():
@ -64,21 +69,25 @@ def games():
@app.route('/tutorial/<string:game>/<string:file>/<string:lang>') @app.route('/tutorial/<string:game>/<string:file>/<string:lang>')
@cache.cached()
def tutorial(game, file, lang): def tutorial(game, file, lang):
return render_template("tutorial.html", game=game, file=file, lang=lang, theme=get_world_theme(game)) return render_template("tutorial.html", game=game, file=file, lang=lang, theme=get_world_theme(game))
@app.route('/tutorial/') @app.route('/tutorial/')
@cache.cached()
def tutorial_landing(): def tutorial_landing():
return render_template("tutorialLanding.html") return render_template("tutorialLanding.html")
@app.route('/faq/<string:lang>/') @app.route('/faq/<string:lang>/')
@cache.cached()
def faq(lang): def faq(lang):
return render_template("faq.html", lang=lang) return render_template("faq.html", lang=lang)
@app.route('/glossary/<string:lang>/') @app.route('/glossary/<string:lang>/')
@cache.cached()
def terms(lang): def terms(lang):
return render_template("glossary.html", lang=lang) return render_template("glossary.html", lang=lang)
@ -147,7 +156,7 @@ def host_room(room: UUID):
@app.route('/favicon.ico') @app.route('/favicon.ico')
def favicon(): def favicon():
return send_from_directory(os.path.join(app.root_path, 'static/static'), return send_from_directory(os.path.join(app.root_path, "static", "static"),
'favicon.ico', mimetype='image/vnd.microsoft.icon') 'favicon.ico', mimetype='image/vnd.microsoft.icon')
@ -167,6 +176,7 @@ def get_datapackage():
@app.route('/index') @app.route('/index')
@app.route('/sitemap') @app.route('/sitemap')
@cache.cached()
def get_sitemap(): def get_sitemap():
available_games: List[Dict[str, Union[str, bool]]] = [] available_games: List[Dict[str, Union[str, bool]]] = []
for game, world in AutoWorldRegister.world_types.items(): for game, world in AutoWorldRegister.world_types.items():