I dont even remember

This commit is contained in:
iamBadgers
2026-07-18 18:41:20 -07:00
parent f18a521747
commit a66d2133a0
3 changed files with 21 additions and 10 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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: