2020-06-13 06:37:05 +00:00
|
|
|
import os
|
2020-07-27 03:04:49 +00:00
|
|
|
import uuid
|
|
|
|
import base64
|
2020-12-04 23:43:18 +00:00
|
|
|
import socket
|
2020-06-13 06:37:05 +00:00
|
|
|
|
2021-06-14 23:35:02 +00:00
|
|
|
import jinja2.exceptions
|
2020-06-20 18:03:06 +00:00
|
|
|
from pony.flask import Pony
|
2020-08-01 00:32:48 +00:00
|
|
|
from flask import Flask, request, redirect, url_for, render_template, Response, session, abort, send_from_directory
|
2020-06-21 13:32:31 +00:00
|
|
|
from flask_caching import Cache
|
2020-06-30 05:32:05 +00:00
|
|
|
from flask_compress import Compress
|
2021-08-31 21:28:46 +00:00
|
|
|
from worlds.AutoWorld import AutoWorldRegister
|
2020-06-16 09:26:54 +00:00
|
|
|
|
2020-06-20 18:03:06 +00:00
|
|
|
from .models import *
|
2020-06-16 09:26:54 +00:00
|
|
|
|
2020-06-14 07:45:23 +00:00
|
|
|
UPLOAD_FOLDER = os.path.relpath('uploads')
|
|
|
|
LOGS_FOLDER = os.path.relpath('logs')
|
2020-06-13 08:16:29 +00:00
|
|
|
os.makedirs(LOGS_FOLDER, exist_ok=True)
|
2020-06-13 06:37:05 +00:00
|
|
|
|
|
|
|
app = Flask(__name__)
|
2020-06-20 18:03:06 +00:00
|
|
|
Pony(app)
|
2020-06-21 13:32:31 +00:00
|
|
|
|
2020-07-25 20:40:24 +00:00
|
|
|
app.jinja_env.filters['any'] = any
|
|
|
|
app.jinja_env.filters['all'] = all
|
|
|
|
|
2021-12-13 04:48:33 +00:00
|
|
|
app.config["SELFHOST"] = True # application process is in charge of running the websites
|
2020-08-17 23:18:37 +00:00
|
|
|
app.config["GENERATORS"] = 8 # maximum concurrent world gens
|
2021-12-13 04:48:33 +00:00
|
|
|
app.config["SELFLAUNCH"] = True # application process is in charge of launching Rooms.
|
|
|
|
app.config["SELFGEN"] = True # application process is in charge of scheduling Generations.
|
2020-07-10 13:32:58 +00:00
|
|
|
app.config["DEBUG"] = False
|
|
|
|
app.config["PORT"] = 80
|
2020-06-13 06:37:05 +00:00
|
|
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
2021-10-16 18:11:26 +00:00
|
|
|
app.config['MAX_CONTENT_LENGTH'] = 64 * 1024 * 1024 # 64 megabyte limit
|
2020-12-04 23:43:18 +00:00
|
|
|
# if you want to deploy, make sure you have a non-guessable secret key
|
|
|
|
app.config["SECRET_KEY"] = bytes(socket.gethostname(), encoding="utf-8")
|
2020-09-08 23:41:37 +00:00
|
|
|
# at what amount of worlds should scheduling be used, instead of rolling in the webthread
|
|
|
|
app.config["JOB_THRESHOLD"] = 2
|
2020-06-20 18:03:06 +00:00
|
|
|
app.config['SESSION_PERMANENT'] = True
|
2020-07-27 02:05:42 +00:00
|
|
|
|
|
|
|
# waitress uses one thread for I/O, these are for processing of views that then get sent
|
2021-01-03 13:32:32 +00:00
|
|
|
# archipelago.gg uses gunicorn + nginx; ignoring this option
|
2020-07-27 02:05:42 +00:00
|
|
|
app.config["WAITRESS_THREADS"] = 10
|
2021-01-03 13:32:32 +00:00
|
|
|
# a default that just works. archipelago.gg runs on mariadb
|
2020-06-14 05:44:59 +00:00
|
|
|
app.config["PONY"] = {
|
|
|
|
'provider': 'sqlite',
|
2021-03-13 22:36:57 +00:00
|
|
|
'filename': os.path.abspath('ap.db3'),
|
2020-06-14 05:44:59 +00:00
|
|
|
'create_db': True
|
|
|
|
}
|
2020-08-02 20:11:52 +00:00
|
|
|
app.config["MAX_ROLL"] = 20
|
2022-06-09 11:16:10 +00:00
|
|
|
app.config["CACHE_TYPE"] = "flask_caching.backends.SimpleCache"
|
2020-11-03 04:26:10 +00:00
|
|
|
app.config["JSON_AS_ASCII"] = False
|
2021-04-10 13:26:30 +00:00
|
|
|
app.config["PATCH_TARGET"] = "archipelago.gg"
|
2020-11-03 04:26:10 +00:00
|
|
|
|
2020-06-21 13:32:31 +00:00
|
|
|
cache = Cache(app)
|
2020-06-30 05:32:05 +00:00
|
|
|
Compress(app)
|
2020-06-13 06:37:05 +00:00
|
|
|
|
2020-07-27 03:04:49 +00:00
|
|
|
from werkzeug.routing import BaseConverter
|
|
|
|
|
|
|
|
|
|
|
|
class B64UUIDConverter(BaseConverter):
|
|
|
|
|
|
|
|
def to_python(self, value):
|
|
|
|
return uuid.UUID(bytes=base64.urlsafe_b64decode(value + '=='))
|
|
|
|
|
|
|
|
def to_url(self, value):
|
|
|
|
return base64.urlsafe_b64encode(value.bytes).rstrip(b'=').decode('ascii')
|
|
|
|
|
|
|
|
|
|
|
|
# short UUID
|
|
|
|
app.url_map.converters["suuid"] = B64UUIDConverter
|
|
|
|
app.jinja_env.filters['suuid'] = lambda value: base64.urlsafe_b64encode(value.bytes).rstrip(b'=').decode('ascii')
|
2020-06-13 06:37:05 +00:00
|
|
|
|
|
|
|
|
Website Style Upgrade (#353)
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* Improve Archipidle item name
* [WebHost] Update background images, waiting on jungle.png, added partyTime theme
* [WebHost] Fix tab ordering on landing page, remove islands on screen scale, fix tutorial page width scaling
* [WebHost] Final touches to WebHost
* Improve get_world_theme function, add partyTime theme to ArchipIDLE WebWorld
* Remove sending_visible from AutoWorld
* AP Ocarina of Time Client (#352)
* Core: update jinja (#351)
* some typing and cleaning, mostly in Fill.py (#349)
* some typing and cleaning, mostly in Fill.py
* address missing Option types
* resolve a few TODOs discussed in pull request
* SM: Optimize a bit (#350)
* SM: Optimize a bit
* SM: init bosses only once
* New World Order (#355)
* Core: update jinja
* SM: Optimize a bit
* AutoWorld: import worlds in alphabetical order, to be predictable rather than arbitrary
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
* Remove references to Z5Client in English OoT setup guide
* Prevent markdown code blocks from overflowing their container
Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
2022-03-29 00:12:17 +00:00
|
|
|
def get_world_theme(game_name: str):
|
|
|
|
if game_name in AutoWorldRegister.world_types:
|
|
|
|
return AutoWorldRegister.world_types[game_name].web.theme
|
|
|
|
return 'grass'
|
|
|
|
|
|
|
|
|
2020-06-20 20:48:38 +00:00
|
|
|
@app.before_request
|
2020-06-20 18:03:06 +00:00
|
|
|
def register_session():
|
|
|
|
session.permanent = True # technically 31 days after the last visit
|
|
|
|
if not session.get("_id", None):
|
|
|
|
session["_id"] = uuid4() # uniquely identify each session without needing a login
|
2020-06-13 08:16:29 +00:00
|
|
|
|
|
|
|
|
2021-06-14 23:35:02 +00:00
|
|
|
@app.errorhandler(404)
|
|
|
|
@app.errorhandler(jinja2.exceptions.TemplateNotFound)
|
|
|
|
def page_not_found(err):
|
|
|
|
return render_template('404.html'), 404
|
|
|
|
|
|
|
|
|
2021-10-12 00:52:30 +00:00
|
|
|
# Start Playing Page
|
|
|
|
@app.route('/start-playing')
|
|
|
|
def start_playing():
|
|
|
|
return render_template(f"startPlaying.html")
|
|
|
|
|
|
|
|
|
2021-12-31 19:42:04 +00:00
|
|
|
@app.route('/weighted-settings')
|
|
|
|
def weighted_settings():
|
|
|
|
return render_template(f"weighted-settings.html")
|
|
|
|
|
|
|
|
|
2021-07-25 03:09:34 +00:00
|
|
|
# Player settings pages
|
|
|
|
@app.route('/games/<string:game>/player-settings')
|
|
|
|
def player_settings(game):
|
Website Style Upgrade (#353)
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* Improve Archipidle item name
* [WebHost] Update background images, waiting on jungle.png, added partyTime theme
* [WebHost] Fix tab ordering on landing page, remove islands on screen scale, fix tutorial page width scaling
* [WebHost] Final touches to WebHost
* Improve get_world_theme function, add partyTime theme to ArchipIDLE WebWorld
* Remove sending_visible from AutoWorld
* AP Ocarina of Time Client (#352)
* Core: update jinja (#351)
* some typing and cleaning, mostly in Fill.py (#349)
* some typing and cleaning, mostly in Fill.py
* address missing Option types
* resolve a few TODOs discussed in pull request
* SM: Optimize a bit (#350)
* SM: Optimize a bit
* SM: init bosses only once
* New World Order (#355)
* Core: update jinja
* SM: Optimize a bit
* AutoWorld: import worlds in alphabetical order, to be predictable rather than arbitrary
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
* Remove references to Z5Client in English OoT setup guide
* Prevent markdown code blocks from overflowing their container
Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
2022-03-29 00:12:17 +00:00
|
|
|
return render_template(f"player-settings.html", game=game, theme=get_world_theme(game))
|
2021-07-25 03:09:34 +00:00
|
|
|
|
|
|
|
|
2021-09-17 22:41:26 +00:00
|
|
|
# Game Info Pages
|
|
|
|
@app.route('/games/<string:game>/info/<string:lang>')
|
2021-09-18 00:35:31 +00:00
|
|
|
def game_info(game, lang):
|
Website Style Upgrade (#353)
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* Improve Archipidle item name
* [WebHost] Update background images, waiting on jungle.png, added partyTime theme
* [WebHost] Fix tab ordering on landing page, remove islands on screen scale, fix tutorial page width scaling
* [WebHost] Final touches to WebHost
* Improve get_world_theme function, add partyTime theme to ArchipIDLE WebWorld
* Remove sending_visible from AutoWorld
* AP Ocarina of Time Client (#352)
* Core: update jinja (#351)
* some typing and cleaning, mostly in Fill.py (#349)
* some typing and cleaning, mostly in Fill.py
* address missing Option types
* resolve a few TODOs discussed in pull request
* SM: Optimize a bit (#350)
* SM: Optimize a bit
* SM: init bosses only once
* New World Order (#355)
* Core: update jinja
* SM: Optimize a bit
* AutoWorld: import worlds in alphabetical order, to be predictable rather than arbitrary
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
* Remove references to Z5Client in English OoT setup guide
* Prevent markdown code blocks from overflowing their container
Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
2022-03-29 00:12:17 +00:00
|
|
|
return render_template('gameInfo.html', game=game, lang=lang, theme=get_world_theme(game))
|
2021-06-15 02:27:43 +00:00
|
|
|
|
2021-06-14 23:35:02 +00:00
|
|
|
|
2021-06-15 02:27:43 +00:00
|
|
|
# List of supported games
|
|
|
|
@app.route('/games')
|
|
|
|
def games():
|
2021-08-31 21:28:46 +00:00
|
|
|
worlds = {}
|
|
|
|
for game, world in AutoWorldRegister.world_types.items():
|
|
|
|
if not world.hidden:
|
2022-02-20 20:54:00 +00:00
|
|
|
worlds[game] = world
|
2021-09-17 22:41:26 +00:00
|
|
|
return render_template("supportedGames.html", worlds=worlds)
|
2021-06-14 23:35:02 +00:00
|
|
|
|
|
|
|
|
2021-01-03 22:46:47 +00:00
|
|
|
@app.route('/tutorial/<string:game>/<string:file>/<string:lang>')
|
|
|
|
def tutorial(game, file, lang):
|
Website Style Upgrade (#353)
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Seed download page improvements
* [WebHost] Update WebHost to include modular themes system, remove unused and outdated assets
* Landing Page Updates
* Markdown updates, colors coming later
* Remove testing theme from FF1
* Color updates for markdown styles
* Updates to generated pages, so many updates
* Add styles to weighted-settings page
* Minor adjustments to styles
* Revert base theme to grass
* Add more items to ArchipIDLE
* Improve Archipidle item name
* [WebHost] Update background images, waiting on jungle.png, added partyTime theme
* [WebHost] Fix tab ordering on landing page, remove islands on screen scale, fix tutorial page width scaling
* [WebHost] Final touches to WebHost
* Improve get_world_theme function, add partyTime theme to ArchipIDLE WebWorld
* Remove sending_visible from AutoWorld
* AP Ocarina of Time Client (#352)
* Core: update jinja (#351)
* some typing and cleaning, mostly in Fill.py (#349)
* some typing and cleaning, mostly in Fill.py
* address missing Option types
* resolve a few TODOs discussed in pull request
* SM: Optimize a bit (#350)
* SM: Optimize a bit
* SM: init bosses only once
* New World Order (#355)
* Core: update jinja
* SM: Optimize a bit
* AutoWorld: import worlds in alphabetical order, to be predictable rather than arbitrary
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
* Remove references to Z5Client in English OoT setup guide
* Prevent markdown code blocks from overflowing their container
Co-authored-by: espeon65536 <81029175+espeon65536@users.noreply.github.com>
Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
Co-authored-by: Doug Hoskisson <beauxq@users.noreply.github.com>
Co-authored-by: Hussein Farran <hmfarran@gmail.com>
2022-03-29 00:12:17 +00:00
|
|
|
return render_template("tutorial.html", game=game, file=file, lang=lang, theme=get_world_theme(game))
|
2021-01-03 22:46:47 +00:00
|
|
|
|
|
|
|
|
2021-08-20 20:41:23 +00:00
|
|
|
@app.route('/tutorial/')
|
2021-01-03 22:46:47 +00:00
|
|
|
def tutorial_landing():
|
2022-05-11 18:05:53 +00:00
|
|
|
worlds = {}
|
|
|
|
for game, world in AutoWorldRegister.world_types.items():
|
|
|
|
if not world.hidden:
|
|
|
|
worlds[game] = world
|
2021-01-03 22:46:47 +00:00
|
|
|
return render_template("tutorialLanding.html")
|
2020-07-31 23:59:33 +00:00
|
|
|
|
|
|
|
|
2021-08-23 00:01:58 +00:00
|
|
|
@app.route('/faq/<string:lang>/')
|
|
|
|
def faq(lang):
|
|
|
|
return render_template("faq.html", lang=lang)
|
2020-08-15 03:45:23 +00:00
|
|
|
|
|
|
|
|
2020-07-27 03:04:49 +00:00
|
|
|
@app.route('/seed/<suuid:seed>')
|
2021-11-25 19:48:58 +00:00
|
|
|
def view_seed(seed: UUID):
|
2020-06-20 18:03:06 +00:00
|
|
|
seed = Seed.get(id=seed)
|
2020-06-26 17:29:33 +00:00
|
|
|
if not seed:
|
2020-06-21 13:32:31 +00:00
|
|
|
abort(404)
|
2022-01-18 07:23:38 +00:00
|
|
|
return render_template("viewSeed.html", seed=seed, slot_count=count(seed.slots))
|
2020-06-20 18:03:06 +00:00
|
|
|
|
|
|
|
|
2020-07-27 03:04:49 +00:00
|
|
|
@app.route('/new_room/<suuid:seed>')
|
2020-06-26 17:29:33 +00:00
|
|
|
def new_room(seed: UUID):
|
2020-06-20 18:03:06 +00:00
|
|
|
seed = Seed.get(id=seed)
|
2020-06-26 17:29:33 +00:00
|
|
|
if not seed:
|
|
|
|
abort(404)
|
|
|
|
room = Room(seed=seed, owner=session["_id"], tracker=uuid4())
|
2020-06-20 18:03:06 +00:00
|
|
|
commit()
|
2021-11-24 22:49:00 +00:00
|
|
|
return redirect(url_for("host_room", room=room.id))
|
2020-06-20 18:03:06 +00:00
|
|
|
|
|
|
|
|
2020-06-13 08:16:29 +00:00
|
|
|
def _read_log(path: str):
|
2020-06-14 06:11:56 +00:00
|
|
|
if os.path.exists(path):
|
2020-06-22 01:53:00 +00:00
|
|
|
with open(path, encoding="utf-8-sig") as log:
|
2020-06-14 06:11:56 +00:00
|
|
|
yield from log
|
|
|
|
else:
|
2020-06-14 07:45:23 +00:00
|
|
|
yield f"Logfile {path} does not exist. " \
|
|
|
|
f"Likely a crash during spinup of multiworld instance or it is still spinning up."
|
2020-06-13 08:16:29 +00:00
|
|
|
|
|
|
|
|
2020-07-27 03:04:49 +00:00
|
|
|
@app.route('/log/<suuid:room>')
|
2020-06-26 17:29:33 +00:00
|
|
|
def display_log(room: UUID):
|
2022-06-10 05:14:31 +00:00
|
|
|
room = Room.get(id=room)
|
|
|
|
if room is None:
|
|
|
|
return abort(404)
|
2022-06-07 22:35:35 +00:00
|
|
|
if room.owner == session["_id"]:
|
2022-06-10 05:14:31 +00:00
|
|
|
return Response(_read_log(os.path.join("logs", str(room.id) + ".txt")), mimetype="text/plain;charset=UTF-8")
|
2022-06-07 22:35:35 +00:00
|
|
|
return "Access Denied", 403
|
2020-06-13 08:16:29 +00:00
|
|
|
|
|
|
|
|
2021-07-24 12:08:45 +00:00
|
|
|
@app.route('/room/<suuid:room>', methods=['GET', 'POST'])
|
2021-11-24 22:49:00 +00:00
|
|
|
def host_room(room: UUID):
|
2020-06-20 18:03:06 +00:00
|
|
|
room = Room.get(id=room)
|
2020-06-23 00:50:07 +00:00
|
|
|
if room is None:
|
|
|
|
return abort(404)
|
2020-06-20 18:03:06 +00:00
|
|
|
if request.method == "POST":
|
|
|
|
if room.owner == session["_id"]:
|
|
|
|
cmd = request.form["cmd"]
|
2021-12-13 00:38:07 +00:00
|
|
|
if cmd:
|
|
|
|
Command(room=room, commandtext=cmd)
|
|
|
|
commit()
|
2020-06-14 05:44:59 +00:00
|
|
|
|
2020-07-10 15:42:22 +00:00
|
|
|
with db_session:
|
|
|
|
room.last_activity = datetime.utcnow() # will trigger a spinup, if it's not already running
|
2020-06-13 08:16:29 +00:00
|
|
|
|
2022-02-23 18:16:45 +00:00
|
|
|
return render_template("hostRoom.html", room=room)
|
2020-06-13 06:37:05 +00:00
|
|
|
|
2021-09-03 10:50:26 +00:00
|
|
|
|
2020-08-01 00:32:48 +00:00
|
|
|
@app.route('/favicon.ico')
|
|
|
|
def favicon():
|
2020-08-02 23:10:42 +00:00
|
|
|
return send_from_directory(os.path.join(app.root_path, 'static/static'),
|
2020-08-01 00:32:48 +00:00
|
|
|
'favicon.ico', mimetype='image/vnd.microsoft.icon')
|
2020-07-31 23:59:33 +00:00
|
|
|
|
2021-11-24 22:49:00 +00:00
|
|
|
|
2021-10-10 19:52:45 +00:00
|
|
|
@app.route('/discord')
|
|
|
|
def discord():
|
|
|
|
return redirect("https://discord.gg/archipelago")
|
2020-08-02 20:11:52 +00:00
|
|
|
|
2021-11-24 22:49:00 +00:00
|
|
|
|
2022-01-07 02:32:51 +00:00
|
|
|
@app.route('/datapackage')
|
|
|
|
@cache.cached()
|
|
|
|
def get_datapackge():
|
|
|
|
"""A pretty print version of /api/datapackage"""
|
|
|
|
from worlds import network_data_package
|
|
|
|
import json
|
|
|
|
return Response(json.dumps(network_data_package, indent=4), mimetype="text/plain")
|
|
|
|
|
|
|
|
|
2022-04-08 13:52:49 +00:00
|
|
|
@app.route('/index')
|
2022-04-05 05:14:30 +00:00
|
|
|
@app.route('/sitemap')
|
|
|
|
def get_sitemap():
|
|
|
|
available_games = []
|
|
|
|
for game, world in AutoWorldRegister.world_types.items():
|
|
|
|
if not world.hidden:
|
|
|
|
available_games.append(game)
|
|
|
|
return render_template("siteMap.html", games=available_games)
|
|
|
|
|
|
|
|
|
2020-07-11 14:59:37 +00:00
|
|
|
from WebHostLib.customserver import run_server_process
|
2022-04-08 13:52:49 +00:00
|
|
|
from . import tracker, upload, landing, check, generate, downloads, api, stats # to trigger app routing picking up on it
|
2021-07-25 03:09:34 +00:00
|
|
|
|
2020-12-03 23:27:32 +00:00
|
|
|
app.register_blueprint(api.api_endpoints)
|