fix: use /trainer as the public trainer route
This commit is contained in:
1 parent
74c8504d52
commit
d182cd30fa
12 files changed
+21
-14
No files matched your search
@@ -33,7 +33,7 @@
|
|||||||
- Public report lookup is `GET /api/reports?character_id=<cat ID>`; it searches saved report participant IDs, returns at most 100 newest rows without `actor_id`, and is covered by `tests/test_report_lookup.py`. VK `/мои-отчёты` uses the callback sender ID and the same history store; validate with `python -m unittest tests.test_report_lookup tests.test_history tests.test_vk_bot -q`.
|
- Public report lookup is `GET /api/reports?character_id=<cat ID>`; it searches saved report participant IDs, returns at most 100 newest rows without `actor_id`, and is covered by `tests/test_report_lookup.py`. VK `/мои-отчёты` uses the callback sender ID and the same history store; validate with `python -m unittest tests.test_report_lookup tests.test_history tests.test_vk_bot -q`.
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
- LU trainer is implemented at `/lu-trainer` and `/lu-trainer/` through both Python and Nginx. `web/lu-trainer/engine.js` is DOM-free; UI consumes public snapshots without hidden hazards/values. Keep notes separate from facts, map selection separate from jumping, eight-neighbor availability relative to any opened cell, and transition cells outside victory counts. Preserve documented training formulas; do not claim they are verified CatWar rules. Original art provenance is in `web/lu-trainer/assets/README.md`.
|
- LU trainer is implemented at `/trainer` and `/trainer/` through both Python and Nginx. `web/lu-trainer/engine.js` is DOM-free; UI consumes public snapshots without hidden hazards/values. Keep notes separate from facts, map selection separate from jumping, eight-neighbor availability relative to any opened cell, and transition cells outside victory counts. Preserve documented training formulas; do not claim they are verified CatWar rules. Original art provenance is in `web/lu-trainer/assets/README.md`.
|
||||||
- LU checks (prefer remote test-zone MCP when exposed): Node 24 `node --test tests/lu-trainer/engine.test.mjs`; isolated Python `python -m unittest tests.test_lu_trainer tests.test_calculator_web -q`; `node --check web/lu-trainer/ui.js`; `node tests/browser/lu-trainer.cjs` with the same bundled Playwright, loopback server and temporary stores as the calculator suite. No npm install or runtime dependency is needed. Browser coverage includes 1920/1366/768/390 widths, mouse/touch/keyboard, map projection, clear/restart confirmation, result locks, hints/timers, 200% layout and failed images. Inspect screenshots outside Git. Nginx aliases must serve the same HTML and correct asset MIME types; do not deploy to validate a client-only change.
|
- LU checks (prefer remote test-zone MCP when exposed): Node 24 `node --test tests/lu-trainer/engine.test.mjs`; isolated Python `python -m unittest tests.test_lu_trainer tests.test_calculator_web -q`; `node --check web/lu-trainer/ui.js`; `node tests/browser/lu-trainer.cjs` with the same bundled Playwright, loopback server and temporary stores as the calculator suite. No npm install or runtime dependency is needed. Browser coverage includes 1920/1366/768/390 widths, mouse/touch/keyboard, map projection, clear/restart confirmation, result locks, hints/timers, 200% layout and failed images. Inspect screenshots outside Git. Nginx aliases must serve the same HTML and correct asset MIME types; do not deploy to validate a client-only change.
|
||||||
- `app/belki/weather.py` reads only the fixed public ULLI raw METAR endpoint (3-second timeout, 64 KiB bound, 5-minute process cache, 1-minute failure cache). `/api/weather/ulli` exposes only decoration settings; shared CSS/JS live at `/api/weather/effect.css` and `/api/weather/effect.js` so the existing gateway `/api/` route handles them. Keep weather independent of reports/storage, skip trend/remark/vicinity groups, reject observations older than 2 hours, and retain leaves on failure. Do not disable TLS verification.
|
- `app/belki/weather.py` reads only the fixed public ULLI raw METAR endpoint (3-second timeout, 64 KiB bound, 5-minute process cache, 1-minute failure cache). `/api/weather/ulli` exposes only decoration settings; shared CSS/JS live at `/api/weather/effect.css` and `/api/weather/effect.js` so the existing gateway `/api/` route handles them. Keep weather independent of reports/storage, skip trend/remark/vicinity groups, reject observations older than 2 hours, and retain leaves on failure. Do not disable TLS verification.
|
||||||
- VK scheduler lives in `app/belki/vk_scheduler.py`; use `BELKI_DATABASE_URL` in production and `BELKI_HISTORY_DB` for local SQLite checks. Keep mailing disabled until an administrator explicitly enables a conversation and schedule.
|
- VK scheduler lives in `app/belki/vk_scheduler.py`; use `BELKI_DATABASE_URL` in production and `BELKI_HISTORY_DB` for local SQLite checks. Keep mailing disabled until an administrator explicitly enables a conversation and schedule.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Дата: 2026-11-17. Статус: первая версия реализована по последующему запросу владельца «Реализуй LU_TRAINER_PROJECT.md». Публикация и развёртывание не выполнялись.
|
Дата: 2026-11-17. Статус: первая версия реализована по последующему запросу владельца «Реализуй LU_TRAINER_PROJECT.md». Публикация и развёртывание не выполнялись.
|
||||||
|
|
||||||
Текущая реализация: `/lu-trainer` и `/lu-trainer/`, файлы из таблицы ниже, оригинальные изображения с происхождением в `web/lu-trainer/assets/README.md`. Поддерживаются параметры, прыжки, подсказки, победа/падение, синхронная карта заметок, история и адаптивное управление. Проверки и их границы записаны в `structure_and_data.md`. Подробный текст ниже сохраняет основания первоначального проекта; историческое ограничение «только документация» относилось к предыдущему этапу.
|
Текущая реализация: `/trainer` и `/trainer/`, файлы из таблицы ниже, оригинальные изображения с происхождением в `web/lu-trainer/assets/README.md`. Поддерживаются параметры, прыжки, подсказки, победа/падение, синхронная карта заметок, история и адаптивное управление. Проверки и их границы записаны в `structure_and_data.md`. Подробный текст ниже сохраняет основания первоначального проекта; историческое ограничение «только документация» относилось к предыдущему этапу.
|
||||||
|
|
||||||
## Цель и подтверждённый объём
|
## Цель и подтверждённый объём
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
## Предлагаемое устройство реализации
|
## Предлагаемое устройство реализации
|
||||||
|
|
||||||
В текущем репозитории реализована самостоятельная клиентская страница без новых runtime-зависимостей и БД. Реализованные публичные пути — `/lu-trainer` и `/lu-trainer/`. Файлы первой версии:
|
В текущем репозитории реализована самостоятельная клиентская страница без новых runtime-зависимостей и БД. Реализованные публичные пути — `/trainer` и `/trainer/`. Файлы первой версии:
|
||||||
|
|
||||||
| Файл/область | Назначение |
|
| Файл/область | Назначение |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# MEMORY
|
# MEMORY
|
||||||
|
|
||||||
|
- 2026-11-17: owner renamed the trainer public page to `/trainer` (also `/trainer/`). Homepage navigation, Python/Nginx page aliases and browser entry URLs follow that address. Internal `web/lu-trainer.html` and `/lu-trainer/` asset URLs are unchanged; the prior `/lu-trainer` page address below is historical. No push/deployment.
|
||||||
|
|
||||||
- 2026-11-17: implemented the owner-requested LU trainer at `/lu-trainer` and `/lu-trainer/`. The DOM-free original JS engine preserves the documented upstream training model (not verified CatWar rules); both grids consume snapshots without hidden hazards, with temporary hints disclosed only as action results. One in-memory attempt, separate notes, confirmed resets, terminal action locks and no CatWar account/report integration. Original imagegen forest/cat provenance is in `web/lu-trainer/assets/README.md`. No new runtime dependency. Local Node/Python/Chromium and isolated Nginx checks are recorded in `structure_and_data.md`; no registry push or deployment.
|
- 2026-11-17: implemented the owner-requested LU trainer at `/lu-trainer` and `/lu-trainer/`. The DOM-free original JS engine preserves the documented upstream training model (not verified CatWar rules); both grids consume snapshots without hidden hazards, with temporary hints disclosed only as action results. One in-memory attempt, separate notes, confirmed resets, terminal action locks and no CatWar account/report integration. Original imagegen forest/cat provenance is in `web/lu-trainer/assets/README.md`. No new runtime dependency. Local Node/Python/Chromium and isolated Nginx checks are recorded in `structure_and_data.md`; no registry push or deployment.
|
||||||
|
|
||||||
- 2026-11-17: the owner-provided community chat link is maintained in `web/index.html` beside VK: `https://matrix.to/#/!hQAD8j0wKv51OhvyeAPqRBNyBzvzoZsqBIWYR_OgNxw?via=nyan404.ru`. Preserve both the room ID and `via` parameter when editing it.
|
- 2026-11-17: the owner-provided community chat link is maintained in `web/index.html` beside VK: `https://matrix.to/#/!hQAD8j0wKv51OhvyeAPqRBNyBzvzoZsqBIWYR_OgNxw?via=nyan404.ru`. Preserve both the room ID and `via` parameter when editing it.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Генератор отчётов и калькулятор
|
# Генератор отчётов и калькулятор
|
||||||
|
|
||||||
Тренажёр ЛУ «Лесные уступы» доступен по `/lu-trainer` и `/lu-trainer/`: игровая локация, персонаж, журнал и карта «Минное поле». Подробности модели и границы проверки — в [LU_TRAINER_PROJECT.md](./LU_TRAINER_PROJECT.md).
|
Тренажёр ЛУ «Лесные уступы» доступен по `/trainer` и `/trainer/`: игровая локация, персонаж, журнал и карта «Минное поле». Подробности модели и границы проверки — в [LU_TRAINER_PROJECT.md](./LU_TRAINER_PROJECT.md).
|
||||||
|
|
||||||
Отдельный калькулятор для отчётов по прокачке ЛУ/ЗУ, тренировкам и осмотрам. Старые CatWar userscript-файлы остаются в `web/` и продолжают раздаваться по своим URL.
|
Отдельный калькулятор для отчётов по прокачке ЛУ/ЗУ, тренировкам и осмотрам. Старые CatWar userscript-файлы остаются в `web/` и продолжают раздаваться по своим URL.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -417,7 +417,7 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
if path in ("/sudoku", "/sudoku/"):
|
if path in ("/sudoku", "/sudoku/"):
|
||||||
self._file(WEB_ROOT / "sudoku.html")
|
self._file(WEB_ROOT / "sudoku.html")
|
||||||
return
|
return
|
||||||
if path in ("/lu-trainer", "/lu-trainer/"):
|
if path in ("/trainer", "/trainer/"):
|
||||||
self._file(WEB_ROOT / "lu-trainer.html")
|
self._file(WEB_ROOT / "lu-trainer.html")
|
||||||
return
|
return
|
||||||
if path == "/api/reports":
|
if path == "/api/reports":
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Authorization: the owner requested implementation of root `LU_TRAINER_PROJECT.md` on 2026-11-17. That existing design is the approved specification; this file records implementation choices within its scope.
|
Authorization: the owner requested implementation of root `LU_TRAINER_PROJECT.md` on 2026-11-17. That existing design is the approved specification; this file records implementation choices within its scope.
|
||||||
|
|
||||||
contract: standalone `/lu-trainer` and `/lu-trainer/`, shared HTML/CSS/ES-module assets served by Python and Nginx. No new runtime dependency or storage. Gateway serves the page with `try_files`; assets use the existing static serving.
|
contract: standalone `/trainer` and `/trainer/`, shared HTML/CSS/ES-module assets served by Python and Nginx. No new runtime dependency or storage. Gateway serves the page with `try_files`; assets use the existing static serving.
|
||||||
convention: native buttons/radios/dialogs, CSS tokens, Verdana/Georgia, Russian copy, DOM-independent ES-module engine, no upstream code or asset copying.
|
convention: native buttons/radios/dialogs, CSS tokens, Verdana/Georgia, Russian copy, DOM-independent ES-module engine, no upstream code or asset copying.
|
||||||
state: engine owns 60 cells, hazards, opened set, marks set, last successful position, ready/playing/won/lost status and action log. A public snapshot omits hidden hazards/values. UI owns selection, action mode, map visibility and mark projection.
|
state: engine owns 60 cells, hazards, opened set, marks set, last successful position, ready/playing/won/lost status and action log. A public snapshot omits hidden hazards/values. UI owns selection, action mode, map visibility and mark projection.
|
||||||
invariant: 6x10, entrance (5,0), exit (3,9); transition cells do not count toward victory and cannot be opened/marked. Top-row first 5/3 cells are safe and initially available; any other cell requires an opened neighbor. Eight-neighbor counts; safe path connects entrance, base and exit. Preserve documented hazard formula and 0/10/20/30% hint probabilities. Win by all non-transition safe cells or all and only hazards marked; loss ends actions. Repeat safe visits produce feedback and may hint. The character tracks the last successful non-transition visit.
|
invariant: 6x10, entrance (5,0), exit (3,9); transition cells do not count toward victory and cannot be opened/marked. Top-row first 5/3 cells are safe and initially available; any other cell requires an opened neighbor. Eight-neighbor counts; safe path connects entrance, base and exit. Preserve documented hazard formula and 0/10/20/30% hint probabilities. Win by all non-transition safe cells or all and only hazards marked; loss ends actions. Repeat safe visits produce feedback and may hint. The character tracks the last successful non-transition visit.
|
||||||
|
|||||||
+2
-2
@@ -50,11 +50,11 @@ http {
|
|||||||
|
|
||||||
# The trainer is entirely client-side; serve both aliases without
|
# The trainer is entirely client-side; serve both aliases without
|
||||||
# a redirect to the asset directory or a dependency on Belki's API.
|
# a redirect to the asset directory or a dependency on Belki's API.
|
||||||
location = /lu-trainer {
|
location = /trainer {
|
||||||
try_files /lu-trainer.html =404;
|
try_files /lu-trainer.html =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /lu-trainer/ {
|
location = /trainer/ {
|
||||||
try_files /lu-trainer.html =404;
|
try_files /lu-trainer.html =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ mindmap
|
|||||||
ui.js — public snapshots and two grids
|
ui.js — public snapshots and two grids
|
||||||
Original generated forest and cat assets
|
Original generated forest and cat assets
|
||||||
No persistence or CatWar account access
|
No persistence or CatWar account access
|
||||||
/lu-trainer and /lu-trainer/ via Python and Nginx
|
/trainer and /trainer/ via Python and Nginx
|
||||||
Node engine and Playwright acceptance
|
Node engine and Playwright acceptance
|
||||||
Belki
|
Belki
|
||||||
Domain
|
Domain
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Structure and Data
|
# Structure and Data
|
||||||
|
|
||||||
|
## Trainer public route — 2026-11-17
|
||||||
|
|
||||||
|
- Owner requested `/trainer` instead of `/lu-trainer`. Python and Nginx now expose `/trainer` and `/trainer/`; the homepage link and browser entry URLs use `/trainer`. Internal `web/lu-trainer.html` and `/lu-trainer/` asset URLs are retained. No game mechanics, runtime dependencies or deployment changes.
|
||||||
|
- Validation passed: 3 targeted Python routing/asset tests, Nginx syntax check, JS test-script syntax and diff checks, plus Chromium navigation from the homepage to `/trainer`, one rendered jump and the `/trainer/` alias. The gameplay suite changed only its entry URLs. Remote test-zone/token-optimizer MCP remain unavailable. Temporary venv/data and Nginx container/image were removed after verification. No push or deployment.
|
||||||
|
|
||||||
## LU trainer implementation — 2026-11-17
|
## LU trainer implementation — 2026-11-17
|
||||||
|
|
||||||
- Implemented root `LU_TRAINER_PROJECT.md` after the owner's follow-up request to implement it. `/lu-trainer`, `/lu-trainer/` and `/lu-trainer.html` serve the same standalone page. Python aliases are explicit in `app/main.py`; Nginx aliases use `try_files /lu-trainer.html`. `Dockerfile` and `Dockerfile.gateway` already copy all `web/`; the gateway release Dockerfile also copies `nginx.conf`. Production images, cluster manifests and registry state were not changed. Existing gateway base publishing requirements still apply before a release.
|
- Implemented root `LU_TRAINER_PROJECT.md` after the owner's follow-up request to implement it. `/lu-trainer`, `/lu-trainer/` and `/lu-trainer.html` serve the same standalone page. Python aliases are explicit in `app/main.py`; Nginx aliases use `try_files /lu-trainer.html`. `Dockerfile` and `Dockerfile.gateway` already copy all `web/`; the gateway release Dockerfile also copies `nginx.conf`. Production images, cluster manifests and registry state were not changed. Existing gateway base publishing requirements still apply before a release.
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async function run() {
|
|||||||
const page = await context.newPage(), errors = [];
|
const page = await context.newPage(), errors = [];
|
||||||
page.on('pageerror',error => errors.push(error.message));
|
page.on('pageerror',error => errors.push(error.message));
|
||||||
page.on('console',message => { if (message.type() === 'error') errors.push(message.text()); });
|
page.on('console',message => { if (message.type() === 'error') errors.push(message.text()); });
|
||||||
await page.goto(`${origin}/lu-trainer${width === 768 ? '/' : ''}`);
|
await page.goto(`${origin}/trainer${width === 768 ? '/' : ''}`);
|
||||||
await page.locator('#scene-grid button').last().waitFor();
|
await page.locator('#scene-grid button').last().waitFor();
|
||||||
assert.equal(await page.title(),'Тренажёр ЛУ — Лесные уступы');
|
assert.equal(await page.title(),'Тренажёр ЛУ — Лесные уступы');
|
||||||
assert.equal(await page.locator('#scene-grid button').count(),60);
|
assert.equal(await page.locator('#scene-grid button').count(),60);
|
||||||
@@ -122,7 +122,7 @@ async function run() {
|
|||||||
try {
|
try {
|
||||||
await context.addInitScript(() => { let seed=19; Math.random=()=>{seed=(Math.imul(seed,1664525)+1013904223)>>>0;return seed/2**32;}; });
|
await context.addInitScript(() => { let seed=19; Math.random=()=>{seed=(Math.imul(seed,1664525)+1013904223)>>>0;return seed/2**32;}; });
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
await page.goto(`${origin}/lu-trainer`);
|
await page.goto(`${origin}/trainer`);
|
||||||
await page.locator('#scene-grid button').last().waitFor();
|
await page.locator('#scene-grid button').last().waitFor();
|
||||||
const cell = id=>page.locator(`#scene-grid button[data-id="${id}"]`);
|
const cell = id=>page.locator(`#scene-grid button[data-id="${id}"]`);
|
||||||
// Open safe reachable cells until a known adjacent hazard can be reached.
|
// Open safe reachable cells until a known adjacent hazard can be reached.
|
||||||
@@ -192,7 +192,7 @@ async function run() {
|
|||||||
try {
|
try {
|
||||||
const page = await broken.newPage();
|
const page = await broken.newPage();
|
||||||
await page.route('**/lu-trainer/assets/*',route=>route.abort());
|
await page.route('**/lu-trainer/assets/*',route=>route.abort());
|
||||||
await page.goto(`${origin}/lu-trainer`);
|
await page.goto(`${origin}/trainer`);
|
||||||
await page.locator('#scene-grid button').last().waitFor();
|
await page.locator('#scene-grid button').last().waitFor();
|
||||||
assert(await page.locator('.forest').isHidden());
|
assert(await page.locator('.forest').isHidden());
|
||||||
assert(await page.locator('#character > span').isVisible());
|
assert(await page.locator('#character > span').isVisible());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class TrainerRoutesTests(unittest.TestCase):
|
|||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
def test_page_aliases_return_the_same_trainer(self):
|
def test_page_aliases_return_the_same_trainer(self):
|
||||||
pages = [self.get(path) for path in ['/lu-trainer', '/lu-trainer/', '/lu-trainer.html']]
|
pages = [self.get(path) for path in ['/trainer', '/trainer/', '/lu-trainer.html']]
|
||||||
for status, content_type, content in pages:
|
for status, content_type, content in pages:
|
||||||
self.assertEqual(status, 200)
|
self.assertEqual(status, 200)
|
||||||
self.assertEqual(content_type, 'text/html')
|
self.assertEqual(content_type, 'text/html')
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@
|
|||||||
<div class="links">
|
<div class="links">
|
||||||
<p><i class="fas fa-code emoji"></i><a href="https://git.nyan404.ru/nyan404/cwshed-clone" target="_blank">Исходный код проекта</a></p>
|
<p><i class="fas fa-code emoji"></i><a href="https://git.nyan404.ru/nyan404/cwshed-clone" target="_blank">Исходный код проекта</a></p>
|
||||||
<p><img class="brand-icon" src="/favicon.png" alt="" aria-hidden="true"><a href="https://cat.nyan404.ru/belki" target="_blank">Калькулятор «Беличья нора»</a></p>
|
<p><img class="brand-icon" src="/favicon.png" alt="" aria-hidden="true"><a href="https://cat.nyan404.ru/belki" target="_blank">Калькулятор «Беличья нора»</a></p>
|
||||||
<p><a href="/lu-trainer">Тренажёр ЛУ — Лесные уступы</a></p>
|
<p><a href="/trainer">Тренажёр ЛУ — Лесные уступы</a></p>
|
||||||
<p><i class="fas fa-vk emoji"></i><a href="https://vk.ru/club240886904" target="_blank">Беличья нора во VK</a></p>
|
<p><i class="fas fa-vk emoji"></i><a href="https://vk.ru/club240886904" target="_blank">Беличья нора во VK</a></p>
|
||||||
<p><i class="fas fa-comments emoji" aria-hidden="true"></i><a href="https://matrix.to/#/!hQAD8j0wKv51OhvyeAPqRBNyBzvzoZsqBIWYR_OgNxw?via=nyan404.ru" target="_blank" rel="noopener noreferrer">Наш чат в Matrix</a></p>
|
<p><i class="fas fa-comments emoji" aria-hidden="true"></i><a href="https://matrix.to/#/!hQAD8j0wKv51OhvyeAPqRBNyBzvzoZsqBIWYR_OgNxw?via=nyan404.ru" target="_blank" rel="noopener noreferrer">Наш чат в Matrix</a></p>
|
||||||
<div class="promo">
|
<div class="promo">
|
||||||
|
|||||||
Reference in new issue
Block a user