Add Android BLE mesh client and project website

This commit is contained in:
dom4k
2026-03-16 19:04:20 +00:00
parent 2ad5e03cb7
commit c833fd467d
27 changed files with 1539 additions and 0 deletions

50
website/assets/js/app.js Normal file
View File

@@ -0,0 +1,50 @@
document.addEventListener('DOMContentLoaded', () => {
const btn = document.getElementById('downloadBtn');
const versionBadge = document.getElementById('versionBadge');
const versionSummary = document.getElementById('versionSummary');
const downloadMeta = document.getElementById('downloadMeta');
if (!btn) return;
btn.addEventListener('click', (event) => {
if (!btn.getAttribute('href') || btn.getAttribute('href') === '#') {
event.preventDefault();
alert('APK пока не опубликован. Следите за обновлениями проекта.');
}
});
fetch('assets/meta/version.json', { cache: 'no-store' })
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.json();
})
.then((meta) => {
const sizeMb = (meta.apkSizeBytes / (1024 * 1024)).toFixed(1);
const builtAt = new Date(meta.buildDateUtc).toLocaleString('ru-RU', {
dateStyle: 'medium',
timeStyle: 'short'
});
if (versionBadge) {
versionBadge.textContent = `v${meta.versionName} (${meta.versionCode})`;
}
if (versionSummary) {
versionSummary.textContent = `Последняя сборка опубликована ${builtAt} UTC.`;
}
if (downloadMeta) {
downloadMeta.textContent = `Доступна debug-сборка v${meta.versionName}. Размер APK: ${sizeMb} MB.`;
}
if (meta.apkPath) {
btn.setAttribute('href', meta.apkPath);
}
})
.catch(() => {
if (versionBadge) {
versionBadge.textContent = 'Версия недоступна';
}
if (versionSummary) {
versionSummary.textContent = 'Не удалось загрузить метаданные сборки.';
}
});
});