mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
update modules, move markdown requirement and add tutorial caching
This commit is contained in:
@@ -76,12 +76,14 @@ def register_session():
|
||||
|
||||
@app.route('/tutorial')
|
||||
@app.route('/tutorial/<string:lang>')
|
||||
@cache.memoize(timeout=300) # update every 300 seconds
|
||||
def tutorial(lang='en'):
|
||||
try:
|
||||
md_file = open(f'WebHostLib/tutorial/tutorial_{lang}.md', 'r', encoding="utf-8")
|
||||
return render_template("tutorial.html", tutorial=markdown.markdown(md_file.read()))
|
||||
md_file = open(os.path.join('WebHostLib', 'tutorial', f"tutorial_{lang}.md"), encoding="utf-8-sig")
|
||||
except FileNotFoundError:
|
||||
return render_template("tutorial.html", tutorial='The tutorial is not available in that language yet, sorry.')
|
||||
else:
|
||||
return render_template("tutorial.html", tutorial=markdown.markdown(md_file.read()))
|
||||
|
||||
|
||||
@app.route('/seed/<suuid:seed>')
|
||||
|
||||
Reference in New Issue
Block a user