From 14ce58f3033673142f4c22d4182dca03d67512cd Mon Sep 17 00:00:00 2001 From: Fedorov Vladimir Date: Sat, 17 Oct 2026 14:13:24 +0700 Subject: [PATCH] up --- docker-compose.yml | 2 +- web/minecraft/app.js | 23 +++++++++++++++++++++++ web/minecraft/index.html | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2a91be5..7709173 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: - TZ=Asia/Novosibirsk - DOCKER_ENABLED=true - STATIC_ENABLED=true - - STATIC_RULES=crabs-games.art,^/minecraft/api/readme$,https://git.3crabs.space/api/v1/repos/user-penguin/gmancraft/contents/README.md?ref=main + - STATIC_RULES=crabs-games.art,^/minecraft/api/readme$,https://git.3crabs.space/api/v1/repos/user-penguin/gmancraft/contents/README.md?ref=main;crabs-games.art,^/minecraft/api/status$,https://api.mcsrvstat.us/3/90.189.218.191:25565 - ASSETS_LOCATION=/web - DEBUG=true - SSL_TYPE=auto diff --git a/web/minecraft/app.js b/web/minecraft/app.js index 2151373..ddefd4a 100644 --- a/web/minecraft/app.js +++ b/web/minecraft/app.js @@ -32,4 +32,27 @@ async function loadLatestBuild() { } } +async function loadServerStatus() { + const status = document.getElementById('server-status'); + try { + const response = await fetch('/minecraft/api/status', { + cache: 'no-store', + signal: AbortSignal.timeout(10000), + }); + if (!response.ok) throw new Error('Статус недоступен'); + const data = await response.json(); + if (data?.online === false) { + status.textContent = 'Сервер недоступен'; + } else if (data?.online === true && Number.isSafeInteger(data.players?.online) && data.players.online >= 0) { + status.textContent = `Игроков онлайн: ${data.players.online}`; + } else { + throw new Error('Неизвестный формат статуса'); + } + } catch { + status.textContent = 'Не удалось получить онлайн'; + } +} + loadLatestBuild(); +loadServerStatus(); +setInterval(loadServerStatus, 5 * 60 * 1000); diff --git a/web/minecraft/index.html b/web/minecraft/index.html index da740f0..2f5a169 100644 --- a/web/minecraft/index.html +++ b/web/minecraft/index.html @@ -16,6 +16,8 @@

Твой следующий
мир начинается здесь.

Скачай сборку, импортируй её в Prism Launcher и заходи на сервер.

Адрес сервера 90.189.218.191:25565

+

Проверяем онлайн…

+ Подключиться к Телемосту ↗