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 {