WebHost: order guides by alphabet
This commit is contained in:
parent
14633724f2
commit
8b78477c69
12
WebHost.py
12
WebHost.py
|
@ -3,11 +3,13 @@ import multiprocessing
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import ModuleUpdate
|
import ModuleUpdate
|
||||||
|
|
||||||
ModuleUpdate.requirements_files.add(os.path.join("WebHostLib", "requirements.txt"))
|
ModuleUpdate.requirements_files.add(os.path.join("WebHostLib", "requirements.txt"))
|
||||||
ModuleUpdate.update()
|
ModuleUpdate.update()
|
||||||
|
|
||||||
# in case app gets imported by something like gunicorn
|
# in case app gets imported by something like gunicorn
|
||||||
import Utils
|
import Utils
|
||||||
|
|
||||||
Utils.local_path.cached_path = os.path.dirname(__file__)
|
Utils.local_path.cached_path = os.path.dirname(__file__)
|
||||||
|
|
||||||
from WebHostLib import app as raw_app
|
from WebHostLib import app as raw_app
|
||||||
|
@ -32,6 +34,15 @@ def get_app():
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
def create_ordered_tutorials_file():
|
||||||
|
import json
|
||||||
|
with open(os.path.join("WebHostLib", "static", "assets", "tutorial", "tutorials.json")) as source:
|
||||||
|
data = json.load(source)
|
||||||
|
data = sorted(data, key=lambda entry: entry["gameTitle"])
|
||||||
|
with open(os.path.join("WebHostLib", "static", "generated", "tutorials.json"), "w") as target:
|
||||||
|
json.dump(data, target)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
multiprocessing.freeze_support()
|
multiprocessing.freeze_support()
|
||||||
multiprocessing.set_start_method('spawn')
|
multiprocessing.set_start_method('spawn')
|
||||||
|
@ -43,6 +54,7 @@ if __name__ == "__main__":
|
||||||
logging.warning("Could not update LttP sprites.")
|
logging.warning("Could not update LttP sprites.")
|
||||||
app = get_app()
|
app = get_app()
|
||||||
create_options_files()
|
create_options_files()
|
||||||
|
create_ordered_tutorials_file()
|
||||||
if app.config["SELFLAUNCH"]:
|
if app.config["SELFLAUNCH"]:
|
||||||
autohost(app.config)
|
autohost(app.config)
|
||||||
if app.config["SELFGEN"]:
|
if app.config["SELFGEN"]:
|
||||||
|
|
|
@ -66,6 +66,6 @@ window.addEventListener('load', () => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ajax.open('GET', `${window.location.origin}/static/assets/tutorial/tutorials.json`, true);
|
ajax.open('GET', `${window.location.origin}/static/generated/tutorials.json`, true);
|
||||||
ajax.send();
|
ajax.send();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue