mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
Конфигурация и эксплуатационный слой: - nginx: client_max_body_size 64m — восстановление из бэкапа не работало вовсе, дефолтный лимит в 1 МБ резал дампы (реальный экспорт ~3.4 МБ) с 413 ещё до backend; - nginx: заголовки безопасности (nosniff, Referrer-Policy, Permissions-Policy) и полный Content-Security-Policy. Ради него inline-скрипт темы вынесен в public/theme-init.js; - nginx: limit_req на /api/ — перебор пароля Basic Auth шёл со скоростью сети, ни блокировки, ни задержки не было; - nginx: server_tokens off; - порт web привязан к 127.0.0.1, адрес настраивается через AURUM_BIND_ADDRESS (раньше слушался на всех интерфейсах); - backend работает от непривилегированного пользователя, no-new-privileges для backend и web; - дефолты пароля Postgres сведены к одному значению в обоих сервисах, в .env.example описана ловушка с инициализацией тома. Приложение: - версия убрана из неавторизованного /api/health и отдаётся как app_version в GET /api/settings; - /api/docs, /api/redoc и /api/openapi.json отключаются через AURUM_ENABLE_DOCS; - текст исключения при неудачном восстановлении уходит в лог, а не клиенту; - max_length для notes в схемах транзакций, активов и регулярных платежей (и в соответствующих полях UI); - срок «запомнить меня» сокращён с 30 дней до 7; - pytest обновлён до 9.0.3 (PYSEC-2026-1845), pytest-asyncio до 1.4.0; - CI: permissions contents:read для GITHUB_TOKEN.
25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
// Applies the saved theme (light/dark/system) to <html> before the first
|
|
// paint, so an explicit override never flashes the wrong theme for a frame
|
|
// while React/lib/theme.ts loads. "system" needs no attribute at all —
|
|
// index.css's prefers-color-scheme media query already handles that case
|
|
// with zero JS.
|
|
//
|
|
// Lives in public/ as its own file rather than inline in index.html so the
|
|
// Content-Security-Policy in frontend/nginx.conf can forbid inline scripts
|
|
// outright — an inline block would need either 'unsafe-inline' (which gives
|
|
// up most of what CSP buys) or a hash that has to be regenerated by hand on
|
|
// every edit to these lines. Loaded as a plain synchronous <script src> in
|
|
// <head>, which still blocks the first paint, so the no-flash behaviour is
|
|
// unchanged.
|
|
(function () {
|
|
var stored = localStorage.getItem("aurum:theme");
|
|
if (stored === "light" || stored === "dark") {
|
|
document.documentElement.setAttribute("data-theme", stored);
|
|
}
|
|
var isDark =
|
|
stored === "dark" || (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
|
|
var meta = document.querySelector('meta[name="theme-color"]');
|
|
// Kept in sync by hand with index.css's --surface-0 light/dark values.
|
|
if (meta) meta.setAttribute("content", isDark ? "#0d0d0d" : "#f9f9f7");
|
|
})();
|