Files
ryan.mcgee 2250cdd0ec Support hosting at a URL sub-path via OCTOCAM_BASE_PATH
When OCTOCAM_BASE_PATH is set (e.g. /octocam), all routes are served
under that prefix and the bare prefix without trailing slash gets a
301 redirect to the canonical form with trailing slash.

Implementation:
- Config: OCTOCAM_BASE_PATH env var, normalized to ensure leading
  slash and stripped trailing slash
- Server: when base path is set, wrap the existing mux with
  http.StripPrefix and add a redirect handler for the bare prefix.
  All internal routes stay registered at their root paths so the same
  mux works whether the prefix is empty or not.
- Templates: index.html and feed.html receive a BasePath template
  variable used to construct all asset, stream, link, and JS fetch
  URLs. Standalone /raw and /overlay pages prefix StreamURL and
  OtherURL in server.go before rendering.
- Redirect from /overlay (when overlay disabled) now goes to
  BasePath + "/" instead of "/"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 14:52:12 -05:00
..