feat: shop buy-coins CTA, pin chats (max 3), surrender cooldown, OTP hardening
CI/CD / CI - API (dotnet build + engine sim) (push) Successful in 29s
CI/CD / CI - Web (tsc + next build) (push) Successful in 1m9s
CI/CD / Deploy - local stack (db + server + web) (push) Successful in 1m6s

- Shop: when short on coins the detail sheet now shows "{n} more coins" + a
  "Get coins" CTA that opens the buy-coins page (was a dead disabled button).
- Chat: pin/unpin conversations (max 3, persisted to localStorage); pinned float
  to the top with a gold pin. i18n chat.pin/unpin/pinLimit.
- Surrender: server now rate-limits forfeit asks at a human teammate
  (45s per-user cooldown) so it can't be spammed. (Bot teammate still ends
  immediately; teammate confirm dialog already existed.)
- OTP login hardening: Kavenegar send now parses the API status from the body
  (HTTP 200 can still be a failure) + logs it + 12s timeout; client auth fetch
  gets a 20s AbortController timeout so a lost response surfaces an error
  instead of freezing on "sending…".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-15 11:01:14 +03:30
parent 97d3a02a3c
commit 974a6bf0ae
6 changed files with 189 additions and 63 deletions
+15 -5
View File
@@ -80,11 +80,21 @@ export class SignalrService implements OnlineService {
/* ------------------------------ helpers ---------------------------- */
private async api<T>(path: string, body: unknown): Promise<T> {
const res = await fetch(`${SERVER}${path}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
// Bound the request so a hung/lost response (CDN, network) surfaces an error
// instead of freezing the UI (e.g. the OTP "sending…" button forever).
const ctrl = new AbortController();
const timer = setTimeout(() => ctrl.abort(), 20000);
let res: Response;
try {
res = await fetch(`${SERVER}${path}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
signal: ctrl.signal,
});
} finally {
clearTimeout(timer);
}
if (!res.ok) throw new Error(await res.text());
return (await res.json()) as T;
}