diff --git a/package.json b/package.json index d68d8e1..8f980cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amnezia-admin", - "version": "1.2.17", + "version": "1.2.18", "private": true, "description": "amnezia_web — базовая панель AmneziaWG (FREE: просмотр и удаление клиентов; полная версия — PRO).", "license": "MIT", diff --git a/public/app.js b/public/app.js index a1ff828..b3272e4 100644 --- a/public/app.js +++ b/public/app.js @@ -366,39 +366,42 @@ async function refreshMtprotoPanel() { mtprotoBanner.textContent = ""; } try { - const s = await api("/api/mtproto/status"); - if (mtprotoLogsTailEl) mtprotoLogsTailEl.textContent = typeof s.logsTail === "string" ? s.logsTail : ""; + const snap = await api("/api/mtproto/status"); + if (mtprotoLogsTailEl) { + mtprotoLogsTailEl.textContent = + typeof snap.logsTail === "string" ? snap.logsTail : ""; + } const parts = []; - if (s.exists) parts.push("контейнер есть"); - if (s.running) parts.push("запущен"); + if (snap.exists) parts.push("контейнер есть"); + if (snap.running) parts.push("запущен"); mtprotoStatusLine.textContent = parts.length > 0 ? parts.join(" · ") + - (s.hostPort ? ` · порт хоста :${String(s.hostPort)}` : "") + - (s.secretMasked ? ` · секрет ${s.secretMasked}` : "") + (snap.hostPort ? ` · порт хоста :${String(snap.hostPort)}` : "") + + (snap.secretMasked ? ` · секрет ${snap.secretMasked}` : "") : "не установлен"; - if (typeof s.hint === "string" && s.hint.trim()) { + if (typeof snap.hint === "string" && snap.hint.trim()) { const hintEl = document.createElement("p"); hintEl.className = "muted warp-muted"; - hintEl.textContent = s.hint.trim(); + hintEl.textContent = snap.hint.trim(); mtprotoActionsEl.appendChild(hintEl); - } else if (s.exists && !s.running && typeof s.image === "string" && s.image.trim()) { + } else if (snap.exists && !snap.running && typeof snap.image === "string" && snap.image.trim()) { const imgHint = document.createElement("p"); imgHint.className = "muted warp-muted"; - imgHint.textContent = `После установки образ будет доступен здесь (${s.image.trim()} при актуальной конфигурации).`; + imgHint.textContent = `После установки образ будет доступен здесь (${snap.image.trim()} при актуальной конфигурации).`; mtprotoActionsEl.appendChild(imgHint); } - if (s.tgLink) { + if (snap.tgLink) { const link = document.createElement("div"); link.className = "mtproto-deep-link muted warp-muted"; const lab = document.createElement("strong"); lab.textContent = "Ссылка в Telegram: "; const a = document.createElement("a"); - a.href = s.tgLink; - a.textContent = s.tgLink; + a.href = snap.tgLink; + a.textContent = snap.tgLink; a.target = "_blank"; a.rel = "noopener noreferrer"; link.append(lab, a); diff --git a/public/index.html b/public/index.html index e5593d0..f99e092 100644 --- a/public/index.html +++ b/public/index.html @@ -261,6 +261,6 @@ - + diff --git a/server.js b/server.js index b724f50..070ce71 100644 --- a/server.js +++ b/server.js @@ -7,6 +7,16 @@ import { fileURLToPath } from "url"; const __dirname = path.dirname(fileURLToPath(import.meta.url)); +/** Из package.json — для мониторинга и проверки, что VPS подняли свежий образ. */ +let PANEL_VERSION = "0.0.0"; +try { + const raw = fs.readFileSync(path.join(__dirname, "package.json"), "utf8"); + const v = JSON.parse(raw)?.version; + if (typeof v === "string" && v.trim()) PANEL_VERSION = v.trim(); +} catch { + /* оставить PANEL_VERSION по умолчанию */ +} + const PORT = Number(process.env.PORT || 3980); const PROFILE_COOKIE = "amnezia_prof"; const SCHEDULER_MS = Number(process.env.SCHEDULE_DISCONNECT_MS || 60_000); @@ -2102,7 +2112,7 @@ app.get("/api/community/install-log", requireAuth, (req, res) => { }); app.get("/health", (_req, res) => { - res.json({ ok: true }); + res.json({ ok: true, version: PANEL_VERSION }); }); app.get("/api/session", (req, res) => { @@ -2983,7 +2993,7 @@ app.use((_req, res) => { app.listen(PORT, "0.0.0.0", () => { const summary = PROFILES.map((p) => `${p.label}→${p.container}`).join("; "); - console.log(`amnezia-admin on :${PORT} · ${summary} · data:${DATA_DIR}`); + console.log(`amnezia-admin v${PANEL_VERSION} on :${PORT} · ${summary} · data:${DATA_DIR}`); }); setInterval(() => {