Replace embedded flag with same-origin API probe

- Server serves frontend verbatim (drop window.PYSIM_EMBEDDED injection)
- Frontend probes /api/version once; res.ok -> relative base + cleared URL input,
  otherwise fall back to http://127.0.0.1:8080
- sw.js: never intercept/cache /api/* (live card data)
This commit is contained in:
2026-08-15 14:10:24 +03:00
parent 1971eca381
commit 966ada21eb
3 changed files with 19 additions and 11 deletions
+1
View File
@@ -32,6 +32,7 @@ self.addEventListener('activate', e => {
self.addEventListener('fetch', e => {
if (!e.request.url.startsWith('http')) return;
if (new URL(e.request.url).pathname.startsWith('/api/')) return; // live data, never cache
if (e.request.method !== 'GET') return;
const isNavigate = e.request.mode === 'navigate' || e.request.url.endsWith('sw.js');
if (isNavigate) {