From a66d2133a08273c164217d8a243912cf994873f9 Mon Sep 17 00:00:00 2001 From: iamBadgers Date: Sat, 18 Jul 2026 18:41:20 -0700 Subject: [PATCH] I dont even remember --- src/auth.py | 4 ---- src/container_managment.py | 22 ++++++++++++++++++++-- src/tables.py | 5 +---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/auth.py b/src/auth.py index 27663fd..d356883 100644 --- a/src/auth.py +++ b/src/auth.py @@ -33,10 +33,6 @@ def logout(): def get_current_user(): if current_user.is_authenticated: return jsonify(current_user.to_dict()) - else: - return jsonify( - {"username": "NONE", "is_admin": "false", "authenticated": False} - ) return "Unauthd", 403 diff --git a/src/container_managment.py b/src/container_managment.py index cb94fe5..82fbd0b 100644 --- a/src/container_managment.py +++ b/src/container_managment.py @@ -3,10 +3,11 @@ import os import socket import inspect import shutil +import requests from flask import current_app from game_table_model import GameTable from key_model import TableKey - +from time import sleep def build_container_routing_labels(prefix: str, strip_prefix=True): host_name = os.environ.get("API_HOST_NAME") or "localhost" @@ -59,7 +60,7 @@ def stop_container(docker_id) -> bool: try: client = docker.from_env() container = client.containers.get(docker_id) - container.kill() + container.stop() return True except (docker.errors.NotFound, docker.errors.APIError): return False @@ -146,5 +147,22 @@ def start_foundry_container(table: GameTable, key: TableKey): detach=True, network=networkName, ) + current_app.logger.info(container.attrs) + + count = 0 + current_app.logger.info("Here:") + container.reload() + current_app.logger.info(container.status) + sleep(2) + while(container.status == "running" and count < 10): + current_app.logger.info(count) + current_app.logger.info(requests.get("http://proxy:8080/api/http/routers").json()) + container.reload() + count = count + 1 + sleep(1) + + container.reload() + if (container.status != "running"): + raise "Fuck" return container.id diff --git a/src/tables.py b/src/tables.py index 04b00ec..f0a7ffc 100644 --- a/src/tables.py +++ b/src/tables.py @@ -9,7 +9,6 @@ from flask_login import login_user, logout_user, login_required, current_user tables = Blueprint("tables_api", __name__) - @tables.route("/tables", methods=["POST"]) @login_required def create_table(): @@ -92,7 +91,7 @@ def list_inactive_tables(): @login_required def activate_table(table_id): user = current_user - hard = bool(request.get_json()["hard"]) + hard = request.get_json()["hard"] == "True" keys = TableKey.query.filter_by(game_table_id=None).all() table = GameTable.query.get_or_404(table_id) @@ -106,8 +105,6 @@ def activate_table(table_id): return "No more keys", 400 key = keys[0] - current_app.logger.info(table.game_table_id) - current_app.logger.info(table.docker_id) key.reserve(table.game_table_id) table.active = True if hard: