Skip to content

Serve the page with relative addresses so it works under a path prefix - #46

Merged
jpittelkow merged 1 commit into
mainfrom
relative-urls
Nov 26, 2026
Merged

jpittelkow merged 1 commit into
mainfrom
relative-urls

Conversation

@jpittelkow

Copy link
Copy Markdown
Contributor

What this changes and why

WhatsOn asked for its files and the API by absolute path (/static/..., /api/...). Behind a proxy that serves it from a sub-path, such as a Home Assistant ingress panel at /api/ingress/whatson/, every one of those requests went to the proxy's root, so the page loaded with no styles or scripts.

The page now uses relative addresses: a rel() helper in core.js used by api(), a relative thumbUrl, relative links in index.html, the two direct /api/status fetches, and the Jellyfin channel thumbnail URL built on the server. Opening WhatsOn at its own address works as before.

How it was tested

  • python scripts/check.py prints "all checks passed" (tests, guard tests, privacy, JS)
  • New or changed behaviour has a test that fails without this change (tests/test_subpath.py)
  • CHANGELOG.md (Unreleased) updated, if a user would notice
  • For screen changes: checked at phone width and in light and dark mode (no visual change)

Tried on real hardware (TV model and app, or "not tried"): not tried; no TV-side change.

Not tested: the page itself inside a real Home Assistant ingress panel. Requests through a stand-in path-prefix proxy resolved, and the page at its own address loaded with no console errors.

Decisions and docs

ADRs I reviewed for this area (numbers): none cover front-end URLs.

  • This makes or reverses a design decision, and adds or supersedes an ADR:
  • No ADR needed (say why, in a few words): no design decision changes; addresses become relative
  • Nothing here goes against an accepted ADR
  • docs/ and the README still match the code, or were updated here (docs/configuration.md, docs/testing.md)

Security (tick what applies)

  • Saves a key or token, or changes where one is sent
  • Calls an address typed in Settings, or a new outside service
  • Changes the X-WhatsOn or host checks, or the check for something already playing on a TV
  • Changes what's sent to Radarr or Sonarr
  • Changes tests/test_guards.py (explain why the rule itself should change)
  • None of the above

AI use

  • No AI was used
  • AI helped. Tool, and what it did: Claude Code wrote the change, the test and the docs
  • A person read the whole diff and can explain it

Checks

  • One change only, with no unrelated cleanups
  • No keys, tokens or details of a real home in the code, tests, logs or screenshots
  • No new dependencies, workflow changes or version bumps, or they were agreed in an issue

🤖 Generated with Claude Code

The page and its scripts asked for /static and /api by absolute path, so behind a
proxy that serves WhatsOn from a sub-path (a Home Assistant ingress panel at
/api/ingress/whatson/) every request went to the proxy's root instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jpittelkow
jpittelkow merged commit 5b90767 into main Nov 26, 2026
3 checks passed
@jpittelkow
jpittelkow deleted the relative-urls branch November 26, 2026 19:01
@jpittelkow jpittelkow mentioned this pull request Nov 26, 2026
jpittelkow added a commit that referenced this pull request Nov 26, 2026
Version files and CHANGELOG for 0.2.9: the page works under a path
prefix (#46). After merge, tag `v0.2.9` on the merge commit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Jeff Pittelkow <6314033+jpittelkow@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant