diff --git a/main.py b/main.py index 67cae4a..1e1d949 100644 --- a/main.py +++ b/main.py @@ -171,6 +171,10 @@ app.mount("/static", StaticFiles(directory="static"), name="static") MAX_UPLOAD_SIZE = 100 * 1024 * 1024 # 100 MB MAX_MESSAGE_LEN = 10_000 +# ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква). +# Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version). +APP_VERSION = "2026-06-10a" + # Audit: path → action name mapping _AUDIT_MAP = [ ("POST", "/api/login", "login"), @@ -300,6 +304,12 @@ async def index(): return Path("static/chat.html").read_text(encoding="utf-8") +@app.get("/api/version") +async def version(): + """Public — single source of UI version (stamped into .app-version on the front).""" + return {"version": APP_VERSION} + + # Resumable uploads (tus 1.0.0). Same-process, reuses auth + per-user work dir; # the finished file lands in the work dir exactly like legacy /api/upload. TUS_MAX_SIZE = 3 * 1024 * 1024 * 1024 # 3 GB diff --git a/static/admin.html b/static/admin.html index 84f2749..a7a38f2 100644 --- a/static/admin.html +++ b/static/admin.html @@ -48,7 +48,7 @@ a { color: var(--accent); text-decoration: none; } Журнал Файлы ← Вернуться в чат -
v.2026-05-06g
+
@@ -388,6 +388,11 @@ fetch('/api/admin/sessions', {headers: H}).then(r=>r.json()).then(sessions => { table.appendChild(tr); } }).catch(()=>{}); + +// Версия UI — единый источник (main.py APP_VERSION → /api/version) +fetch('/api/version').then(r=>r.json()).then(d=>{ + document.querySelectorAll('.app-version').forEach(e=>e.textContent='v.'+d.version); +}).catch(()=>{}); diff --git a/static/chat.html b/static/chat.html index 0c52dfc..a7623a9 100644 --- a/static/chat.html +++ b/static/chat.html @@ -151,7 +151,54 @@ button { font-family: inherit; } #sidebar-toggle { display: inline-block; } .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 55; } } + +/* ===== Тёмная тема (Ководство: тёплый «не-чёрный» фон, «не-белый» текст, */ +/* акцент чуть подсвечен для контраста; переключатель + системное предпочтение) ===== */ +html { color-scheme: light; } +:root[data-theme="dark"] { + color-scheme: dark; + --bg: #16140f; --bg-card: #211d17; --bg-input: #262019; --bg-sunken: #1b1813; + --text: #ece4d7; --text-muted: #a89c8a; --text-light: #7d7263; + --border: #3a332a; --border-light: #2a251e; + --accent: #d9695c; --accent-hover: #e58074; --accent-active: #c2564a; --accent-light: rgba(217,105,92,.16); + --user-bg: #39322a; --user-text: #f2ece2; + --ai-bg: #211d17; --ai-border: #2f2820; + --file-bg: #211d17; --file-border: #3a332a; + --error-bg: #3a1f1d; --error-border: #5e2b27; + --system-bg: #211d17; --system-text: #a89c8a; + --ok: #3fa066; --ok-hover: #4cb074; + --shadow-sm: 0 1px 2px rgba(0,0,0,.4); + --shadow-md: 0 10px 30px rgba(0,0,0,.55); + --focus-ring: 0 0 0 3px rgba(217,105,92,.42); +} +/* Места с захардкоженным цветом — переопределяем только в тёмной (light не трогаем) */ +:root[data-theme="dark"] #login-screen { background: linear-gradient(135deg, #1b1813 0%, #131009 100%); } +:root[data-theme="dark"] #login-error, +:root[data-theme="dark"] .msg-error { color: #ff8585; } +:root[data-theme="dark"] .msg-tool { background: #2a2410; border-color: #4a3f1a; color: #ecc879; } +:root[data-theme="dark"] .msg-file a { color: #5fc27e; } +:root[data-theme="dark"] .file-badge { background: #2a2620; color: #ece4d7; } +:root[data-theme="dark"] .file-badge .remove { color: #ff8585; } +:root[data-theme="dark"] .copy-btn.copied { background: #1e3a25; border-color: #2f6b40; color: #86dca0; } +:root[data-theme="dark"] .msg-ai code { background: #2a2620; color: #ece4d7; } +:root[data-theme="dark"] .msg-ai pre { background: #0e0c09; color: #ece4d7; } +:root[data-theme="dark"] .msg-ai tbody tr:nth-child(even) { background: rgba(255,255,255,.045); } +:root[data-theme="dark"] #input-area { box-shadow: 0 -2px 10px rgba(0,0,0,.35); } +#theme-toggle { font-size: .95rem; line-height: 1; padding: .38rem .62rem; } + @@ -196,6 +243,7 @@ button { font-family: inherit; } --> + @@ -214,7 +262,7 @@ button { font-family: inherit; }
-
О безопасности сервиса
+
О безопасности сервиса
@@ -228,6 +276,24 @@ if (typeof marked !== 'undefined') { marked.setOptions({ breaks: true, gfm: true }); } +// --- Тема (светлая/тёмная) --- +function applyThemeIcon() { + var b = document.getElementById('theme-toggle'); + if (b) b.textContent = document.documentElement.getAttribute('data-theme') === 'dark' ? '☀' : '☾'; +} +function toggleTheme() { + var next = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'; + document.documentElement.setAttribute('data-theme', next); + try { localStorage.setItem('theme', next); } catch (e) {} + applyThemeIcon(); +} +applyThemeIcon(); + +// --- Версия UI из единого источника (main.py APP_VERSION → /api/version) --- +fetch('/api/version').then(function (r) { return r.json(); }).then(function (d) { + document.querySelectorAll('.app-version').forEach(function (el) { el.textContent = 'v.' + d.version; }); +}).catch(function () {}); + function renderMarkdown(text) { if (typeof marked !== 'undefined') { try { return marked.parse(text); } catch(e) {}