polished homepage, added game info table

This commit is contained in:
Aidan Haas
2025-07-10 14:49:49 -04:00
parent e9a7fe9b25
commit 5032b3c7d1
8 changed files with 238 additions and 103 deletions
+13 -7
View File
@@ -7,7 +7,7 @@ from flask_cors import CORS
from flask_socketio import SocketIO
app = Flask(__name__)
CORS(app, origins=["http://localhost:3000", "10.*"])
CORS(app, origins=["*", "0.0.0.0"])
socketio = SocketIO(app, cors_allowed_origins="*")
@@ -38,11 +38,10 @@ def add_player():
@app.route("/reset", methods=["GET"])
def reset():
game_state = {
"gameActive": False,
"players": [""],
"playerTurn": 0
}
game_state["gameActive"] = False
game_state["players"] = []
game_state["playerTurn"] = 0
socketio.emit("player_update", {"players": game_state["players"]})
return jsonify(game_state)
@@ -50,6 +49,13 @@ def reset():
def status():
return jsonify(game_state)
@app.route("/start", methods=["GET"])
def start_game():
game_state["gameActive"] = True
socketio.emit("player_update", {"players": game_state["players"]})
return jsonify(game_state)
@app.route("/next", methods=["GET"])
def next_player():
players = game_state["players"]
@@ -67,4 +73,4 @@ def next_player():
})
if __name__ == "__main__":
socketio.run(app, host="localhost", port=8080)
socketio.run(app, host="0.0.0.0", port=8080)