state sync

This commit is contained in:
2025-11-23 14:59:17 -08:00
parent 537bdf1ad7
commit 39f4a8d3fc
812 changed files with 373062 additions and 84 deletions

View File

@@ -29,6 +29,7 @@ from . import gamedata
# \brief The Flask instance. See <a href="https://flask.palletsprojects.com/en/stable/api/">Flask documentation</a>.
app = flask.Flask("seagull-game", root_path=path_appdir, template_folder="templates", static_folder="static")
CORS(app)
app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 0
orig_url_for = app.url_for
xml_namespaces = {
@@ -69,7 +70,8 @@ common_rule_schema = xmltree.XMLSchema(doc_common_rule_schema)
## \brief Validates all XML files in gamedata.
# \internal
#
# This is typically run on program startup.
# This is typically run on program startup. Other modules will register validators
# and this function will check against them all.
def validate_xml_files():
for schema in schemas:
for file in gamedata.vfs.vfs.glob(schema[1]):
@@ -94,6 +96,8 @@ def render_dialog(dialog):
gamedata.vfs.copy_out(f"templates/{dialog}.j2", dest=path_appdir.as_posix())
if gamedata.vfs.exists(f"static/js/dlg-{dialog}.js"):
gamedata.vfs.copy_out(f"static/js/dlg-{dialog}.js", dest=path_appdir.as_posix())
if gamedata.vfs.exists(f"static/js/dlg-{dialog}.mjs"):
gamedata.vfs.copy_out(f"static/js/dlg-{dialog}.mjs")
return flask.render_template(f"{dialog}.j2")
else:
return "", 404