From a20f80453bf89e9b1d99dc3104a5dcffb309d89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9=20=D0=A7=D0=B5=D1=80=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Tue, 21 Apr 2026 12:37:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BE=D0=BA=20=D1=8D?= =?UTF-8?q?=D1=84=D1=84=D0=B5=D0=BA=D1=82=20=D0=BC=D0=B0=D1=82=D1=80=D0=B8?= =?UTF-8?q?=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 70 ++++- static/styles.css | 66 +++++ templates/login.html | 491 +++++++++++++++++++++++++++------ templates/match_workspace.html | 160 ++++++++++- templates/matches.html | 208 +++++++++++++- 5 files changed, 885 insertions(+), 110 deletions(-) diff --git a/app.py b/app.py index 1e5dd2e..5ada940 100644 --- a/app.py +++ b/app.py @@ -628,33 +628,73 @@ def session_workspace( @app.post("/admin/session/{session_token}/load-match-data") -def load_match_data(session_token: str): +def load_match_data(request: Request, session_token: str): session_row = get_match_session_by_token(session_token) if not session_row: + if request.headers.get("x-requested-with") == "XMLHttpRequest": + return JSONResponse( + { + "success": False, + "error": "Сессия не найдена", + "redirect_url": "/admin/matches", + }, + status_code=404, + ) return RedirectResponse(url="/admin/matches", status_code=303) match_id = session_row[1] match_external_id = session_row[8] - run_parser_game(str(match_external_id)) - - # сброс ручного состава и тренеров, чтобы подтянулись свежие данные парсера - from db import get_connection - - conn = get_connection() try: - with conn.cursor() as cur: - cur.execute( - "DELETE FROM match_lineup_players WHERE match_id = %s", (match_id,) + run_parser_game(str(match_external_id)) + + # сброс ручного состава и тренеров, чтобы подтянулись свежие данные парсера + from db import get_connection + + conn = get_connection() + try: + with conn.cursor() as cur: + cur.execute( + "DELETE FROM match_lineup_players WHERE match_id = %s", (match_id,) + ) + cur.execute("DELETE FROM match_coaches WHERE match_id = %s", (match_id,)) + conn.commit() + finally: + conn.close() + + except Exception as e: + error_text = str(e) or "Ошибка загрузки данных с сайта" + + if request.headers.get("x-requested-with") == "XMLHttpRequest": + return JSONResponse( + { + "success": False, + "error": error_text, + "redirect_url": f"/admin/session/{session_token}?tab=game", + }, + status_code=500, ) - cur.execute("DELETE FROM match_coaches WHERE match_id = %s", (match_id,)) - conn.commit() - finally: - conn.close() - return RedirectResponse(url=f"/admin/session/{session_token}", status_code=303) + return RedirectResponse( + url=f"/admin/session/{session_token}?tab=game", + status_code=303, + ) + if request.headers.get("x-requested-with") == "XMLHttpRequest": + return JSONResponse( + { + "success": True, + "message": "Данные успешно загружены", + "redirect_url": f"/admin/session/{session_token}?tab=game", + } + ) + return RedirectResponse( + url=f"/admin/session/{session_token}?tab=game", + status_code=303, + ) + + @app.post("/admin/session/{session_token}/close") def close_session(session_token: str): deactivate_match_session(session_token) diff --git a/static/styles.css b/static/styles.css index ace8e2b..1ddf767 100644 --- a/static/styles.css +++ b/static/styles.css @@ -2174,4 +2174,70 @@ body:not(.edit-mode-on) .referee-search { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); +} + +.matrix-loader { + position: fixed; + inset: 0; + z-index: 99999; + display: none; + align-items: center; + justify-content: center; + background: rgba(0, 0, 0, 0.93); + overflow: hidden; +} + +.matrix-loader.active { + display: flex; +} + +.matrix-canvas { + position: absolute; + inset: 0; + width: 100%; + height: 100%; +} + +.matrix-content { + position: relative; + z-index: 2; + text-align: center; + padding: 24px 28px; + border-radius: 16px; + background: rgba(0, 0, 0, 0.35); + border: 1px solid rgba(0, 255, 120, 0.25); + box-shadow: 0 0 30px rgba(0, 255, 120, 0.12); + backdrop-filter: blur(4px); +} + +.matrix-title { + margin-bottom: 10px; + font-size: 28px; + font-weight: 700; + color: #9dffb2; + text-shadow: 0 0 10px rgba(0, 255, 120, 0.35); +} + +.matrix-status { + font-size: 15px; + color: #d7ffe1; + opacity: 0.95; +} + +.matrix-loader.is-error .matrix-content { + border-color: rgba(255, 90, 90, 0.35); + box-shadow: 0 0 30px rgba(255, 90, 90, 0.12); +} + +.matrix-loader.is-error .matrix-title { + color: #ff9c9c; + text-shadow: 0 0 10px rgba(255, 90, 90, 0.25); +} + +.matrix-loader.is-error .matrix-status { + color: #ffd4d4; +} + +.matrix-loader.is-success .matrix-title { + color: #9dffb2; } \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 4582cfb..4848b57 100644 --- a/templates/login.html +++ b/templates/login.html @@ -2,109 +2,434 @@ - WFL Admin Login + + + + Вход - -
-

WFL Admin

-
Вход в административный интерфейс
+ + - {% if message %} -
{{ message }}
- {% endif %} +
+
+
+ + + +
wfl access terminal
+
- {% if error %} -
{{ error }}
- {% endif %} +
+
-
- - + - - + - -
+ -
Сессия автоматически завершится после 2 часов без активности.
+ {% if message %} +
{{ message }}
+ {% endif %} + + {% if error %} +
{{ error }}
+ {% endif %} +
+
+ + + + - + \ No newline at end of file diff --git a/templates/match_workspace.html b/templates/match_workspace.html index c0e2236..51e82db 100644 --- a/templates/match_workspace.html +++ b/templates/match_workspace.html @@ -53,10 +53,11 @@ {% endif %}
-
+
-