From d3e3a4802cb260b4c1f3533c91154d3a9f06cac7 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 25 Aug 2026 03:25:04 +0300 Subject: [PATCH] docs: record Belki fixes and goal calculator --- MEMORY.md | 1 + structure_and_data.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/MEMORY.md b/MEMORY.md index 6d51c48..3f5ca54 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -30,6 +30,7 @@ - 2026-08-21: `/admin` now keeps a server-memory `HttpOnly` cookie session across page refreshes instead of retaining an admin password in the browser. Its authenticated WebSocket sends a refresh signal every 25 seconds; this needs the cwshed Nginx `/api/` Upgrade proxy settings. - 2026-08-21: `img.nyan404.ru` is only the image-host viewer/frontend; Belki uploads must use the image-host API `https://nyan.nyan404.ru`. The API rejects the default Python `urllib` user agent, so `ImageHostClient` identifies requests as `BelkiCalculator/1.0`. Upload failures are converted to actionable API errors rather than a generic calculator 500. - 2026-08-21: Belki Python base image `reg.nyan404.ru/cwshed-clone/belki-base:py312-d6c42c4497ce` pins `pip==26.2.1`; CI upgrades to the same version before installing requirements. +- 2026-08-25: Belki fixes: natural bulk parsing now extracts `Имя ID` and `Имя [ID]` before a `HH:MM-HH:MM` range; web quick input is coaching-only; inspection resources use `+N название`; reports decline `раз/раза`; VK image mirroring defaults to `https://nyan.nyan404.ru`; `/belki` has a standalone goal calculator backed by `mode=goal`. # 2026-08-16 — несколько котят в прокачке `CoachingSession.extra_kittens` теперь влияет на баллы сопровождающего через количество подопечных: 1-й ×1, 2-й ×1,5, каждый последующий ×1,15 (коэффициенты перемножаются), вместо сложения полной прибыли. Базовый коэффициент самостоятельности основного котёнка сохраняется. Веб-форма отправляет список `extra_kittens`; VK принимает `доп. котята: ...` в pipe-команде. diff --git a/structure_and_data.md b/structure_and_data.md index ed3ceff..05fe76c 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -29,7 +29,7 @@ - Character name/ID pairs are persisted automatically in the SQLite file from `BELKI_IDENTITIES_DB` (default `data/belki.sqlite3`); the database is local runtime data and ignored by Git. - The VK dialog onboards each author once, stores their profile by `from_id`, greets them by name, and keeps the profile in the same SQLite database across bot restarts. - Every confirmed calculation is persisted by `app/belki/history.py` to PostgreSQL from `BELKI_DATABASE_URL`; SQLite is only a local fallback. Records include actor, source, mode, input, result, rendered message, and timestamp. -- VK photo attachments received during an active dialog are normalized into `input.attachments` and persisted with the calculation; active reports attach photos immediately and deduplicate repeated VK events. `/admin` renders all thumbnails in a wrapped gallery. With `BELKI_IMAGE_HOST_API_URL`, the bot mirrors each photo through image-hosting-web and stores `mirror_url`; Google Sheets export remains deferred. +- VK photo attachments received during an active dialog are normalized into `input.attachments` and persisted with the calculation; active reports attach photos immediately and deduplicate repeated VK events. `/admin` renders all thumbnails in a wrapped gallery. The bot mirrors each photo through image-hosting-web (default API `https://nyan.nyan404.ru`, overridable with `BELKI_IMAGE_HOST_API_URL`) and stores `mirror_url`; Google Sheets export remains deferred. - `/admin` and `/api/admin/calculations` expose the calculation history for review. The table shows both the reporting cat (escort) and kitten; default sorting is by the reporting cat, with optional kitten sorting. The API requires `X-Admin-Password` matching `BELKI_ADMIN_PASSWORD`; the web page supports deleting individual records through authenticated `DELETE /api/admin/calculations/{id}`, with confirmation in the UI. - `/admin` exchanges `BELKI_ADMIN_PASSWORD` for a server-memory `HttpOnly`, `SameSite=Lax` session cookie. The page restores that session after a refresh; it does not persist the password in browser storage. Authenticated browsers connect to `/api/admin/updates` over WebSocket and receive a `refresh` event every 25 seconds, which reloads report and application data. The cwshed Nginx `/api/` proxy upgrades WebSocket connections. - Applications are stored independently of calculation history by `app/belki/applications.py`: `belki_applications` in PostgreSQL and `applications` in SQLite. The “Заявки” tab within `/belki` and `/applications` are public and use the upload endpoint; `/api/applications` creates web applications, while `/api/admin/applications` lists them and `PATCH /api/admin/applications/{id}/accept` accepts one. @@ -57,6 +57,7 @@ - 2026-08-17: web-selected screenshots are sent through `/api/web/upload` to `BELKI_IMAGE_HOST_API_URL` (production API `https://nyan.nyan404.ru`, viewer `https://img.nyan404.ru`) and persisted as report attachments. The image-host API requires an explicit Belki `User-Agent`; the default Python `urllib` header is rejected with HTTP 403. - 2026-08-21: added structured community applications for feathers, kitten, flying-squirrel, and curator roles across VK, `/applications`, and the top-level `/admin` "Заявки" tab; acceptance is a status transition, not a generated forum post. - 2026-08-21: added a disabled durable Google Sheets export outbox for application-created and application-accepted events; no external request is attempted until an approved Apps Script URL and `BELKI_GOOGLE_EXPORT_ENABLED=1` are configured. +- 2026-08-25: fixed separator-free bulk parsing around time ranges, scoped web quick input to coaching, changed web inspection resources to `+N name`, corrected Russian inspection-count grammar, enabled VK image mirroring fallback, and added the standalone goal calculator mode/API. # Обновление 2026-08-16: несколько котят Калькулятор прокачки принимает `extra_kittens` из веб-формы, API и VK-команды. Общая выплата сопровождающему не суммирует полную ставку на каждого котёнка: первый подопечный использует базовый коэффициент, второй — множитель 1,5, каждый следующий — дополнительный множитель 1,15. Сайт добавляет строки дополнительных котят динамически; VK поддерживает сегмент `доп. котята: Имя [ID], Имя2 [ID]`.