add main page and multiple stories

This commit is contained in:
LockeShor
2026-09-19 20:41:42 -04:00
parent 5ffdc0bbb2
commit e5ce7f6426
5 changed files with 32 additions and 10 deletions
+12 -8
View File
@@ -5,17 +5,21 @@ app = Flask(__name__)
@app.route("/")
def game():
def mainPage():
return open("main.html").read()
@app.route("/<path:path>")
def game(path):
if "Discord" not in str(request.user_agent):
return mainPage()
gamecode = request.args.get('code')[:-1]
#return open("page copy.html", "r").read()
#print(buildHTML(gamecode))
return buildHTML(gamecode)
gameName = request.path[1:]
print(gameName)
return buildHTML(gamecode,gameName)
def buildHTML(gamecode):
with open("story.json", "r") as f:
def buildHTML(gamecode, gameName):
with open("stories/" + gameName.replace(".", "") + ".json", "r") as f:
print("\n\n")
story = json.loads(f.read())
nodeName = "start"