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
Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
This commit is contained in:
@@ -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'">💻 Консоль</a>
|
||||
<a href="./configurator.html">⚙ Конфигуратор</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 {
|
||||
|
||||
Reference in New Issue
Block a user