From 7018bc039824ebdd12a4d8a73fc0afcaa09cd22f Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Tue, 25 Aug 2026 21:33:25 +0300 Subject: [PATCH] feat: add sudoku install guidance --- README.md | 2 ++ structure_and_data.md | 1 + web/sudoku.html | 17 +++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8dfc456..1e37361 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ python3 -m app.belki.vk_bot Во время игры мобильный экран не прокручивается: поле, цифровая клавиатура и нижние действия остаются в пределах viewport с учётом safe-area. Страница содержит web app manifest и service worker, поэтому `/sudoku` можно установить как standalone-приложение; сохранение партий по-прежнему требует соединения с сервером. +Кнопка «Установить» запускает системный install prompt в поддерживающих Android-браузерах. На iPhone и iPad она показывает шаги Safari: «Поделиться» → «На экран Домой» → «Добавить»; это требуется потому, что iOS не предоставляет браузерный install prompt. + Сложность задаётся рангом логических техник генератора `dokusan`: лёгкая использует в основном одиночные кандидаты, а сложные уровни допускают более сложные техники. Ответ хранится только на сервере, поэтому клиент не может получить решение через API. Для генерации используется `dokusan==0.1.0` под GNU GPL-3.0-only. Это осознанно вводит GPL-3.0-only зависимость в распространяемый образ; подробная оговорка и ссылка на исходники приведены в [`NOTICE`](./NOTICE). Последний релиз пакета датирован 2023 годом и имеет статус Alpha, поэтому при обновлении Python или сборочного образа его нужно отдельно перепроверить. diff --git a/structure_and_data.md b/structure_and_data.md index be96801..6235be6 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -48,6 +48,7 @@ ## Change Log - 2026-08-25: made the active `/sudoku` game screen viewport-bound on phones. The board and keypad scale to the available dynamic viewport; the save/new/user actions are fixed above the safe area, avoiding vertical document scrolling. Added `sudoku.webmanifest` and `sudoku-sw.js` for standalone installation, with network-first navigation so deploys do not become stuck on a cached shell. +- 2026-08-25: added an in-app `/sudoku` install action. Android uses a saved `beforeinstallprompt` event after a tap; iOS/iPadOS displays explicit Safari add-to-home-screen instructions because that event is not supported there. - 2026-08-25: added `/sudoku`: a standalone mobile-first game with nickname-based cross-device resume, server-side answer keys, automatic save, new-board generation, and four ranked difficulty presets. `app/sudoku.py` stores `sudoku_games` in the same production PostgreSQL database as Belki, or `SUDOKU_DB` SQLite locally. The API returns no solution data; it validates clues and Sudoku constraints before saving. - 2026-08-25: added `/sudoku` and `/sudoku/` gateway proxies in `nginx.conf`; publishing them requires rebuilding the immutable `Dockerfile.gateway-base` image and updating `Dockerfile.gateway` to its resulting tag before CI/deployment. - 2026-08-25: added `dokusan==0.1.0` as the explicitly selected Sudoku generator/solver. It is GPL-3.0-only and Alpha/last released in 2023; the image's distribution obligations and upstream source are recorded in `NOTICE` and `README.md`. The lifecycle check found the pinned PyPI release available; that is not a security assessment. diff --git a/web/sudoku.html b/web/sudoku.html index 89b6aab..01ce6ea 100644 --- a/web/sudoku.html +++ b/web/sudoku.html @@ -15,7 +15,7 @@ button,input,select { font:inherit; } button { cursor:pointer; touch-action:manipulation; } button:focus-visible,input:focus-visible,select:focus-visible { outline:3px solid #176b69; outline-offset:3px; } .skip { position:absolute; left:12px; top:-80px; z-index:10; background:var(--ink); color:white; padding:10px; } .skip:focus { top:12px; } main { width:min(100%, 1060px); margin:0 auto; padding:24px 16px calc(32px + env(safe-area-inset-bottom)); } - .masthead { display:flex; justify-content:space-between; align-items:baseline; gap:16px; border-bottom:2px solid var(--ink); padding-bottom:16px; margin-bottom:28px; } h1 { font-family:Georgia,serif; font-size:clamp(2.25rem,7vw,4.5rem); letter-spacing:-.055em; margin:0; line-height:.9; } .masthead p { margin:0; color:var(--muted); font-size:.95rem; } + .masthead { display:flex; justify-content:space-between; align-items:baseline; gap:16px; border-bottom:2px solid var(--ink); padding-bottom:16px; margin-bottom:28px; } h1 { font-family:Georgia,serif; font-size:clamp(2.25rem,7vw,4.5rem); letter-spacing:-.055em; margin:0; line-height:.9; } .masthead p { margin:0; color:var(--muted); font-size:.95rem; } .masthead-tools { display:flex; align-items:center; gap:12px; } .install-button { min-height:44px; border:1px solid var(--line); border-radius:8px; padding:8px 12px; background:var(--surface); color:var(--ink); font-size:.9rem; font-weight:750; } .intro, .game { max-width:900px; margin:auto; } .intro { display:grid; gap:24px; grid-template-columns:minmax(0,1.1fr) minmax(280px,.9fr); align-items:start; } .intro-copy { padding-top:12px; } h2 { font-size:1.3rem; margin:0 0 8px; } p { line-height:1.5; } .quiet { color:var(--muted); } .panel { background:var(--surface); border:1px solid var(--soft); border-radius:var(--radius); padding:20px; box-shadow:0 8px 22px rgba(31,38,33,.08); } label { font-weight:700; display:block; margin-bottom:8px; } input,select { width:100%; min-height:48px; border:1px solid var(--line); border-radius:8px; background:white; color:var(--ink); padding:10px 12px; font-size:16px; } .hint { font-size:.9rem; margin:8px 0 0; color:var(--muted); } .button { min-height:48px; border:0; border-radius:8px; padding:10px 16px; font-weight:750; background:var(--ink); color:#fff; transition:background 150ms ease-out,transform 150ms ease-out; } .button:hover { background:#3f4741; } .button:active { transform:translateY(1px); } .button.secondary { color:var(--ink); background:transparent; border:1px solid var(--line); } .button.accent { background:var(--accent); color:var(--accent-ink); } .button[disabled] { opacity:.55; cursor:wait; } .panel .button { margin-top:18px; width:100%; } @@ -23,15 +23,15 @@ .board { display:grid; grid-template-columns:repeat(9,1fr); aspect-ratio:1; border:2px solid var(--ink); background:var(--ink); gap:1px; } .cell { min-width:0; border:0; background:var(--surface); color:var(--ink); font-size:clamp(1.1rem,4.5vw,2rem); font-weight:600; } .cell.given { background:#e6eae3; font-weight:800; } .cell.selected { background:#f8d9ab; } .cell.related { background:#eff1ec; } .cell.conflict { background:#f3c6bf; color:#6f251d; } .cell:nth-child(3n):not(:nth-child(9n)) { border-right:2px solid var(--ink); } .cell:nth-child(n+19):nth-child(-n+27),.cell:nth-child(n+46):nth-child(-n+54) { border-bottom:2px solid var(--ink); } .numpad { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-top:16px; } .number { min-height:48px; border:1px solid var(--line); border-radius:8px; background:var(--surface); font-weight:800; font-size:1.08rem; } .number:hover { background:#e6eae3; } .number.erase { grid-column:span 2; font-size:.9rem; } .side { display:grid; gap:12px; } .side .button { width:100%; } .status { min-height:24px; margin:12px 0 0; color:var(--muted); font-size:.92rem; } .status.error { color:var(--danger); font-weight:700; } .status.done { color:#176b69; font-weight:700; } .how { border-top:1px solid var(--soft); padding-top:16px; font-size:.92rem; } - .hidden { display:none; } @media (max-width:720px) { main { padding-top:16px; } .masthead { margin-bottom:20px; } .intro,.game { grid-template-columns:1fr; } .game { gap:16px; } .side { grid-template-columns:1fr 1fr; } .side .how { grid-column:1/-1; } .board { max-width:600px; margin:auto; } - body.playing { height:100dvh; overflow:hidden; } body.playing main { height:100dvh; padding:8px 12px; display:grid; grid-template-rows:auto minmax(0,1fr); } body.playing .masthead { padding-bottom:8px; margin-bottom:8px; } body.playing h1 { font-size:clamp(2rem,10vw,2.7rem); } body.playing .masthead p { max-width:15ch; font-size:.78rem; text-align:right; } body.playing .game { display:block; min-height:0; margin:0; } body.playing .game > .panel { height:100%; padding:0; border:0; box-shadow:none; background:transparent; display:flex; flex-direction:column; } body.playing .game-top { flex:0 0 auto; margin:0 0 8px; } body.playing .board { width:min(100%, calc(100dvh - 430px)); max-width:none; flex:0 0 auto; margin:0 auto; } body.playing .numpad { flex:0 0 auto; margin-top:10px; } body.playing .number { min-height:44px; } body.playing .status { margin:8px 0 0; min-height:20px; font-size:.83rem; } body.playing .side { position:fixed; z-index:10; left:0; right:0; bottom:0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:8px 12px calc(8px + env(safe-area-inset-bottom)); background:var(--paper); border-top:1px solid var(--soft); } body.playing .side label,body.playing .side .how { display:none; } body.playing .side .button { min-height:48px; padding:8px; font-size:.82rem; } } + dialog { width:min(calc(100% - 32px),420px); border:0; border-radius:var(--radius); padding:24px; color:var(--ink); background:var(--surface); box-shadow:0 20px 60px rgba(31,38,33,.25); } dialog::backdrop { background:rgba(31,38,33,.42); } dialog h2 { margin-bottom:14px; } dialog p { margin:0 0 16px; } dialog .button { width:100%; } .hidden { display:none; } @media (max-width:720px) { main { padding-top:16px; } .masthead { margin-bottom:20px; } .intro,.game { grid-template-columns:1fr; } .game { gap:16px; } .side { grid-template-columns:1fr 1fr; } .side .how { grid-column:1/-1; } .board { max-width:600px; margin:auto; } + body.playing { height:100dvh; overflow:hidden; } body.playing main { height:100dvh; padding:8px 12px; display:grid; grid-template-rows:auto minmax(0,1fr); } body.playing .masthead { padding-bottom:8px; margin-bottom:8px; } body.playing h1 { font-size:clamp(2rem,10vw,2.7rem); } body.playing .masthead p { max-width:15ch; font-size:.78rem; text-align:right; } body.playing .install-button { display:none; } body.playing .game { display:block; min-height:0; margin:0; } body.playing .game > .panel { height:100%; padding:0; border:0; box-shadow:none; background:transparent; display:flex; flex-direction:column; } body.playing .game-top { flex:0 0 auto; margin:0 0 8px; } body.playing .board { width:min(100%, calc(100dvh - 430px)); max-width:none; flex:0 0 auto; margin:0 auto; } body.playing .numpad { flex:0 0 auto; margin-top:10px; } body.playing .number { min-height:44px; } body.playing .status { margin:8px 0 0; min-height:20px; font-size:.83rem; } body.playing .side { position:fixed; z-index:10; left:0; right:0; bottom:0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; padding:8px 12px calc(8px + env(safe-area-inset-bottom)); background:var(--paper); border-top:1px solid var(--soft); } body.playing .side label,body.playing .side .how { display:none; } body.playing .side .button { min-height:48px; padding:8px; font-size:.82rem; } } @media (prefers-reduced-motion:reduce) { *,*:before,*:after { transition:none!important; } }
-

Судоку

Партии сохраняются по нику.

+

Судоку

Партии сохраняются по нику.

Поле 9×9

Введите один и тот же ник на телефоне, планшете или компьютере. Если есть незавершённая партия, она откроется автоматически.

Ник нужен только для поиска игры, это не пароль. Не используйте личные данные.

2–32 символа, без пробелов.

@@ -41,11 +41,14 @@
+ +

Установить Судоку

На iPhone или iPad откройте это окно в Safari, нажмите «Поделиться», затем «На экран Домой» и «Добавить».

На Android откройте меню браузера ⋮ и выберите «Установить приложение» или «Добавить на главный экран».

+