Skip to content

v0.52.11: Tela-server: Resolved entry html rawURL

Choose a tag to compare

@ArcaneSphere ArcaneSphere released this 31 Dec 23:51
· 4 commits to main since this release

Here’s a short, clean GitHub-ready summary of the fix and reasoning, focusing on rawURL + baseURL 👇


Summary: Fix SCID reloads & non-index.html entrypoints (rawURL + baseURL)

Problem

  • Some TELA SCIDs do not use index.html (e.g. Snake Deluxe.html, algo4.html)
  • Electron is not forgiving with redirects or / → HTML resolution
  • Reloading a previously opened SCID failed because /add/<SCID> returned only "OK" without the actual entry URL
  • BrowserView needs the exact HTML entry file, not just /tela/<SCID>/

Root Cause

  • tela-server internally knows the real entry file (rawURL)
  • But on idempotent reloads, the server discarded it
  • Electron then tried to load an empty or incorrect URL → ERR_INVALID_URL, redirect loops, or blank pages

Solution

1️⃣ Track two URLs per SCID

  • rawURL → exact HTML entry file
    Example:

    http://localhost:8084/Snake Deluxe.html
    
  • baseURL → directory root for assets & proxying
    Example:

    http://localhost:8084/
    

2️⃣ Return rawURL even when SCID is already loaded

if alreadyLoaded {
    fmt.Fprintf(w, "OK (already loaded): %s", rawURL)
    return
}

This guarantees:

  • First load ✅
  • Reload after tab close ✅
  • Non-index.html SCIDs ✅

3️⃣ Electron always loads the returned URL

const addRes = await fetch(`/add/${scid}?node=...`);
const text = await addRes.text();

let scidURL;
if (text.startsWith("OK: ")) {
  scidURL = text.slice(4).trim();
} else if (text.startsWith("OK (already loaded): ")) {
  scidURL = text.slice("OK (already loaded): ".length).trim();
}

await view.webContents.loadURL(encodeURI(scidURL));

Result

✅ SCIDs with index.html
✅ SCIDs with custom HTML filenames
✅ Reloading SCIDs after tab close
✅ No redirects, no timeouts, no Electron quirks


TL;DR

Return rawURL on every /add/<SCID> call (new or already loaded).
Use baseURL only for proxying assets.

This keeps Electron happy without forcing index.html rewrites 🚀