diff --git a/admin.html b/admin.html index e2c6cb4..db11cf1 100644 --- a/admin.html +++ b/admin.html @@ -104,6 +104,7 @@ .nav-item.active { background: var(--accent-dim); color: var(--accent); } .nav-item.active svg { opacity: 1; } .sidebar-footer { margin-top: auto; padding: 10px 0 0; } + .version-tag { text-align: center; font-size: 11px; color: var(--muted2); margin-top: 10px; font-family: "Fira Mono", ui-monospace, monospace; } .main { padding: 30px 40px; max-width: 1120px; } .page-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; } @@ -281,8 +282,10 @@ + @@ -468,6 +471,14 @@ + +
+
Платежи
+
ЮKassa / Platega — история и статус, с проверкой на стороне провайдера при пропущенном вебхуке
+
+ +
ПользовательСерверТарифПровайдерСуммаСозданСтатус
+
@@ -520,6 +531,7 @@ function showView(name) { if (name === "gifts") loadGifts(); if (name === "nodes") loadNodes(); if (name === "traffic") loadTraffic(); + if (name === "payments") loadPayments(); } const COUNTRIES = [ @@ -736,6 +748,35 @@ async function resetTraffic(uuid, btn) { } } +function paymentStatusBadge(status) { + if (status === "paid") return 'оплачен'; + if (status === "failed") return 'не прошёл'; + return 'ожидание'; +} + +async function loadPayments() { + const rows = await api("/admin/api/payments"); + const body = document.getElementById("payments-body"); + body.innerHTML = rows.length ? rows.map((p, i) => ` + + tg${p.tg_id}${esc(p.node_label)}${esc(p.plan_label)} + ${esc(p.provider_label)}${p.amount} ₽${fmtDate(p.created_at)} + ${paymentStatusBadge(p.status)} + ${p.status === "pending" ? `` : ""} + + `).join("") : '
Пока нет платежей
'; +} + +async function checkPayment(id, btn) { + btn.disabled = true; + btn.textContent = "…"; + try { + await api(`/admin/api/payments/${id}/check`, { method: "POST" }); + } finally { + loadPayments(); + } +} + function fmtDate(iso) { return iso ? iso.slice(0, 10) : "—"; } function statusBadge(active, daysLeft) { if (!active) return 'истекла'; diff --git a/api.py b/api.py index 6c16d3b..1356c75 100644 --- a/api.py +++ b/api.py @@ -109,6 +109,8 @@ SUB_PAGE_TEMPLATE = """ }} @keyframes fadeIn {{ to {{ opacity: 1; }} }} .thanks {{ font-size: 13px; color: var(--muted); line-height: 1.5; }} + .thanks a {{ color: var(--accent); text-decoration: none; }} + .thanks a:hover {{ text-decoration: underline; }} .qr-box {{ display: flex; justify-content: center; margin-bottom: 22px; opacity: 0; animation: fadeIn 0.5s var(--ease) 0.3s forwards; @@ -130,7 +132,7 @@ SUB_PAGE_TEMPLATE = """ Открыть ссылку подписки
-
Спасибо, что пользуетесь MBS Panel.
Если Happ не установлен — скачай его в App Store или Google Play.
+
Спасибо, что пользуетесь MBS Panel.
Нет Happ? Скачай: App Store · Google Play