feat(cabinet): recoverable "service unavailable" screen when the backend is unreachable

When the backend was down the cabinet got stuck on a blank loader: the bootstrap
token refresh used bare axios with no timeout (hung forever), and every
interceptor guard required an HTTP response — so a transport-level failure had
zero handling and no error UI ever appeared.

Add a full-screen ServiceUnavailableScreen (extends the existing blocking-store
pattern) shown whenever the backend is unreachable, that auto-recovers when it
returns:
- New 'backend_unavailable' blocking type + BlockingOverlay branch; mirrors
  MaintenanceScreen, CloudWarningIcon, i18n in ru/en/zh/fa.
- api/health.ts: pingBackend() probes the root /health/unified (bypasses the
  /api baseURL + interceptor); URL derived from the origin for remote/sub-path
  deploys; 502/503/504 count as down. reportPossibleBackendDown() confirms an
  outage with a liveness probe before flipping, so a one-off blip never blanks a
  loaded app.
- Detected from the response interceptor (no-response) and the bootstrap refresh
  path; doRefresh gets a timeout so it can no longer hang.
- A transport failure during refresh now PRESERVES the session (distinguished
  from a rejected token via lastFailureWasTransport) instead of logging the user
  out, so recovery actually resumes.
- Recovery lifts the overlay + refetches for an already-loaded session, and only
  hard-reloads when the initial bootstrap never reached the backend — no lost
  form state. Manual retry + 5s auto-poll. Dev proxy for /health.
This commit is contained in:
c0mrade
2026-06-04 12:44:27 +03:00
parent f7bd36a95e
commit ac8a0fc41a
15 changed files with 384 additions and 3 deletions

View File

@@ -4810,6 +4810,13 @@
"openBot": "Open the bot",
"retry": "I pressed /start, retry",
"hint": "After running /start, return here and tap «Retry»."
},
"serviceUnavailable": {
"title": "Service unavailable",
"description": "We can't reach the service right now. It may be undergoing maintenance or there's a temporary connection issue.",
"retry": "Try again",
"checking": "Checking connection...",
"hint": "This page will refresh automatically as soon as the service is back."
}
},
"merge": {

View File

@@ -4470,6 +4470,13 @@
"openBot": "باز کردن ربات",
"retry": "من /start را زدم، دوباره امتحان کن",
"hint": "پس از اجرای /start، به اینجا بازگردید و «دوباره امتحان کنید» را بزنید."
},
"serviceUnavailable": {
"title": "سرویس در دسترس نیست",
"description": "در حال حاضر امکان اتصال به سرویس وجود ندارد. ممکن است در حال تعمیر باشد یا مشکل موقتی در اتصال وجود داشته باشد.",
"retry": "تلاش مجدد",
"checking": "در حال بررسی اتصال...",
"hint": "به‌محض در دسترس قرار گرفتن سرویس، این صفحه به‌طور خودکار بازخوانی می‌شود."
}
},
"merge": {

View File

@@ -5365,6 +5365,13 @@
"openBot": "Открыть бота",
"retry": "Я нажал /start, попробовать снова",
"hint": "После /start вернитесь сюда и нажмите «Попробовать снова»."
},
"serviceUnavailable": {
"title": "Сервис недоступен",
"description": "Не удаётся подключиться к сервису. Возможно, идут технические работы или временные неполадки со связью.",
"retry": "Повторить попытку",
"checking": "Проверяем соединение...",
"hint": "Страница обновится автоматически, как только сервис снова станет доступен."
}
},
"merge": {

View File

@@ -4351,6 +4351,13 @@
"openBot": "打开机器人",
"retry": "我已按 /start重试",
"hint": "运行 /start 后,返回此处并点击「重试」。"
},
"serviceUnavailable": {
"title": "服务不可用",
"description": "暂时无法连接到服务。可能正在进行维护,或存在临时的网络问题。",
"retry": "重试",
"checking": "正在检查连接...",
"hint": "服务恢复后,本页面将自动刷新。"
}
},
"banSystem": {