This commit is contained in:
2026-10-20 19:38:18 +07:00
parent 00bd14bac1
commit 4e21fdba4e
8 changed files with 56 additions and 26 deletions
+13 -7
View File
@@ -9,8 +9,8 @@ function parseLatestBuild(readme) {
}
async function loadLatestBuild() {
const status = document.getElementById('build-status');
const download = document.getElementById('build-download');
const statuses = document.querySelectorAll('.build-status');
const downloads = document.querySelectorAll('.build-download');
try {
const response = await fetch('/minecraft/api/readme', {
cache: 'no-store',
@@ -23,12 +23,18 @@ async function loadLatestBuild() {
}
const readme = new TextDecoder().decode(Uint8Array.from(atob(data.content), char => char.charCodeAt(0)));
const build = parseLatestBuild(readme);
status.textContent = `Актуальная версия — ${build.version}`;
download.href = build.url;
download.textContent = `Скачать сборку ${build.version}`;
download.hidden = false;
for (const status of statuses) {
status.textContent = `Актуальная версия — ${build.version}`;
}
for (const download of downloads) {
download.href = build.url;
download.textContent = `Скачать сборку ${build.version}`;
download.hidden = false;
}
} catch {
status.textContent = 'Не удалось определить актуальную версию. Открой репозиторий по ссылке внизу страницы.';
for (const status of statuses) {
status.textContent = 'Не удалось определить актуальную версию. Кнопка откроет репозиторий — выбери актуальную сборку в README.';
}
}
}