feat(admin): surface configuration problems in the admin panel

Add GET /api/admin/health powered by a config health service that
detects common deployment mistakes: missing or read-only data volume,
broken tariffs/locale-override/guides JSON files, payment providers
enabled without credentials, webhook providers without
WEBHOOK_BASE_URL, no enabled payment methods, missing or non-https
mini app URL, missing Redis, partially configured SMTP, untrusted
reverse proxy, invalid bot token, missing/mismatched/failing Telegram
webhook and unreachable Remnawave panel. Network checks (Telegram,
panel) are cached for two minutes; ?refresh=1 forces a re-check.

The admin UI shows the alerts as a banner on the dashboard with
per-section navigation chips and a manual re-check button, and as a
filtered banner inside each affected section. Alerts are localized
via admin_health_* keys with built-in Russian fallbacks.
This commit is contained in:
3252a8
2026-06-10 12:31:41 +03:00
parent ce6273a652
commit 1b2290ea66
12 changed files with 1208 additions and 0 deletions
+24
View File
@@ -1024,6 +1024,30 @@
"admin_section_backups_subtitle": "Archives, uploads, and database/compose restore",
"admin_section_settings_title": "App Settings",
"admin_section_settings_subtitle": "Overrides for .env, applied instantly",
"admin_health_title": "Configuration issues",
"admin_health_refresh": "Check again",
"admin_health_data_dir_missing": "Data directory ({path}) not found. Make sure the data volume is mounted into the container.",
"admin_health_data_dir_not_writable": "No write access to {path} — backups, tariffs, logos and translations cannot be saved.",
"admin_health_backups_dir_not_writable": "Backups directory {path} is not writable.",
"admin_health_tariffs_config_invalid": "Tariffs file {path} cannot be read: {error}",
"admin_health_locale_overrides_invalid": "Translations file {path} is corrupted: {error}",
"admin_health_subscription_page_config_invalid": "Subscription guides config cannot be read: {error}",
"admin_health_provider_not_configured": "Provider {provider} is enabled but not configured — payments through it will not work.",
"admin_health_provider_webhook_needs_base_url": "Provider {provider} requires WEBHOOK_BASE_URL for webhooks, but it is not set.",
"admin_health_no_payment_methods": "No payment method is enabled.",
"admin_health_mini_app_url_missing": "SUBSCRIPTION_MINI_APP_URL is not set — the Mini App button will not appear in the bot.",
"admin_health_mini_app_url_not_https": "SUBSCRIPTION_MINI_APP_URL must start with https:// (currently {url}).",
"admin_health_redis_not_configured": "REDIS_URL is not set — bot dialog states and caches will not survive a restart.",
"admin_health_smtp_incomplete": "SMTP is partially configured — email login will not work.",
"admin_health_proxy_not_trusted": "Requests arrive through proxy {remote} which is not in TRUSTED_PROXIES — payment provider webhooks may be rejected by IP.",
"admin_health_bot_token_invalid": "Telegram rejected BOT_TOKEN — the bot is not working.",
"admin_health_telegram_api_error": "Failed to reach the Telegram API: {error}",
"admin_health_telegram_webhook_missing": "Telegram webhook is not set — the bot does not receive updates.",
"admin_health_telegram_webhook_mismatch": "Telegram webhook points to {actual}, expected {expected}.",
"admin_health_telegram_webhook_error": "Telegram reports a webhook delivery error: {error}",
"admin_health_telegram_webhook_pending": "{count} unprocessed updates are queued in Telegram.",
"admin_health_panel_api_not_configured": "PANEL_API_URL and PANEL_API_KEY are not set — sync and subscription provisioning do not work.",
"admin_health_panel_api_unreachable": "Remnawave panel is unreachable at {url}.",
"admin_backups_load_failed": "Failed to load backups",
"admin_backups_upload_done": "Archive uploaded",
"admin_backups_upload_failed": "Failed to upload archive",