From 28afcff5516bc5ea41c19a31d7c1a7733cbf6fcb Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 14 Jul 2026 08:53:18 +0200 Subject: [PATCH 1/4] feat(ui): explicit offline state inside an online game (+ offline word check) When an online game loses the connection the game screen now says so and freezes instead of silently greying out: a "connection lost" banner appears and the rack, the move controls, the add-friend/block controls and the chat/dictionary entry all disable (a started move stays a draft, committed by the player on reconnect). It is driven off the net-state machine (netState.offline), so it also covers the Telegram/VK mini-apps, where a lost connection was previously mute in-game. If the player is already in the dictionary when the drop happens, the word check falls back to the game's pinned on-device dictionary (exact when that dawg is cached; "unavailable offline" otherwise) and the network-only complaint + external look-up hide. Chat, when already open, keeps its existing read-only degrade (send/nudge disable). New pure helper localWordCheck is unit-tested; the in-game gating gets an e2e. --- docs/ARCHITECTURE.md | 15 ++++++++--- docs/FUNCTIONAL.md | 15 ++++++++++- docs/FUNCTIONAL_ru.md | 13 ++++++++- ui/e2e/ingame-ux.spec.ts | 35 ++++++++++++++++++++++++ ui/src/game/CheckScreen.svelte | 31 ++++++++++++++++++--- ui/src/game/Game.svelte | 25 +++++++++++++++-- ui/src/game/Rack.svelte | 10 +++++++ ui/src/lib/dict/check.test.ts | 49 ++++++++++++++++++++++++++++++++++ ui/src/lib/dict/check.ts | 26 ++++++++++++++++++ ui/src/lib/i18n/en.ts | 2 ++ ui/src/lib/i18n/ru.ts | 2 ++ 11 files changed, 212 insertions(+), 11 deletions(-) create mode 100644 ui/src/lib/dict/check.test.ts create mode 100644 ui/src/lib/dict/check.ts diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 23c8f9c..610c987 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -118,10 +118,17 @@ dropped). Horizontal scaling is explicit future work. one whose response was lost — its button is disabled while offline and re-issued on reconnect). A reachability watcher (a lightweight `profile.get` probe; a session-less native guest reconciles a server guest instead — that reconcile IS the probe) drives recovery, and the live `Subscribe` stream's - drop/recovery feeds the same machine. **Telegram/VK are exempt** — always online: they are never fed an - offline signal, and `offlineMode.active` is additionally hard-gated on `offlineCapable()` (false in - those mini-apps), so nothing — not even a version lock — puts them in offline mode: no blue chrome, no - local lobby, no transport kill switch and no device-local create paths. + drop/recovery feeds the same machine. **Telegram/VK are exempt from the offline-*play* model** — + `offlineMode.active` is hard-gated on `offlineCapable()` (false in those mini-apps), so nothing — not + even a version lock — puts them in offline mode: no blue chrome, no local lobby, no transport kill + switch and no device-local create paths. The machine still tracks reachability there, though: a + connection lost **inside an online game** is surfaced on **every platform**, driven off the machine's + confirmed-offline state (`netState.offline`, not `offlineMode.active`) — the game screen shows a + *connection lost* banner and **freezes** the tray, the move controls, the add-friend/block controls and + the chat/dictionary entry (a started move stays a draft, re-committed by the player on reconnect), and + the word-check tool falls back to the game's pinned on-device dictionary (`ui/src/lib/dict/check.ts`, + exact when that dawg is cached, else *unavailable*) with its network-only complaint and external + look-up hidden. **Edge hardening:** every request body on the public listener is capped at `GATEWAY_MAX_BODY_BYTES` (default 1 MiB — far above any legitimate payload), both at the HTTP layer (`http.MaxBytesReader`) and as the Connect per-message read limit, so an oversized diff --git a/docs/FUNCTIONAL.md b/docs/FUNCTIONAL.md index 2f1a744..f5a7951 100644 --- a/docs/FUNCTIONAL.md +++ b/docs/FUNCTIONAL.md @@ -229,7 +229,10 @@ brief warm-up shows on the first open otherwise — and falls back to the server local dictionary is unavailable. The dictionary check tool is unlimited and offers a complaint on any result; for a word it finds, it also links out to an external reference dictionary (gramota.ru for Russian games, scrabblewordfinder.org for -English) to look it up. Hints are governed per game — +English) to look it up. While offline in an online game the check runs against the game's own +dictionary on the device — the same verdict as the server when that dictionary is available, +otherwise it reads *unavailable offline* — and the complaint and the external look-up, which both +need the network, are hidden. Hints are governed per game — whether they are allowed and how many each player starts with — and draw on a personal hint wallet once the per-game allowance is spent. Against the robot (**vs_ai**) hints are instead **unlimited and wallet-free**, but idle-gated as an @@ -322,6 +325,16 @@ offline on its own, and restoring the network returns it online by itself. There switch to remember: a brief drop is ridden out quietly and only a sustained loss turns the chrome offline, so you are never interrupted for a hiccup. +**Losing the connection while inside an online game** is surfaced on **every platform, including the +Telegram/VK mini-apps** — unlike the offline-play mode above, which is web/native only — because an +online game needs the server for every move. A slim *connection lost* banner appears at the top of the +board and the play area **freezes**: the rack, the move controls, the add-friend/block controls and the +chat/dictionary entry all disable, while a move you had started stays on the board as a draft. Nothing +is sent; when the connection returns the banner clears, the controls come back and you commit the move +yourself. If you were already in the chat or the dictionary when the drop happened you stay there — chat +becomes read-only (send and nudge disable) and the dictionary keeps checking words against the game's +on-device dictionary. + ### Staying up to date When a new client version is required, the app does not lock you out. On the **native** app a too-old build shows a notice with **Update** (opens the store) and **Play offline** (dismiss and keep diff --git a/docs/FUNCTIONAL_ru.md b/docs/FUNCTIONAL_ru.md index c4d7f4d..1d8cf7a 100644 --- a/docs/FUNCTIONAL_ru.md +++ b/docs/FUNCTIONAL_ru.md @@ -236,7 +236,9 @@ e-mail) либо ввод фразы. Активные игры форфейтя короткий прогрев, — и уходит на сервер, если локальный словарь недоступен. Инструмент проверки слова безлимитный и предлагает пожаловаться на любой результат; для найденного слова он также даёт ссылку на внешний справочный словарь (gramota.ru для русских игр, scrabblewordfinder.org для английских), -чтобы его посмотреть. Подсказки управляются настройками +чтобы его посмотреть. В офлайне в онлайн-партии проверка идёт по собственному словарю партии на +устройстве — тот же вердикт, что и на сервере, если этот словарь доступен, иначе показывается +*недоступно офлайн*, — а жалоба и внешняя ссылка, которым нужна сеть, скрываются. Подсказки управляются настройками партии — разрешены ли они и сколько их у каждого игрока на старте — и расходуют личный кошелёк подсказок после исчерпания внутриигрового лимита. Против робота (**vs_ai**) подсказки, наоборот, **безлимитны и без кошелька**, но с idle-гейтом как @@ -327,6 +329,15 @@ e-mail) либо ввод фразы. Активные игры форфейтя кратковременный сбой пережидается тихо, и только устойчивая потеря переводит интерфейс в офлайн, так что вас не прерывают из-за короткой икоты. +**Потеря связи внутри онлайн-партии** показывается на **всех платформах, включая мини-приложения +Telegram/VK** — в отличие от офлайн-режима игры выше, который только для веба и нативного приложения, — +потому что онлайн-партии сервер нужен на каждый ход. Сверху доски появляется тонкий баннер *связь +потеряна*, и игровая область **замораживается**: рэк, ходовые кнопки, кнопки «в друзья»/«заблокировать» +и вход в чат/словарь отключаются, а начатый ход остаётся на доске черновиком. Ничего не отправляется; +когда связь возвращается, баннер исчезает, кнопки оживают, и ход отправляешь ты сам. Если связь упала, +когда ты уже был в чате или словаре, ты там и остаёшься — чат становится «только для чтения» (отправка +и nudge отключаются), а словарь продолжает проверять слова по словарю партии на устройстве. + ### Актуальная версия Когда требуется новая версия клиента, приложение не блокирует вас наглухо. В **нативном** приложении слишком старая сборка показывает уведомление с **Обновить** (открывает магазин) и **Играть офлайн** diff --git a/ui/e2e/ingame-ux.spec.ts b/ui/e2e/ingame-ux.spec.ts index d91c073..85f005c 100644 --- a/ui/e2e/ingame-ux.spec.ts +++ b/ui/e2e/ingame-ux.spec.ts @@ -39,3 +39,38 @@ test('in-game UX: turn strip, bag badge + table footer, staged-play highlight an await expect(page.locator('.scorebadge')).toBeVisible(); await expect(page.locator('.make')).toBeVisible(); }); + +test('online game offline: banner shows, the tray and comms entry freeze, and it thaws on recovery', async ({ page }) => { + await page.goto('/'); + await page.getByRole('button', { name: /guest/i }).click(); + await page.getByRole('button', { name: /🎲/ }).click(); + await page.getByRole('button', { name: 'Random player' }).click(); + await page.locator('.variant').first().click(); + await page.getByRole('button', { name: /Start game/i }).click(); + await page.evaluate(() => (window as unknown as { __mock: { joinOpponent(): void } }).__mock.joinOpponent()); + await expect(page.getByText('Robo')).toBeVisible(); + + // Baseline online: no banner, the tray is interactive, the comms (chat/dictionary) entry is enabled. + await expect(page.locator('.offline-banner')).toHaveCount(0); + await expect(page.locator('.rack .tile').first()).toBeEnabled(); + + // The connection drops (the net hook rides past the hysteresis straight to offline). + await page.evaluate(() => (window as unknown as { __net: { offline(): void } }).__net.offline()); + + // The explicit "connection lost" banner appears and every rack tile freezes (cannot compose a move). + await expect(page.locator('.offline-banner')).toBeVisible({ timeout: 15000 }); + const tiles = page.locator('.rack .tile'); + const n = await tiles.count(); + expect(n).toBeGreaterThan(0); + for (let i = 0; i < n; i++) await expect(tiles.nth(i)).toBeDisabled(); + + // The comms entry (💬 — chat + dictionary) is disabled; it lives in the history drawer, so open it. + await page.locator('.scoreboard').click(); + await expect(page.locator('button:has(.chat-ico)')).toBeDisabled(); + + // Recovery: the network returns, the banner clears and the tray is interactive again. + await page.evaluate(() => (window as unknown as { __net: { online(): void } }).__net.online()); + await expect(page.locator('.offline-banner')).toHaveCount(0, { timeout: 15000 }); + await expect(page.locator('.rack .tile').first()).toBeEnabled(); + await expect(page.locator('button:has(.chat-ico)')).toBeEnabled(); +}); diff --git a/ui/src/game/CheckScreen.svelte b/ui/src/game/CheckScreen.svelte index b16d471..c07aff5 100644 --- a/ui/src/game/CheckScreen.svelte +++ b/ui/src/game/CheckScreen.svelte @@ -2,6 +2,8 @@ import { onMount } from 'svelte'; import { gateway } from '../lib/gateway'; import { gameSource, isLocalGameId } from '../lib/gamesource'; + import { connection } from '../lib/connection.svelte'; + import { localWordCheck } from '../lib/dict/check'; import { handleError, showToast } from '../lib/app.svelte'; import { t } from '../lib/i18n/index.svelte'; import { alphabetLetters } from '../lib/alphabet'; @@ -14,8 +16,12 @@ let { id }: { id: string } = $props(); let variant = $state('scrabble_en'); + let dictVersion = $state(''); let word = $state(''); let result = $state<{ word: string; legal: boolean } | null>(null); + // unavailable is set when an offline check cannot run because the game's pinned dictionary is not + // on the device (not cached/bundled); the panel then shows a neutral "offline" note. + let unavailable = $state(false); let cooling = $state(false); const checked = new Map(); @@ -26,6 +32,7 @@ // network. const st = await gameSource(id).gameState(id, true); variant = st.game.variant; + dictVersion = st.game.dictVersion; } catch (e) { handleError(e); } @@ -33,6 +40,7 @@ function onInput(e: Event) { word = sanitizeCheckWord((e.target as HTMLInputElement).value, alphabetLetters(variant)); + unavailable = false; } // Disabled while cooling, for an already-checked word, or an out-of-range length. function canCheck(): boolean { @@ -43,7 +51,22 @@ const w = word.trim().toUpperCase(); cooling = true; setTimeout(() => (cooling = false), 5000); + unavailable = false; try { + // Offline in an online game the network check_word would fail, so fall back to the game's own + // pinned dictionary read on-device: exact when that dawg is cached/bundled, otherwise the check + // is unavailable. A local game already resolves checkWord on-device, so it keeps that path. + if (!isLocalGameId(id) && !connection.online) { + const legal = await localWordCheck(variant, dictVersion, w); + if (legal === null) { + result = null; + unavailable = true; + return; + } + checked.set(w, legal); + result = { word: w, legal }; + return; + } const r = await gameSource(id).checkWord(id, w, variant); checked.set(w, r.legal); result = { word: w, legal: r.legal }; @@ -73,7 +96,9 @@ /> - {#if result} + {#if unavailable} +

