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.
67 lines
1.3 KiB
Python
67 lines
1.3 KiB
Python
"""Compatibility facade for the admin Mini App API."""
|
|
|
|
# ruff: noqa: I001
|
|
|
|
from bot.app.web.admin_api_impl import (
|
|
_runtime as _runtime,
|
|
ads as _ads,
|
|
auth as _auth,
|
|
backups as _backups,
|
|
broadcast as _broadcast,
|
|
common as _common,
|
|
health as _health,
|
|
logs as _logs,
|
|
panel as _panel,
|
|
payments as _payments,
|
|
promos as _promos,
|
|
routes as _routes,
|
|
settings as _settings,
|
|
stats as _stats,
|
|
support as _support,
|
|
sync as _sync,
|
|
tariffs as _tariffs,
|
|
themes as _themes,
|
|
translations as _translations,
|
|
users as _users,
|
|
)
|
|
|
|
_MODULES = (
|
|
_runtime,
|
|
_auth,
|
|
_common,
|
|
_health,
|
|
_stats,
|
|
_users,
|
|
_payments,
|
|
_promos,
|
|
_logs,
|
|
_support,
|
|
_broadcast,
|
|
_sync,
|
|
_ads,
|
|
_backups,
|
|
_settings,
|
|
_tariffs,
|
|
_themes,
|
|
_translations,
|
|
_panel,
|
|
_routes,
|
|
)
|
|
|
|
_NAMESPACE = {}
|
|
for _module in _MODULES:
|
|
_NAMESPACE.update(
|
|
{
|
|
_name: _value
|
|
for _name, _value in vars(_module).items()
|
|
if not _name.startswith("__") and _name != "annotations"
|
|
}
|
|
)
|
|
|
|
for _module in _MODULES:
|
|
vars(_module).update(_NAMESPACE)
|
|
|
|
globals().update(_NAMESPACE)
|
|
|
|
__all__ = sorted(_name for _name in _NAMESPACE if not _name.startswith("__"))
|