убрал старые функции и сделал автообновление версий js и css

This commit is contained in:
2026-05-15 12:45:16 +03:00
parent 636a9a5e59
commit 69e40984f2
3 changed files with 16 additions and 92 deletions

12
app.py
View File

@@ -18,6 +18,7 @@ import time
from urllib.parse import quote
import traceback
import contextlib
import os
from parsers.parser_game import run_parser_game
from parsers.parser_players import run_parser_players
from parsers.parser_schedule import run_parser_schedule
@@ -310,6 +311,17 @@ def root(request: Request):
return RedirectResponse(url="/admin/matches")
return RedirectResponse(url="/login")
@app.context_processor
def inject_static_version():
def static_version(filename):
path = os.path.join(app.root_path, "static", filename)
try:
return int(os.path.getmtime(path))
except OSError:
return "1"
return dict(static_version=static_version)
def log_action(
request: Request,

View File

@@ -290,7 +290,6 @@ function restoreMatchState() {
matchEvents = Array.isArray(state.matchEvents) ? state.matchEvents : [];
scoreState = state.scoreState || { home: 0, away: 0 };
extraTimeMinutes = state.extraTimeMinutes || { first: 0, second: 0 };
// originalLineupState = state.originalLineupState || originalLineupState;
pausedAccumulatedSeconds = Number(state.pausedAccumulatedSeconds ?? 0);
periodStartedAt = state.periodStartedAt ?? null;
@@ -510,7 +509,6 @@ function addPeriodMarker(type, title, forcedSeconds = null) {
};
matchEvents.push(item);
// matchEvents = sortEventsForStorage(matchEvents);
renderEvents();
saveMatchState();
@@ -841,10 +839,6 @@ function updateEditModeUI() {
btn.classList.toggle("active", editModeEnabled);
}
// document.querySelectorAll("[data-edit-only]").forEach((el) => {
// el.style.display = editModeEnabled ? "" : "none";
// });
document.querySelectorAll("[data-edit-lock]").forEach((el) => {
if ("disabled" in el) {
el.disabled = !editModeEnabled;
@@ -1138,7 +1132,6 @@ async function triggerVmixEventCommand(eventPayload) {
console.log("VMIX DIRECT EVENT:", eventPayload);
console.log("VMIX DIRECT COMMANDS:", commands);
// await executeVmixCommands(commands.join("\n"));
await sendDirectVmixCommands(commands);
}
@@ -2259,51 +2252,6 @@ function convertPitchYToPan(y) {
}
// function buildVmixCommandsFromFormation(side) {
// const players = Array.isArray(formationState[side]) ? formationState[side] : [];
// const commands = [];
// const playerPrefix = side === "home" ? "HOME" : "AWAY";
// const inputName = side === "home" ? "РАССТАНОВКА - ХОЗЯЕВА" : "РАССТАНОВКА - ГОСТИ";
// if (players.length < 2) {
// return [];
// }
// // Вратарь players[0], полевые players[1..10]
// players.slice(1, 11).forEach((player, index) => {
// const playerNumber = index + 1;
// const playerInputName = `${playerPrefix} - Игрок${playerNumber}`;
// const x = convertPitchXToPan(player.x).toFixed(3);
// const y = convertPitchYToPan(player.y).toFixed(3);
// for (let i = 1; i <= 10; i++) {
// commands.push(
// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(`${playerPrefix} - Игрок${i}`)}`)
// );
// };
// commands.push(
// vmixCmd(`Function=ResetInput&Input=${encodeURIComponent(inputName)}`)
// );
// commands.push(
// vmixCmd(`Function=SetPanX&Input=${encodeURIComponent(playerInputName)}&Value=${x}`)
// );
// commands.push(
// vmixCmd(`Function=SetPanY&Input=${encodeURIComponent(playerInputName)}&Value=${y}`)
// );
// });
// return commands;
// }
function buildVmixCommandsFromFormation(side) {
const players = Array.isArray(formationState[side]) ? formationState[side] : [];
const commands = [];
@@ -2440,43 +2388,6 @@ const FORMATION_TEMPLATE_442 = {
]
};
// function getDistributedXSlots(count) {
// if (count <= 0) return [];
// if (count === 1) return [50];
// if (count === 2) return [25, 75];
// if (count === 3) return [8, 50, 92];
// if (count === 4) return [0, 30, 70, 100];
// if (count === 5) return [0, 18, 50, 82, 100];
// if (count === 6) return [0, 16, 36, 64, 84, 100];
// return Array.from({ length: count }, (_, i) => (i / (count - 1)) * 100);
// }
// function getArcYOffsetSlots(count, strength = 10) {
// if (count < 4) {
// return Array(count).fill(0);
// }
// if (count === 5) {
// return [
// strength * 0.11, // левый фланг ниже
// -strength * 0.5, // левый полуфланг чуть выше базы
// -strength, // центр выше всех
// -strength * 0.5, // правый полуфланг чуть выше базы
// strength * 0.11 // правый фланг ниже
// ];
// }
// const center = (count - 1) / 2;
// return Array.from({ length: count }, (_, i) => {
// const dist = Math.abs(i - center);
// const maxDist = center || 1;
// const normalized = dist / maxDist;
// return -strength * Math.pow(1 - normalized, 1.5);
// });
// }
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));

View File

@@ -10,7 +10,8 @@
<meta http-equiv="Expires" content="0" />
<title>ЖФЛ Управление vMix</title>
<link rel="icon" href="/static/smith.ico" type="image/x-icon">
<link rel="stylesheet" href="/static/styles.css?v=20260421_4">
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}?v={{ static_version('styles.css') }}">
<style>
.player-link-btn,
@@ -1399,7 +1400,7 @@ data-role="{{ p.position or '' }}"
</script>
<script src="/static/script.js?v=20260421_4"></script>
<script src="{{ url_for('static', filename='script.js') }}?v={{ static_version('script.js') }}"></script>
<div id="matrixLoader" class="matrix-loader" aria-hidden="true">
<canvas id="matrixCanvas" class="matrix-canvas"></canvas>