{t('game.checkOffline')}

+ {:else if result}

{result.legal ? t('game.wordLegal', { word: result.word }) @@ -82,10 +107,10 @@

- {#if !isLocalGameId(id)} + {#if !isLocalGameId(id) && connection.online} {/if} - {#if result.legal} + {#if result.legal && connection.online} void) | null = null; @@ -1463,6 +1468,7 @@ // a local (offline) game, whose seats are account-less: vs_ai, and hotseat's synthetic seat ids. if (view?.game.vsAi || isLocalGameId(id)) return false; return ( + netReady && !!s.accountId && !app.profile?.isGuest && s.accountId !== app.session?.userId && @@ -1476,7 +1482,7 @@ // An already-blocked opponent hides it (both controls go, and the name is struck). function canBlock(s: { accountId: string; seat: number }): boolean { if (view?.game.vsAi || isLocalGameId(id)) return false; - return !!s.accountId && !app.profile?.isGuest && s.accountId !== app.session?.userId && !seatBlocked(s); + return netReady && !!s.accountId && !app.profile?.isGuest && s.accountId !== app.session?.userId && !seatBlocked(s); } @@ -1490,6 +1496,9 @@ selfInset={landscape} > {#if view} + {#if offlineInGame} +
{t('game.offlineBanner')}
+ {/if} {#if landscape}
@@ -1607,7 +1616,7 @@ — so drop the entry only when a local game is finished; an active local game keeps it for the Dictionary. An online game always keeps it (chat outlives the game). --> {#if !(gameOver && (view.game.vsAi || view.game.hotseat))} - {/if} @@ -1694,6 +1703,7 @@ draggingId={reorderDragId} dropIndex={reorderTo} confirm={!gameOver && placement.pending.length > 0 && !recallOverRack ? confirmBtn : undefined} + frozen={!netReady} ondown={onRackDown} /> {/if} @@ -2178,6 +2188,17 @@ color: var(--text-muted); padding: 40px; } + /* An online game that lost the connection: a slim, non-blocking strip at the top of the play area. + A solid token background (not color-mix) keeps it visible on the old-WebView floor. */ + .offline-banner { + padding: 7px var(--pad); + text-align: center; + font-size: 0.85rem; + line-height: 1.25; + color: var(--text); + background: var(--surface-2); + border-bottom: 1px solid var(--border); + } .ghost { position: fixed; width: 40px; diff --git a/ui/src/game/Rack.svelte b/ui/src/game/Rack.svelte index ebca3d6..28d6c13 100644 --- a/ui/src/game/Rack.svelte +++ b/ui/src/game/Rack.svelte @@ -13,6 +13,7 @@ shuffling = false, draggingId = null, dropIndex = null, + frozen = false, confirm, ondown, }: { @@ -26,6 +27,10 @@ // the drag ghost stands in) and dropIndex is the slot where a gap opens. draggingId?: number | null; dropIndex?: number | null; + /** frozen disables tile interaction (offline in an online game): tiles cannot be picked up to + * compose or reorder a move until the connection returns. The confirm control is gated + * separately by the parent. */ + frozen?: boolean; /** The confirm-move control, rendered as the fixed 7th slot of the rack while a play is staged * (the parent owns the button and its enablement; the rack only positions it). */ confirm?: Snippet; @@ -65,6 +70,7 @@ class:selected={selected === slot.index} class:shift={dropIndex != null && i >= dropIndex} data-rack-index={slot.index} + disabled={frozen} animate:hop={shuffling} onpointerdown={(e) => ondown(e, slot.index)} > @@ -114,6 +120,10 @@ outline: 3px solid var(--accent); outline-offset: -3px; } + /* Frozen (offline in an online game): the tray is inert until the connection returns. */ + .tile:disabled { + opacity: 0.5; + } /* While reordering, tiles at/after the drop slot slide right to open a gap there (one tile width plus the rack gap), so the drop position is visible. */ .rack.reordering .tile { diff --git a/ui/src/lib/dict/check.test.ts b/ui/src/lib/dict/check.test.ts new file mode 100644 index 0000000..e51758f --- /dev/null +++ b/ui/src/lib/dict/check.test.ts @@ -0,0 +1,49 @@ +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { setAlphabet } from '../alphabet'; + +// getDawg is the only side-effecting dependency; stub it so the test exercises localWordCheck's +// own logic (load -> encode -> membership -> null handling) against a fake reader, not a real DAWG. +vi.mock('./loader', () => ({ getDawg: vi.fn() })); +import { getDawg } from './loader'; +import { localWordCheck } from './check'; + +const mockedGetDawg = vi.mocked(getDawg); + +// A tiny cached alphabet so indexForLetter can encode the test words. +setAlphabet('scrabble_en', [ + { index: 0, letter: 'A', value: 1 }, + { index: 1, letter: 'B', value: 3 }, + { index: 2, letter: 'C', value: 3 }, +]); + +describe('localWordCheck', () => { + afterEach(() => vi.clearAllMocks()); + + it('returns true when the dawg contains the word', async () => { + mockedGetDawg.mockResolvedValue({ indexOf: () => 5 } as never); + expect(await localWordCheck('scrabble_en', 'v1', 'AB')).toBe(true); + }); + + it('returns false when the dawg does not contain the word', async () => { + mockedGetDawg.mockResolvedValue({ indexOf: () => -1 } as never); + expect(await localWordCheck('scrabble_en', 'v1', 'AB')).toBe(false); + }); + + it('returns null when the dawg is unavailable (offline and uncached)', async () => { + mockedGetDawg.mockResolvedValue(null); + expect(await localWordCheck('scrabble_en', 'v1', 'AB')).toBe(null); + }); + + it('encodes the word to alphabet indices for the membership test', async () => { + const indexOf = vi.fn(() => 0); + mockedGetDawg.mockResolvedValue({ indexOf } as never); + await localWordCheck('scrabble_en', 'v1', 'CAB'); + expect(indexOf).toHaveBeenCalledWith([2, 0, 1]); + }); + + it('loads the dawg for the pinned (variant, version)', async () => { + mockedGetDawg.mockResolvedValue({ indexOf: () => 1 } as never); + await localWordCheck('scrabble_en', 'v1.3.0', 'AB'); + expect(mockedGetDawg).toHaveBeenCalledWith('scrabble_en', 'v1.3.0'); + }); +}); diff --git a/ui/src/lib/dict/check.ts b/ui/src/lib/dict/check.ts new file mode 100644 index 0000000..3d0430c --- /dev/null +++ b/ui/src/lib/dict/check.ts @@ -0,0 +1,26 @@ +// Offline word-check fallback for an online game. An online game's dictionary check normally goes to +// the gateway (game.check_word); while disconnected that call fails, so the check falls back to the +// game's own pinned dictionary read locally. Using the game's pinned (variant, version) means the +// answer matches the server's — no divergence — as long as that dawg is available on-device; if it +// is not cached/bundled offline, the check is simply unavailable (null). The membership test mirrors +// the local engine's dictionaryHas (encode to alphabet indices, then Dawg.indexOf). + +import { getDawg } from './loader'; +import { indexForLetter } from '../alphabet'; +import type { Variant } from '../model'; + +/** + * localWordCheck reports whether word is in the (variant, version) dictionary using the on-device + * dawg, or null when that dawg cannot be obtained (offline and neither cached nor bundled). word + * must already be sanitised to the variant's alphabet (as the check panel does). + */ +export async function localWordCheck( + variant: Variant, + version: string, + word: string, +): Promise { + const dawg = await getDawg(variant, version); + if (!dawg) return null; + const idx = Array.from(word, (ch) => indexForLetter(variant, ch)); + return dawg.indexOf(idx) >= 0; +} diff --git a/ui/src/lib/i18n/en.ts b/ui/src/lib/i18n/en.ts index 6590022..81786f2 100644 --- a/ui/src/lib/i18n/en.ts +++ b/ui/src/lib/i18n/en.ts @@ -133,6 +133,8 @@ export const en = { 'game.complaintSent': 'Thanks, sent for review.', 'game.check': 'Check', 'game.checkWait': 'Please wait a moment.', + 'game.checkOffline': 'Word check is unavailable offline.', + 'game.offlineBanner': 'Connection lost — your move will send once you’re back online.', 'game.noHintOptions': 'No options with your letters.', 'game.thinking': 'thinking…', diff --git a/ui/src/lib/i18n/ru.ts b/ui/src/lib/i18n/ru.ts index 0660455..75871c2 100644 --- a/ui/src/lib/i18n/ru.ts +++ b/ui/src/lib/i18n/ru.ts @@ -133,6 +133,8 @@ export const ru: Record = { 'game.complaintSent': 'Спасибо, отправлено на проверку.', 'game.check': 'Проверить', 'game.checkWait': 'Секунду, пожалуйста.', + 'game.checkOffline': 'Проверка недоступна офлайн.', + 'game.offlineBanner': 'Связь потеряна — ход отправится, когда вернётся сеть.', 'game.noHintOptions': 'Нет вариантов с вашим набором.', 'game.thinking': 'думает…', From c522e77599b714f9cd390e9e6e1da341ddcbb6cb Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 14 Jul 2026 08:59:41 +0200 Subject: [PATCH 2/4] fix(ui): lazy-load the offline word-check helper to keep it out of the entry bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CheckScreen's static import of dict/check pulled the dawg loader/reader into the app entry bundle, pushing it 0.8 KB over the 130 KB budget (CI bundle-size gate). The dict subsystem is lazy everywhere else, so import localWordCheck dynamically in the offline branch — it loads only when an offline check actually runs. Main entry back to 129.0 KB. --- ui/src/game/CheckScreen.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/src/game/CheckScreen.svelte b/ui/src/game/CheckScreen.svelte index c07aff5..e1b2211 100644 --- a/ui/src/game/CheckScreen.svelte +++ b/ui/src/game/CheckScreen.svelte @@ -3,7 +3,6 @@ import { gateway } from '../lib/gateway'; import { gameSource, isLocalGameId } from '../lib/gamesource'; import { connection } from '../lib/connection.svelte'; - import { localWordCheck } from '../lib/dict/check'; import { handleError, showToast } from '../lib/app.svelte'; import { t } from '../lib/i18n/index.svelte'; import { alphabetLetters } from '../lib/alphabet'; @@ -57,6 +56,9 @@ // pinned dictionary read on-device: exact when that dawg is cached/bundled, otherwise the check // is unavailable. A local game already resolves checkWord on-device, so it keeps that path. if (!isLocalGameId(id) && !connection.online) { + // Dynamically imported so the dawg reader/loader stays out of the app entry bundle (the dict + // subsystem is lazy everywhere else too); it loads only when an offline check actually runs. + const { localWordCheck } = await import('../lib/dict/check'); const legal = await localWordCheck(variant, dictVersion, w); if (legal === null) { result = null; From 564abdcf88c3706b8db8076dfda134a5f4e393da Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 14 Jul 2026 09:06:03 +0200 Subject: [PATCH 3/4] chore: fix broken telegram links --- deploy/.env.example | 2 +- deploy/README.md | 4 ++-- .../telegram/internal/botlink/executor_test.go | 4 ++-- platform/telegram/internal/config/config.go | 2 +- platform/telegram/internal/config/config_test.go | 4 ++-- .../telegram/internal/promobot/promobot_test.go | 16 ++++++++-------- ui/README.md | 2 +- ui/e2e/landing.spec.ts | 2 +- ui/legal/eula_en.md | 10 +++++----- ui/legal/eula_ru.md | 10 +++++----- ui/legal/offer_en.md | 2 +- ui/legal/offer_ru.md | 2 +- ui/legal/privacy_en.md | 2 +- ui/legal/privacy_ru.md | 2 +- ui/src/Landing.svelte | 2 +- ui/src/components/StaleInviteModal.svelte | 2 +- ui/src/components/WelcomeRedeemModal.svelte | 2 +- ui/src/lib/deeplink.test.ts | 6 +++--- ui/src/lib/deeplink.ts | 4 ++-- ui/src/lib/landing.test.ts | 2 +- ui/src/lib/landing.ts | 2 +- ui/src/lib/links.test.ts | 8 ++++---- ui/src/lib/telegram.test.ts | 2 +- ui/src/lib/telegram.ts | 6 +++--- 24 files changed, 50 insertions(+), 50 deletions(-) diff --git a/deploy/.env.example b/deploy/.env.example index 2a14e92..7846f75 100644 --- a/deploy/.env.example +++ b/deploy/.env.example @@ -86,7 +86,7 @@ GM_BASICAUTH_HASH= # required; `caddy hash-password` bcrypt # --- UI build args (baked into the gateway image) --------------------------- VITE_TELEGRAM_BOT_ID= -VITE_TELEGRAM_LINK= # friend-invite Mini App link (full URL, e.g. https://t.me//) +VITE_TELEGRAM_LINK= # friend-invite Mini App link (full URL, e.g. https://telegram.me//) VITE_TELEGRAM_GAME_CHANNEL_NAME= # landing "Play in Telegram" link, the bot's game channel VITE_VK_APP_LINK= # landing "Play on VK" link (full URL, https://vk.com/app) VITE_VK_APP_ID= # VK ID "Web" app id (client_id) for VK web-login linking; also the gateway's GATEWAY_VK_ID_APP_ID diff --git a/deploy/README.md b/deploy/README.md index f95f3f4..06e5d06 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -107,8 +107,8 @@ without it Docker's resolver handles `otelcol`, `gateway` and `api.telegram.org` | `TELEGRAM_TEST_ENV` | _pinned_ | `false` | `true` routes the bot through Telegram's test environment (`.../bot/test/METHOD`). **The CI test contour pins this to `true` in `ci.yaml`** (the contour is the test environment) — it is not a Gitea variable. Set it in `.env` for a local run; prod leaves it `false`. | | `TELEGRAM_API_BASE_URL` | variable | _(empty)_ | Override the Bot API host (a mock/self-hosted server); empty = `https://api.telegram.org`. | | `VITE_TELEGRAM_BOT_ID` | variable | _(empty)_ | UI build-arg: numeric bot id for the web Login Widget. | -| `VITE_TELEGRAM_LINK` | variable | _(empty)_ | UI build-arg: friend-invite Mini App link (full URL, `https://t.me//` — `` is the Mini App short name from BotFather). | -| `VITE_TELEGRAM_GAME_CHANNEL_NAME` | variable | _(empty)_ | UI build-arg: the landing "Play in Telegram" link, the bot's game channel (e.g. `https://t.me/Erudit_Game`). | +| `VITE_TELEGRAM_LINK` | variable | _(empty)_ | UI build-arg: friend-invite Mini App link (full URL, `https://telegram.me//` — `` is the Mini App short name from BotFather). | +| `VITE_TELEGRAM_GAME_CHANNEL_NAME` | variable | _(empty)_ | UI build-arg: the landing "Play in Telegram" link, the bot's game channel (e.g. `https://telegram.me/Erudit_Game`). | | `VITE_VK_APP_LINK` | variable (shared) | _(empty)_ | UI build-arg: the landing "Play on VK" link, the VK Mini App (full URL, `https://vk.com/app`). One VK Mini App for all contours. | | `VITE_VK_APP_ID` | variable (shared) | _(empty)_ | VK ID "Web" app id (`client_id`) for VK web-login linking. Baked into the SPA authorize URL and reused as the gateway's `GATEWAY_VK_ID_APP_ID`. Empty disables the `link.vk.*` ops. One VK ID "Web" app for all contours. | | `VITE_VK_ID_REDIRECT_URL` | derived | _(empty)_ | VK ID trusted redirect URL — must match the app's registered redirect exactly. The deploy derives `PUBLIC_BASE_URL + /app/` (used by the SPA and as the gateway's exchange `redirect_uri`); set it only for a local run. | diff --git a/platform/telegram/internal/botlink/executor_test.go b/platform/telegram/internal/botlink/executor_test.go index 1fc7258..a520313 100644 --- a/platform/telegram/internal/botlink/executor_test.go +++ b/platform/telegram/internal/botlink/executor_test.go @@ -169,7 +169,7 @@ func TestExecutorChatGateInvalidExternalID(t *testing.T) { } func TestExecutorCreateInvoice(t *testing.T) { - sender := &fakeSender{invoiceLink: "https://t.me/$abc"} + sender := &fakeSender{invoiceLink: "https://telegram.me/$abc"} exec := NewExecutor(sender, 0, nil) cmd := &botlinkv1.Command{Payload: &botlinkv1.Command_CreateInvoice{CreateInvoice: &botlinkv1.CreateInvoiceCommand{ Title: "50 chips", Description: "50 chips", Payload: "order-1", Amount: 40, @@ -178,7 +178,7 @@ func TestExecutorCreateInvoice(t *testing.T) { if err != nil { t.Fatalf("handle: %v", err) } - if !delivered || result != "https://t.me/$abc" { + if !delivered || result != "https://telegram.me/$abc" { t.Errorf("create invoice = %v / %q, want true / the link", delivered, result) } if len(sender.invoice) != 1 || sender.invoice[0].payload != "order-1" || sender.invoice[0].amount != 40 { diff --git a/platform/telegram/internal/config/config.go b/platform/telegram/internal/config/config.go index b82d5ec..7610ea0 100644 --- a/platform/telegram/internal/config/config.go +++ b/platform/telegram/internal/config/config.go @@ -66,7 +66,7 @@ type BotConfig struct { // bot's message text (TELEGRAM_BOT_USERNAME; required when the promo bot runs). BotUsername string // BotLinkURL is the main bot's Mini App direct link — the same value the UI builds - // share links from (VITE_TELEGRAM_LINK), e.g. https://t.me//. The promo + // share links from (VITE_TELEGRAM_LINK), e.g. https://telegram.me//. The promo // button appends ?startapp= to it (TELEGRAM_BOT_LINK; required when the // promo bot runs). It is distinct from the BotLink mTLS dial config below. BotLinkURL string diff --git a/platform/telegram/internal/config/config_test.go b/platform/telegram/internal/config/config_test.go index d90c706..f28e17c 100644 --- a/platform/telegram/internal/config/config_test.go +++ b/platform/telegram/internal/config/config_test.go @@ -112,7 +112,7 @@ func TestLoadBotChatAndPromo(t *testing.T) { t.Setenv("TELEGRAM_CHAT_ID", "-100222") t.Setenv("TELEGRAM_PROMO_BOT_TOKEN", "promo-token") t.Setenv("TELEGRAM_BOT_USERNAME", "@ScrabbleBot") - t.Setenv("TELEGRAM_BOT_LINK", "https://t.me/ScrabbleBot/app") + t.Setenv("TELEGRAM_BOT_LINK", "https://telegram.me/ScrabbleBot/app") c, err := LoadBot() if err != nil { t.Fatalf("LoadBot: %v", err) @@ -126,7 +126,7 @@ func TestLoadBotChatAndPromo(t *testing.T) { if c.BotUsername != "ScrabbleBot" { t.Errorf("BotUsername = %q, want the leading @ stripped", c.BotUsername) } - if c.BotLinkURL != "https://t.me/ScrabbleBot/app" { + if c.BotLinkURL != "https://telegram.me/ScrabbleBot/app" { t.Errorf("BotLinkURL = %q", c.BotLinkURL) } }) diff --git a/platform/telegram/internal/promobot/promobot_test.go b/platform/telegram/internal/promobot/promobot_test.go index 4e719d4..c748068 100644 --- a/platform/telegram/internal/promobot/promobot_test.go +++ b/platform/telegram/internal/promobot/promobot_test.go @@ -13,7 +13,7 @@ import ( ) func TestPromoTextLocalization(t *testing.T) { - const url = "https://t.me/bot/app?startapp=verudit_ru-scrabble_en" + const url = "https://telegram.me/bot/app?startapp=verudit_ru-scrabble_en" // The @username is rendered as a clickable deep link (the same target as the button), // not a plain mention, so tapping it opens the seeded Mini App. wantLink := `@ScrabbleBot` @@ -41,17 +41,17 @@ func TestPromoTextLocalization(t *testing.T) { } func TestLaunchURLAppendsStartapp(t *testing.T) { - b := &Bot{linkURL: "https://t.me/bot/app"} - if got := b.launchURL(""); got != "https://t.me/bot/app" { + b := &Bot{linkURL: "https://telegram.me/bot/app"} + if got := b.launchURL(""); got != "https://telegram.me/bot/app" { t.Errorf("empty payload = %q, want the base link unchanged", got) } - if got := b.launchURL("g123"); got != "https://t.me/bot/app?startapp=g123" { + if got := b.launchURL("g123"); got != "https://telegram.me/bot/app?startapp=g123" { t.Errorf("launchURL = %q, want startapp=g123 appended", got) } } func TestLaunchMarkupIsURLButton(t *testing.T) { - b := &Bot{linkURL: "https://t.me/bot/app"} + b := &Bot{linkURL: "https://telegram.me/bot/app"} btn := b.launchMarkup("Play", "f99").InlineKeyboard[0][0] if btn.WebApp != nil { t.Error("the promo button must not be a web_app button (it would sign initData with the promo token, which the main bot rejects)") @@ -84,7 +84,7 @@ func TestHandleStartReplies(t *testing.T) { api := &fakeAPI{} srv := httptest.NewServer(api) t.Cleanup(srv.Close) - b, err := New(Config{Token: "1:2", APIBaseURL: srv.URL, BotUsername: "ScrabbleBot", BotLinkURL: "https://t.me/bot/app"}, zap.NewNop()) + b, err := New(Config{Token: "1:2", APIBaseURL: srv.URL, BotUsername: "ScrabbleBot", BotLinkURL: "https://telegram.me/bot/app"}, zap.NewNop()) if err != nil { t.Fatalf("new: %v", err) } @@ -98,7 +98,7 @@ func TestHandleStartReplies(t *testing.T) { if api.chatID != "42" { t.Errorf("chat_id = %q, want 42", api.chatID) } - if !strings.Contains(api.text, `@ScrabbleBot`) { + if !strings.Contains(api.text, `@ScrabbleBot`) { t.Errorf("text = %q, want the @mention linked to the startapp deep link", api.text) } if strings.Contains(api.replyMarkup, "web_app") { @@ -113,7 +113,7 @@ func TestHandleStartIgnoresGroup(t *testing.T) { api := &fakeAPI{} srv := httptest.NewServer(api) t.Cleanup(srv.Close) - b, err := New(Config{Token: "1:2", APIBaseURL: srv.URL, BotUsername: "B", BotLinkURL: "https://t.me/b/a"}, zap.NewNop()) + b, err := New(Config{Token: "1:2", APIBaseURL: srv.URL, BotUsername: "B", BotLinkURL: "https://telegram.me/b/a"}, zap.NewNop()) if err != nil { t.Fatalf("new: %v", err) } diff --git a/ui/README.md b/ui/README.md index 80d88db..625c7c2 100644 --- a/ui/README.md +++ b/ui/README.md @@ -29,7 +29,7 @@ pnpm codegen # regenerate src/gen from edge.proto + scrabble.fbs (dev-time) gateway origin for a packaged (non-proxied) build. `VITE_TELEGRAM_BOT_ID` enables the "Link Telegram" web sign-in (the Login Widget) — inert until the site domain is registered with BotFather (`/setdomain`); `VITE_TELEGRAM_LINK` is the -friend-invite Mini App link for the single bot (full URL `https://t.me//`). +friend-invite Mini App link for the single bot (full URL `https://telegram.me//`). `VITE_TELEGRAM_GAME_CHANNEL_NAME` is the "Play in Telegram" link shown on the landing page. The **native (Capacitor) build** additionally reads `VITE_DICT_VERSION` (the bundled-dictionary version the offline path requests, matching the packaged DAWGs), `VITE_PAYMENTS_DISABLED=1` (hide in-app purchases diff --git a/ui/e2e/landing.spec.ts b/ui/e2e/landing.spec.ts index 848af7e..88128f6 100644 --- a/ui/e2e/landing.spec.ts +++ b/ui/e2e/landing.spec.ts @@ -70,7 +70,7 @@ test('the landing footer links to the legal documents and the feedback bot', asy ['Пользовательское соглашение', '/eula/'], ['Политика конфиденциальности', '/privacy/'], ['Публичная оферта', '/offer/'], - ['Обратная связь', 'https://t.me/Erudit_GameBot'], + ['Обратная связь', 'https://telegram.me/Erudit_GameBot'], ]; for (const [name, href] of links) { const link = page.getByRole('link', { name }); diff --git a/ui/legal/eula_en.md b/ui/legal/eula_en.md index 15221e3..5258d2a 100644 --- a/ui/legal/eula_en.md +++ b/ui/legal/eula_en.md @@ -207,7 +207,7 @@ If the limitation or exclusion of liability is prohibited by applicable law, the The Company cares about the protection of personal data. Personal data collected by the Company in the context of this document is subject to automated processing in accordance with applicable law. All information collected as part of providing the service is registered by the Company, which is the data controller. This is very important for the functioning of the services offered by the Company. -To exercise one or more of their rights, the User must provide an identity document and contact the person responsible for data protection at the Company (via service support on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot), or send us your request in writing to: 236020, Kaliningrad, Pribrezhny district, Parkovaya St. 1, recipient — Ilya Arkadyevich Denisov). +To exercise one or more of their rights, the User must provide an identity document and contact the person responsible for data protection at the Company (via service support on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot), or send us your request in writing to: 236020, Kaliningrad, Pribrezhny district, Parkovaya St. 1, recipient — Ilya Arkadyevich Denisov). In the event of a complaint, the User may contact the personal-data supervisory authority of their country of residence. @@ -247,7 +247,7 @@ Although the Company does everything possible to ensure data confidentiality and **15.8.** The Company reserves the right to revise the terms of this Licence Agreement, in particular, the Game Rules and/or the Forum Rules, by updating the Licence Agreement at [`erudit-game.ru/eula/`](/eula/) or by notifying the User by email. The revised Licence Agreement enters into force from the day of its publication. The User is advised to check the aforementioned website periodically for notices of such changes. The User's failure to take steps to review does not serve as grounds for the User's failure to perform their obligations and non-compliance with the restrictions established by this Licence Agreement. The User's continued use of the Game is deemed acceptance of any revised terms. -**15.9.** On matters related to the performance of this Licence Agreement and/or the use of the Game, the User may contact the Company on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) and at ilia.denissov@gmail.com. +**15.9.** On matters related to the performance of this Licence Agreement and/or the use of the Game, the User may contact the Company on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) and at ilia.denissov@gmail.com. Denisov I.A. | 2026 @@ -312,7 +312,7 @@ The Company reserves the right to identify and locate all of the User's Accounts **5.4.** The User is prohibited from attempting to benefit from deliberate (or repeated) participation in the game process as part of a game group (team) with other Users who have violated paragraphs 5.1, 5.5 and/or 5.6 of the Game Rules. -**5.5.** The User is prohibited from using and distributing information, calling for the use of and publicly distributing any errors, both within the Game and in any other software. A User who discovers such errors in the Game must stop using it and report them to the Company on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) and at ilia.denissov@gmail.com, setting out in detail and truthfully all the circumstances of such discovery and use. If the User has any doubts as to whether the functioning of any particular game process, In-game items or In-game currency is currently normal or has deviations, malfunctions or errors, the User must stop using such process, In-game items or In-game currency and contact the Company at ilia.denissov@gmail.com for the relevant explanations. +**5.5.** The User is prohibited from using and distributing information, calling for the use of and publicly distributing any errors, both within the Game and in any other software. A User who discovers such errors in the Game must stop using it and report them to the Company on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) and at ilia.denissov@gmail.com, setting out in detail and truthfully all the circumstances of such discovery and use. If the User has any doubts as to whether the functioning of any particular game process, In-game items or In-game currency is currently normal or has deviations, malfunctions or errors, the User must stop using such process, In-game items or In-game currency and contact the Company at ilia.denissov@gmail.com for the relevant explanations. **5.6.** The User is prohibited from decompiling, decoding and reconstructing data, bypassing data-protection systems, hacking or attempting to hack the software components of the Game or its services, and/or intercepting data coming to or from the server. Prohibited are: (in particular) any modification, alteration, decompilation, decoding, sale or distribution of modified materials of the Game in whole or in part (or the means and materials necessary to perform such actions), the use of programming errors, making changes to the program code and obtaining unauthorised access to the server and database of the Game. In certain special cases, the Company has the right to immediately suspend the User's access to the Game and send a request to the relevant authorities to prevent any violation of the Licence Agreement and/or provisions of applicable law. @@ -350,7 +350,7 @@ The Company reserves the right to identify and locate all of the User's Accounts **8.2.** The User is prohibited from offering such arguments as "in accordance with the role"/"role-play" in defence of unlawful actions of any kind. -**8.3.** The User is prohibited from deliberately providing false information when contacting the Company on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) or at ilia.denissov@gmail.com, as well as from falsifying the data provided. +**8.3.** The User is prohibited from deliberately providing false information when contacting the Company on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) or at ilia.denissov@gmail.com, as well as from falsifying the data provided. --- @@ -406,7 +406,7 @@ The Company reserves the right to identify and locate all of the User's forum ac **3.9.** Trading (discussion of trading) in game characters, In-game items, In-game currency, forum accounts, character level boosting. -**3.10.** Discussion of vulnerabilities or shortcomings of the Game, as well as any actions that in any way violate the Game Rules, or their discussion. Upon discovering vulnerabilities or shortcomings, the User must report them to the Company on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) or at ilia.denissov@gmail.com. +**3.10.** Discussion of vulnerabilities or shortcomings of the Game, as well as any actions that in any way violate the Game Rules, or their discussion. Upon discovering vulnerabilities or shortcomings, the User must report them to the Company on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) or at ilia.denissov@gmail.com. **3.11.** Publication of messages causing negative consequences for the game process; provocation of Users to violate the Game Rules. diff --git a/ui/legal/eula_ru.md b/ui/legal/eula_ru.md index 5c4069f..20dd6f8 100644 --- a/ui/legal/eula_ru.md +++ b/ui/legal/eula_ru.md @@ -207,7 +207,7 @@ Компания заботится о защите персональных данных. Персональные данные, собранные Компанией в контексте настоящего документа, подлежат автоматизированной обработке в соответствии с действующим законодательством. Вся информация, собранная в рамках предоставления услуги, регистрируется Компанией, которая является контролером данных. Это очень важно для функционирования предлагаемых Компанией услуг. -Для осуществления одного или нескольких своих прав Пользователь должен предоставить документ, удостоверяющий личность, и связаться с лицом, ответственным за защиту данных в Компании (через сервисную поддержку в Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot), либо отправьте нам свой запрос в письменном виде по адресу: 236020, г. Калининград, мкр. Прибрежный, ул. Парковая, д. 1, получатель — Денисов Илья Аркадьевич). +Для осуществления одного или нескольких своих прав Пользователь должен предоставить документ, удостоверяющий личность, и связаться с лицом, ответственным за защиту данных в Компании (через сервисную поддержку в Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot), либо отправьте нам свой запрос в письменном виде по адресу: 236020, г. Калининград, мкр. Прибрежный, ул. Парковая, д. 1, получатель — Денисов Илья Аркадьевич). В случае возникновения жалобы Пользователь может обратиться в надзорный орган по защите персональных данных страны своего проживания. @@ -247,7 +247,7 @@ **15.8.** Компания оставляет за собой право пересматривать условия настоящего Лицензионного соглашения, в частности, Правила Игры и/или Правила форума, обновляя Лицензионное соглашение на странице [`erudit-game.ru/eula/`](/eula/) или уведомляя Пользователя по электронной почте. Пересмотренное Лицензионное соглашение вступает в силу со дня его опубликования. Пользователю рекомендуется периодически проверять вышеуказанный веб-сайт на наличие уведомлений о таких изменениях. Отказ Пользователя от действий по ознакомлению не может служить основанием для невыполнения обязательств Пользователя и несоблюдения Пользователем ограничений, установленных настоящим Лицензионным соглашением. Продолжение использования Игры Пользователем считается принятием любых пересмотренных условий. -**15.9.** По вопросам, связанным с исполнением настоящего Лицензионного соглашения и/или использованием Игры, Пользователь может связаться с Компанией через Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) и по адресу ilia.denissov@gmail.com. +**15.9.** По вопросам, связанным с исполнением настоящего Лицензионного соглашения и/или использованием Игры, Пользователь может связаться с Компанией через Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) и по адресу ilia.denissov@gmail.com. Денисов И.А. | 2026 @@ -312,7 +312,7 @@ **5.4.** Пользователю запрещается пытаться извлечь выгоду из преднамеренного (или неоднократного) участия в игровом процессе в составе игровой группы (команды) с другими Пользователями, нарушившими пункты 5.1, 5.5 и/или 5.6 Правил Игры. -**5.5.** Пользователю запрещается использовать и распространять информацию, призывать к использованию и публично распространять любые ошибки, как внутри Игры, так и в любом другом программном обеспечении. Пользователь, обнаруживший такие ошибки в Игре, должен прекратить её использование и сообщить о них Компании через Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) и по адресу ilia.denissov@gmail.com, подробно и достоверно изложив все обстоятельства такого обнаружения и использования. В случае возникновения у Пользователя каких-либо сомнений в том, является ли такое функционирование какого-либо конкретного игрового процесса, Внутриигровых предметов или Внутриигровой валюты в настоящий момент нормальным или имеет отклонения, сбои, ошибки, Пользователь должен прекратить использование таких процесса, Внутриигровых предметов или Внутриигровой валюты и обратиться к Компании через ilia.denissov@gmail.com для получения соответствующих разъяснений. +**5.5.** Пользователю запрещается использовать и распространять информацию, призывать к использованию и публично распространять любые ошибки, как внутри Игры, так и в любом другом программном обеспечении. Пользователь, обнаруживший такие ошибки в Игре, должен прекратить её использование и сообщить о них Компании через Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) и по адресу ilia.denissov@gmail.com, подробно и достоверно изложив все обстоятельства такого обнаружения и использования. В случае возникновения у Пользователя каких-либо сомнений в том, является ли такое функционирование какого-либо конкретного игрового процесса, Внутриигровых предметов или Внутриигровой валюты в настоящий момент нормальным или имеет отклонения, сбои, ошибки, Пользователь должен прекратить использование таких процесса, Внутриигровых предметов или Внутриигровой валюты и обратиться к Компании через ilia.denissov@gmail.com для получения соответствующих разъяснений. **5.6.** Пользователю запрещается декомпилировать, декодировать и реконструировать данные, обходить системы защиты данных, взламывать или пытаться взломать программные компоненты Игры или её сервисов, и/или перехватывать данные, поступающие на сервер или с него. Запрещается: (в частности) любое модифицирование, изменение, декомпиляция, декодирование, продажа или распространение модифицированных материалов Игры в целом или по частям (или средств и материалов, необходимых для выполнения таких действий), использование ошибок программирования, внесение изменений в программный код и получение несанкционированного доступа к серверу и базе данных Игры. В определённых особых случаях Компания имеет право немедленно приостановить доступ Пользователя к Игре и направить запрос в соответствующие органы о предотвращении любого нарушения Лицензионного соглашения и/или положений применимого законодательства. @@ -350,7 +350,7 @@ **8.2.** Пользователю запрещается предлагать такие аргументы, как «в соответствии с ролью»/«отыгрыш роли», в защиту неправомерных действий любого рода. -**8.3.** Пользователю запрещается преднамеренно предоставлять ложную информацию в случае обращения к Компании через Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) или по адресу ilia.denissov@gmail.com, а также фальсифицировать предоставленные данные. +**8.3.** Пользователю запрещается преднамеренно предоставлять ложную информацию в случае обращения к Компании через Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) или по адресу ilia.denissov@gmail.com, а также фальсифицировать предоставленные данные. --- @@ -406,7 +406,7 @@ **3.9.** Торговля (обсуждение торговли) игровыми персонажами, Внутриигровыми предметами, Внутриигровой валютой, учётными записями на форумах, повышение уровня персонажа. -**3.10.** Обсуждение уязвимостей или недоработок Игры, а также любые действия, каким-либо образом нарушающие Правила Игры, или их обсуждение. При обнаружении уязвимостей или недоработок Пользователь должен сообщить об этом Компании через Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot) или по адресу ilia.denissov@gmail.com. +**3.10.** Обсуждение уязвимостей или недоработок Игры, а также любые действия, каким-либо образом нарушающие Правила Игры, или их обсуждение. При обнаружении уязвимостей или недоработок Пользователь должен сообщить об этом Компании через Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot) или по адресу ilia.denissov@gmail.com. **3.11.** Публикация сообщений, вызывающих негативные последствия для игрового процесса; провокация нарушения Пользователями Правил Игры. diff --git a/ui/legal/offer_en.md b/ui/legal/offer_en.md index e916d6d..c0fca9a 100644 --- a/ui/legal/offer_en.md +++ b/ui/legal/offer_en.md @@ -152,4 +152,4 @@ Disputes or disagreements on which the Parties have not reached agreement are su Ilya Arkadyevich Denisov, TIN 290210610742. -Feedback on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot). +Feedback on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot). diff --git a/ui/legal/offer_ru.md b/ui/legal/offer_ru.md index 1763d65..8863d86 100644 --- a/ui/legal/offer_ru.md +++ b/ui/legal/offer_ru.md @@ -152,4 +152,4 @@ Денисов Илья Аркадьевич, ИНН 290210610742. -Обратная связь в Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot). +Обратная связь в Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot). diff --git a/ui/legal/privacy_en.md b/ui/legal/privacy_en.md index 07e1a33..6280f63 100644 --- a/ui/legal/privacy_en.md +++ b/ui/legal/privacy_en.md @@ -133,7 +133,7 @@ The transfer of personal data to recipients (regardless of their legal status) i ## 11. Contact us -**11.1.** If you have any questions, please contact Support on Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot), or send us your request in writing to: 236020, Kaliningrad, Pribrezhny district, Parkovaya St. 1, recipient — Ilya Arkadyevich Denisov. Please refer to this Privacy Policy so that we can process your request effectively. We will try to respond to you within 30 days of receiving your request. +**11.1.** If you have any questions, please contact Support on Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot), or send us your request in writing to: 236020, Kaliningrad, Pribrezhny district, Parkovaya St. 1, recipient — Ilya Arkadyevich Denisov. Please refer to this Privacy Policy so that we can process your request effectively. We will try to respond to you within 30 days of receiving your request. **11.2.** All correspondence we receive from you (written or electronic requests) is classified as restricted-access information and may not be disclosed without your written consent. Personal data and other information about you may not be used without your consent for any purpose other than responding to the request, except in cases expressly provided for by law. diff --git a/ui/legal/privacy_ru.md b/ui/legal/privacy_ru.md index e2c9b58..4d63ff6 100644 --- a/ui/legal/privacy_ru.md +++ b/ui/legal/privacy_ru.md @@ -133,7 +133,7 @@ ## 11. Связаться с нами -**11.1.** Если у вас есть какие-либо вопросы, пожалуйста, свяжитесь со Службой поддержки в Telegram: [@Erudit_GameBot](https://t.me/Erudit_GameBot), либо отправьте нам свой запрос в письменном виде по адресу: 236020, г. Калининград, мкр. Прибрежный, ул. Парковая, д. 1, получатель — Денисов Илья Аркадьевич. Пожалуйста, ссылайтесь на настоящую Политику конфиденциальности, чтобы мы смогли эффективно обработать ваш запрос. Мы постараемся ответить вам в течение 30 дней с момента получения запроса. +**11.1.** Если у вас есть какие-либо вопросы, пожалуйста, свяжитесь со Службой поддержки в Telegram: [@Erudit_GameBot](https://telegram.me/Erudit_GameBot), либо отправьте нам свой запрос в письменном виде по адресу: 236020, г. Калининград, мкр. Прибрежный, ул. Парковая, д. 1, получатель — Денисов Илья Аркадьевич. Пожалуйста, ссылайтесь на настоящую Политику конфиденциальности, чтобы мы смогли эффективно обработать ваш запрос. Мы постараемся ответить вам в течение 30 дней с момента получения запроса. **11.2.** Вся полученная нами от вас корреспонденция (письменные или электронные запросы) классифицируется как информация с ограниченным доступом и не может быть разглашена без вашего письменного согласия. Персональные данные и другая информация о вас не могут быть использованы без вашего согласия для каких-либо целей, кроме как для ответа на запрос, за исключением случаев, прямо предусмотренных законом. diff --git a/ui/src/Landing.svelte b/ui/src/Landing.svelte index b7c9e67..28e393c 100644 --- a/ui/src/Landing.svelte +++ b/ui/src/Landing.svelte @@ -134,7 +134,7 @@ - {t('landing.feedback')} + {t('landing.feedback')} {t('about.version', { v: __APP_VERSION__ })} diff --git a/ui/src/components/StaleInviteModal.svelte b/ui/src/components/StaleInviteModal.svelte index b06579b..d7cf115 100644 --- a/ui/src/components/StaleInviteModal.svelte +++ b/ui/src/components/StaleInviteModal.svelte @@ -15,7 +15,7 @@ function openBot() { if (username) { - const url = `https://t.me/${username}`; + const url = `https://telegram.me/${username}`; // Inside Telegram, openTelegramLink navigates to the bot chat natively; elsewhere fall // back to a new tab (routed out of the Android VK WebView by openExternalUrl). if (!telegramOpenLink(url)) openExternalUrl(url); diff --git a/ui/src/components/WelcomeRedeemModal.svelte b/ui/src/components/WelcomeRedeemModal.svelte index 3bd0c29..6dbd701 100644 --- a/ui/src/components/WelcomeRedeemModal.svelte +++ b/ui/src/components/WelcomeRedeemModal.svelte @@ -18,7 +18,7 @@ function openBot() { if (username) { - const url = `https://t.me/${username}`; + const url = `https://telegram.me/${username}`; // Inside Telegram, openTelegramLink navigates to the bot chat natively; elsewhere fall // back to a new tab (routed out of the Android VK WebView by openExternalUrl). if (!telegramOpenLink(url)) openExternalUrl(url); diff --git a/ui/src/lib/deeplink.test.ts b/ui/src/lib/deeplink.test.ts index becb5f1..ec17aee 100644 --- a/ui/src/lib/deeplink.test.ts +++ b/ui/src/lib/deeplink.test.ts @@ -32,8 +32,8 @@ describe('shareLink', () => { }); it('wraps a payload in a startapp link', () => { - vi.stubEnv('VITE_TELEGRAM_LINK', 'https://t.me/bot/app'); - expect(shareLink('f123456')).toBe('https://t.me/bot/app?startapp=f123456'); + vi.stubEnv('VITE_TELEGRAM_LINK', 'https://telegram.me/bot/app'); + expect(shareLink('f123456')).toBe('https://telegram.me/bot/app?startapp=f123456'); }); }); @@ -60,7 +60,7 @@ describe('botUsername', () => { }); it('extracts the bot handle from the Mini App link', () => { - vi.stubEnv('VITE_TELEGRAM_LINK', 'https://t.me/bot/app'); + vi.stubEnv('VITE_TELEGRAM_LINK', 'https://telegram.me/bot/app'); expect(botUsername()).toBe('bot'); }); }); diff --git a/ui/src/lib/deeplink.ts b/ui/src/lib/deeplink.ts index 19a2e5b..bd28dae 100644 --- a/ui/src/lib/deeplink.ts +++ b/ui/src/lib/deeplink.ts @@ -43,7 +43,7 @@ function envVar(name: string): string | undefined { } /** - * telegramBase returns the single bot's Mini App link base (e.g. https://t.me//) + * telegramBase returns the single bot's Mini App link base (e.g. https://telegram.me//) * from VITE_TELEGRAM_LINK, or null when it is not configured. */ function telegramBase(): string | null { @@ -52,7 +52,7 @@ function telegramBase(): string | null { /** * botUsername extracts the bot's @username (without the @) from the configured Mini App - * link: the first path segment of https://t.me//. Returns null when no base is + * link: the first path segment of https://telegram.me//. Returns null when no base is * configured or the link carries no path. */ export function botUsername(): string | null { diff --git a/ui/src/lib/landing.test.ts b/ui/src/lib/landing.test.ts index 803ff14..25a6a1f 100644 --- a/ui/src/lib/landing.test.ts +++ b/ui/src/lib/landing.test.ts @@ -6,7 +6,7 @@ describe('telegramChannelLink', () => { it('builds the t.me link from the channel name', () => { vi.stubEnv('VITE_TELEGRAM_GAME_CHANNEL_NAME', '@Erudit_Game'); // a leading @ is tolerated - expect(telegramChannelLink()).toBe('https://t.me/Erudit_Game'); + expect(telegramChannelLink()).toBe('https://telegram.me/Erudit_Game'); }); it('returns null when the channel name is unset or blank', () => { diff --git a/ui/src/lib/landing.ts b/ui/src/lib/landing.ts index 2943705..a2d9cb6 100644 --- a/ui/src/lib/landing.ts +++ b/ui/src/lib/landing.ts @@ -11,7 +11,7 @@ export function telegramChannelLink(): string | null { const raw = import.meta.env.VITE_TELEGRAM_GAME_CHANNEL_NAME; const name = (raw as string | undefined)?.trim().replace(/^@/, ''); - return name ? `https://t.me/${name}` : null; + return name ? `https://telegram.me/${name}` : null; } /** diff --git a/ui/src/lib/links.test.ts b/ui/src/lib/links.test.ts index 895c5f9..cb72f30 100644 --- a/ui/src/lib/links.test.ts +++ b/ui/src/lib/links.test.ts @@ -13,9 +13,9 @@ describe('openExternalUrl', () => { origin: 'https://app.example', }); vi.stubGlobal('window', { open }); - openExternalUrl('https://t.me/some_bot'); + openExternalUrl('https://telegram.me/some_bot'); expect(open).toHaveBeenCalledWith( - `https://vk.com/away.php?to=${encodeURIComponent('https://t.me/some_bot')}`, + `https://vk.com/away.php?to=${encodeURIComponent('https://telegram.me/some_bot')}`, '_blank', ); }); @@ -23,7 +23,7 @@ describe('openExternalUrl', () => { it('opens a plain new tab elsewhere', () => { const open = vi.fn(); vi.stubGlobal('window', { open }); - openExternalUrl('https://t.me/some_bot'); - expect(open).toHaveBeenCalledWith('https://t.me/some_bot', '_blank'); + openExternalUrl('https://telegram.me/some_bot'); + expect(open).toHaveBeenCalledWith('https://telegram.me/some_bot', '_blank'); }); }); diff --git a/ui/src/lib/telegram.test.ts b/ui/src/lib/telegram.test.ts index eb53b7c..688a2e0 100644 --- a/ui/src/lib/telegram.test.ts +++ b/ui/src/lib/telegram.test.ts @@ -148,7 +148,7 @@ describe('routeExternalLinkInTelegram', () => { it('leaves a t.me link to the native handler (openTelegramLink owns those)', () => { const openLink = stubInside(); - expect(routeExternalLinkInTelegram({ href: 'https://t.me/some_bot', target: '_blank' })).toBe(false); + expect(routeExternalLinkInTelegram({ href: 'https://telegram.me/some_bot', target: '_blank' })).toBe(false); expect(openLink).not.toHaveBeenCalled(); }); diff --git a/ui/src/lib/telegram.ts b/ui/src/lib/telegram.ts index 50b0772..01b0117 100644 --- a/ui/src/lib/telegram.ts +++ b/ui/src/lib/telegram.ts @@ -226,19 +226,19 @@ export function isExternalHttpUrl(href: string): boolean { export function routeExternalLinkInTelegram(anchor: { href: string; target: string }): boolean { if (!insideTelegram()) return false; if (anchor.target !== '_blank') return false; - if (anchor.href.startsWith('https://t.me/')) return false; + if (anchor.href.startsWith('https://telegram.me/')) return false; if (!isExternalHttpUrl(anchor.href)) return false; return telegramOpenExternalLink(anchor.href); } /** * shareTelegramLink opens Telegram's native "share to a chat" picker for url with a - * caption, through the Mini App SDK (https://t.me/share/url). Returns false outside + * caption, through the Mini App SDK (https://telegram.me/share/url). Returns false outside * Telegram or when the SDK lacks the method, so the caller can fall back to the Web * Share API. Works consistently on iOS and Android within Telegram. */ export function shareTelegramLink(url: string, text: string): boolean { - return telegramOpenLink(`https://t.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`); + return telegramOpenLink(`https://telegram.me/share/url?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`); } /** TelegramLaunch is the data a Mini App launch carries. */ From 471fadc6a45450e1c4718f51f0b366a997fceaf7 Mon Sep 17 00:00:00 2001 From: Ilia Denisov Date: Tue, 14 Jul 2026 09:38:42 +0200 Subject: [PATCH 4/4] =?UTF-8?q?fix(ui):=20offline=20in-game=20=E2=80=94=20?= =?UTF-8?q?usable=20dictionary=20check=20+=20hide=20(not=20disable)=20resi?= =?UTF-8?q?gn/chat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes from contour testing of the offline-in-game UX: - The dictionary word check was unusable offline (Check button disabled) when the panel was reached while already offline: CheckScreen fetched the variant + pinned version over the network in onMount, which fails offline, leaving the default variant so input sanitising stripped every letter. Seed both from the cached game (present once the board has opened) so the input and the on-device dawg fallback work without a round-trip; the network refresh still runs when online and on a cold deep-link. - The resign and chat controls were only functionally disabled (chat) or not gated at all (resign) offline, so they still looked active. Hide both while offline, matching the frozen social controls. Tests: the in-game offline e2e now asserts the drawer action icons are hidden (not disabled); a new e2e guards the offline dictionary flow. Docs updated. --- docs/ARCHITECTURE.md | 4 +-- docs/FUNCTIONAL.md | 5 ++-- docs/FUNCTIONAL_ru.md | 5 ++-- ui/e2e/ingame-ux.spec.ts | 47 +++++++++++++++++++++++++++++++--- ui/src/game/CheckScreen.svelte | 18 ++++++++++--- ui/src/game/Game.svelte | 8 ++++-- 6 files changed, 71 insertions(+), 16 deletions(-) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 610c987..25de66e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -124,8 +124,8 @@ dropped). Horizontal scaling is explicit future work. switch and no device-local create paths. The machine still tracks reachability there, though: a connection lost **inside an online game** is surfaced on **every platform**, driven off the machine's confirmed-offline state (`netState.offline`, not `offlineMode.active`) — the game screen shows a - *connection lost* banner and **freezes** the tray, the move controls, the add-friend/block controls and - the chat/dictionary entry (a started move stays a draft, re-committed by the player on reconnect), and + *connection lost* banner, **freezes** the tray and move controls, and hides the resign, add-friend/block + and chat/dictionary controls (a started move stays a draft, re-committed by the player on reconnect), and the word-check tool falls back to the game's pinned on-device dictionary (`ui/src/lib/dict/check.ts`, exact when that dawg is cached, else *unavailable*) with its network-only complaint and external look-up hidden. diff --git a/docs/FUNCTIONAL.md b/docs/FUNCTIONAL.md index f5a7951..1521ed4 100644 --- a/docs/FUNCTIONAL.md +++ b/docs/FUNCTIONAL.md @@ -328,8 +328,9 @@ offline, so you are never interrupted for a hiccup. **Losing the connection while inside an online game** is surfaced on **every platform, including the Telegram/VK mini-apps** — unlike the offline-play mode above, which is web/native only — because an online game needs the server for every move. A slim *connection lost* banner appears at the top of the -board and the play area **freezes**: the rack, the move controls, the add-friend/block controls and the -chat/dictionary entry all disable, while a move you had started stays on the board as a draft. Nothing +board and the play area **freezes**: the rack and the move controls disable, and the resign, the +add-friend/block and the chat/dictionary controls are hidden, while a move you had started stays on the +board as a draft. Nothing is sent; when the connection returns the banner clears, the controls come back and you commit the move yourself. If you were already in the chat or the dictionary when the drop happened you stay there — chat becomes read-only (send and nudge disable) and the dictionary keeps checking words against the game's diff --git a/docs/FUNCTIONAL_ru.md b/docs/FUNCTIONAL_ru.md index 1d8cf7a..8901aeb 100644 --- a/docs/FUNCTIONAL_ru.md +++ b/docs/FUNCTIONAL_ru.md @@ -332,8 +332,9 @@ e-mail) либо ввод фразы. Активные игры форфейтя **Потеря связи внутри онлайн-партии** показывается на **всех платформах, включая мини-приложения Telegram/VK** — в отличие от офлайн-режима игры выше, который только для веба и нативного приложения, — потому что онлайн-партии сервер нужен на каждый ход. Сверху доски появляется тонкий баннер *связь -потеряна*, и игровая область **замораживается**: рэк, ходовые кнопки, кнопки «в друзья»/«заблокировать» -и вход в чат/словарь отключаются, а начатый ход остаётся на доске черновиком. Ничего не отправляется; +потеряна*, и игровая область **замораживается**: рэк и ходовые кнопки отключаются, а «сдаться», +«в друзья»/«заблокировать» и вход в чат/словарь скрываются; начатый ход остаётся на доске черновиком. +Ничего не отправляется; когда связь возвращается, баннер исчезает, кнопки оживают, и ход отправляешь ты сам. Если связь упала, когда ты уже был в чате или словаре, ты там и остаёшься — чат становится «только для чтения» (отправка и nudge отключаются), а словарь продолжает проверять слова по словарю партии на устройстве. diff --git a/ui/e2e/ingame-ux.spec.ts b/ui/e2e/ingame-ux.spec.ts index 85f005c..2bad7a6 100644 --- a/ui/e2e/ingame-ux.spec.ts +++ b/ui/e2e/ingame-ux.spec.ts @@ -64,13 +64,52 @@ test('online game offline: banner shows, the tray and comms entry freeze, and it expect(n).toBeGreaterThan(0); for (let i = 0; i < n; i++) await expect(tiles.nth(i)).toBeDisabled(); - // The comms entry (💬 — chat + dictionary) is disabled; it lives in the history drawer, so open it. + // The comms entry (💬) and the resign control are HIDDEN offline (like the frozen social controls); + // both live in the history drawer, so open it and assert no action icons remain in its header. await page.locator('.scoreboard').click(); - await expect(page.locator('button:has(.chat-ico)')).toBeDisabled(); + await expect(page.locator('.hhead button.hicon')).toHaveCount(0); - // Recovery: the network returns, the banner clears and the tray is interactive again. + // Recovery: the network returns, the banner clears, the tray is interactive and the comms entry returns. await page.evaluate(() => (window as unknown as { __net: { online(): void } }).__net.online()); await expect(page.locator('.offline-banner')).toHaveCount(0, { timeout: 15000 }); await expect(page.locator('.rack .tile').first()).toBeEnabled(); - await expect(page.locator('button:has(.chat-ico)')).toBeEnabled(); + await expect(page.locator('button:has(.chat-ico)')).toBeVisible(); +}); + +test('online game offline: the dictionary still accepts input and checks (variant seeded from cache)', async ({ page }) => { + await page.goto('/'); + await page.getByRole('button', { name: /guest/i }).click(); + // A Russian (erudit_ru — first in the mock's variant preferences) game, so the offline dictionary is + // exercised with a non-Latin alphabet that differs from the panel's default 'scrabble_en'. The panel + // seeds its variant + pinned version from the cached game; the mock resolves gameState even offline + // (no kill switch), so on the real backend — where that fetch fails offline — the seed is what keeps + // the input and the dawg fallback working. This guards the offline dictionary flow end-to-end. + await page.getByRole('button', { name: /🎲/ }).click(); + await page.getByRole('button', { name: 'Random player' }).click(); + await page.locator('.variant').first().click(); + await page.getByRole('button', { name: /Start game/i }).click(); + await page.evaluate(() => (window as unknown as { __mock: { joinOpponent(): void } }).__mock.joinOpponent()); + await expect(page.getByText('Robo')).toBeVisible(); + + // Go offline, then open the dictionary directly (its in-game entry is hidden offline) so CheckScreen + // mounts with no network and must seed the variant/version from the cached game, not a failed fetch. + await page.evaluate(() => (window as unknown as { __net: { offline(): void } }).__net.offline()); + await expect(page.locator('.offline-banner')).toBeVisible({ timeout: 15000 }); + await page.evaluate(() => { + const route = location.hash.slice(1); // /game/ + (window as unknown as { __router: { navigate(p: string): void } }).__router.navigate(route + '/check'); + }); + + // The check input keeps the Cyrillic word (the variant is known) and the Check button is usable — + // the outcome the cache seed guarantees on the real backend where the offline gameState fetch fails. + const input = page.locator('.check input'); + await expect(input).toBeVisible(); + await input.fill('СЛОВО'); + await expect(input).toHaveValue('СЛОВО'); + await expect(page.locator('.check button')).toBeEnabled(); + + // Running the check resolves to a verdict (or the neutral offline note), proving the fallback path + // executes rather than hanging. + await page.locator('.check button').click(); + await expect(page.locator('.verdict')).toBeVisible(); }); diff --git a/ui/src/game/CheckScreen.svelte b/ui/src/game/CheckScreen.svelte index e1b2211..5d4e48f 100644 --- a/ui/src/game/CheckScreen.svelte +++ b/ui/src/game/CheckScreen.svelte @@ -8,6 +8,7 @@ import { alphabetLetters } from '../lib/alphabet'; import { canCheckWord, dictionaryLookupUrl, sanitizeCheckWord } from '../lib/checkword'; import { onExternalLinkClick } from '../lib/links'; + import { getCachedGame } from '../lib/gamecache'; import type { Variant } from '../lib/model'; // Word-check on its own screen: unlimited dictionary lookups, each with a @@ -25,15 +26,24 @@ const checked = new Map(); onMount(async () => { + // Seed the variant + pinned version from the cached game first (present once the board has opened, + // and preloaded for ongoing games): an online game's dictionary must keep working while offline, + // where the gameState call below cannot run. The variant's alphabet is already cached from opening + // the board, so input sanitising and the offline dawg fallback work off the seed alone. + const cached = getCachedGame(id)?.view.game; + if (cached) { + variant = cached.variant; + dictVersion = cached.dictVersion; + } try { - // Include the alphabet so input sanitising + the check accept the variant's letters. Routed - // through gameSource so an offline (local) game resolves its state from the device, not the - // network. + // Refresh over the network (and cache the alphabet on a cold deep-link that skipped the board). const st = await gameSource(id).gameState(id, true); variant = st.game.variant; dictVersion = st.game.dictVersion; } catch (e) { - handleError(e); + // Offline or a transient failure: the cache seed already set variant + version, so only surface + // an error when there was nothing cached to fall back to. + if (!cached) handleError(e); } }); diff --git a/ui/src/game/Game.svelte b/ui/src/game/Game.svelte index dfdd4b2..021945f 100644 --- a/ui/src/game/Game.svelte +++ b/ui/src/game/Game.svelte @@ -1607,6 +1607,10 @@ {:else if view.game.hotseat} + {:else if !netReady} + + {:else} {/if} @@ -1615,8 +1619,8 @@ chat, so its hub is Dictionary-only (CommsHub), and once finished the dictionary closes too — so drop the entry only when a local game is finished; an active local game keeps it for the Dictionary. An online game always keeps it (chat outlives the game). --> - {#if !(gameOver && (view.game.vsAi || view.game.hotseat))} - {/if}