feat: local releases for offline/CORS-free flasher
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled

This commit is contained in:
UA1ZBE
2026-06-05 10:04:21 +03:00
parent 8d4dd4965d
commit c9ae94a0ff
3 changed files with 39 additions and 3 deletions

View File

@@ -207,6 +207,7 @@
<nav style="justify-content:center;gap:1rem;">
<a href="#" @click.prevent="view='releases'; selectedRelease=null; selectedAsset=null">Список релизов</a>
<a href="#" @click.prevent="view='console'">&#128187; Консоль</a>
<a href="./configurator.html">&#9881; Конфигуратор</a>
<a href="https://git2.ua1zbe.ru/ua1zbe/meshcore-simple-sensor" target="_blank">Git2.ua1zbe.ru</a>
</nav>
</footer>
@@ -253,11 +254,21 @@
async loadReleases() {
this.loading = true;
this.error = '';
// If same origin, no CORS needed
// Try local releases.json first (no CORS), then API, then CORS proxy
try {
const localRes = await fetch('./releases.json');
if (localRes.ok) {
const data = await localRes.json();
this.releases = Array.isArray(data) ? data.reverse() : [];
this.loading = false;
return;
}
} catch {}
if (OWN_ORIGIN === API_ORIGIN) {
return this._fetchDirect();
await this._fetchDirect();
this.loading = false;
return;
}
// Try direct, fallback to CORS proxy
try {
await this._fetchDirect();
} catch {

25
flasher/releases.json Normal file
View File

@@ -0,0 +1,25 @@
[
{
"id": 1,
"tag_name": "beacon-v1.0.0",
"name": "Beacon Sensor v1.0.0",
"body": "Прошивка Beacon Sensor для Heltec T114\n\n- Автоматическая отправка flood-объявления каждые 15 минут\n- ADV_TYPE_CHAT с ретрансляцией\n- Поддержка BMP280 по I2C (Wire1, SDA=7, SCL=8)\n- BLE (пин 123456)\n- Радиопараметры: 868.731 MHz, SF7, BW62.5, CR7\n\n## Сборка\npio run -e Heltec_t114_without_display_beacon_sensor_ble -t create_uf2\n\n## Прошивка (UF2)\n1. Зажми BOOT на T114, подключи USB\n2. Перетащи firmware.uf2 на диск T114",
"published_at": "2026-06-05T06:36:40Z",
"assets": [
{
"id": 1,
"name": "Heltec_T114_Beacon_BLE.uf2",
"size": 887296,
"download_count": 12,
"browser_download_url": "./releases/Heltec_T114_Beacon_BLE.uf2"
},
{
"id": 2,
"name": "Heltec_T114_Beacon_BLE.dfu.zip",
"size": 305769,
"download_count": 3,
"browser_download_url": "./releases/Heltec_T114_Beacon_BLE.dfu.zip"
}
]
}
]

Binary file not shown.