From edbe50c046c8f62340832fd66f470cc6a445f277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=80=D0=B5=D0=B2?= Date: Sat, 30 May 2026 04:50:51 +0300 Subject: [PATCH] fix: restore panel boot after PRO refactor hydratePanelPromoFooter was removed in 90f9443 but still called at module load, causing ReferenceError and leaving login/app hidden. Restore footer hydration; drop yellow promo strip from panel UI. Co-authored-by: Cursor --- package.json | 2 +- public/app.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++ public/index.html | 21 +++------------------ 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index c99b0e4..7e1656a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amnezia-admin", - "version": "1.2.29", + "version": "1.2.30", "private": true, "description": "amnezia_web — открытая базовая веб-панель AmneziaWG на VPS (Docker): просмотр и удаление клиентов, MTProto-прокси.", "license": "MIT", diff --git a/public/app.js b/public/app.js index a57cb21..dceb3dc 100644 --- a/public/app.js +++ b/public/app.js @@ -1666,6 +1666,54 @@ function initThemeSwitch() { } } +/** Ссылки доната в подвале панели (`GET /api/panel/footer`). */ +function wirePanelPromoAnchor(el, url, label) { + const u = typeof url === "string" ? url.trim() : ""; + const lb = typeof label === "string" ? label.trim() : ""; + if (!el || !u || !lb) { + if (el) { + el.classList.add("hidden"); + el.removeAttribute("href"); + el.textContent = ""; + } + return false; + } + el.href = u; + el.textContent = lb; + el.classList.remove("hidden"); + return true; +} + +async function hydratePanelPromoFooter() { + const gap1 = document.getElementById("footer-promo-gap1"); + const aDonF = document.getElementById("footer-promo-donate"); + const fSepDO = document.getElementById("footer-promo-sep-donate-ozon"); + const aOzonF = document.getElementById("footer-promo-ozon"); + const fSepOT = document.getElementById("footer-promo-sep-ozon-tg"); + const aTgF = document.getElementById("footer-promo-telegram"); + + try { + const r = await fetch("/api/panel/footer", { credentials: "same-origin" }); + if (!r.ok) return; + const j = await r.json().catch(() => null); + if (!j || typeof j !== "object") return; + + wirePanelPromoAnchor(aDonF, j.donateUrl, j.donateLabel); + wirePanelPromoAnchor(aOzonF, j.ozonUrl, j.ozonLabel); + wirePanelPromoAnchor(aTgF, j.telegramUrl, j.telegramLabel); + + const footerD = aDonF && !aDonF.classList.contains("hidden"); + const footerO = aOzonF && !aOzonF.classList.contains("hidden"); + const footerT = aTgF && !aTgF.classList.contains("hidden"); + + if (gap1) gap1.classList.toggle("hidden", !(footerD || footerO || footerT)); + if (fSepDO) fSepDO.classList.toggle("hidden", !(footerD && (footerO || footerT))); + if (fSepOT) fSepOT.classList.toggle("hidden", !(footerO && footerT)); + } catch { + /* офлайн или сбой — в HTML уже дефолтные ссылки подвала */ + } +} + function initMtprotoLinkCopy() { if (!mtprotoLinkCopyBtn) return; mtprotoLinkCopyBtn.addEventListener("click", async () => { diff --git a/public/index.html b/public/index.html index b180b7f..424b25d 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,7 @@ - + - - - +