Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from flask import Flask
from flask import Flask, jsonify
from api import api_bp

logging.basicConfig(level=logging.INFO)
Expand All @@ -10,6 +10,10 @@ def create_app():
# Register routes
app.register_blueprint(api_bp)

@app.route('/health')
def health():
return jsonify(status='success', data={'health': 'ok'}), 200

@app.route('/')
def home():
return app.send_static_file('index.html')
Expand Down
10 changes: 5 additions & 5 deletions src/core/cheat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import threading

from sqlmodel import select
from infrastructure import SessionLocal
from infrastructure import SessionLocal as SessionFactory
from models import CheatMode

_lock = threading.Lock()
Expand Down Expand Up @@ -51,10 +51,10 @@ def _constant_time_verify(raw_input: str, stored_hash: str) -> bool:
def is_cheat_mode() -> bool:
"""Return current cheat mode state (thread-safe read)."""
with _lock:
if not SessionLocal:
if not SessionFactory:
return False

with SessionLocal() as session:
with SessionFactory() as session:
return _get_cheat_row(session).enabled


Expand All @@ -80,15 +80,15 @@ def toggle_cheat_mode(raw_cheat_code: str) -> dict:
"cheat_mode": None,
}

if not SessionLocal:
if not SessionFactory:
return {
"success": False,
"message": "Database is not configured for cheat mode storage.",
"cheat_mode": None,
}

with _lock:
with SessionLocal() as session:
with SessionFactory() as session:
cheat = _get_cheat_row(session)
cheat.enabled = not cheat.enabled
session.add(cheat)
Expand Down
Loading