Skip to content

feat(ftw-0x-beta): let people pin FTW to Home Assistant's sidebar - #26

Merged
frahlg merged 3 commits into
srcfl:mainfrom
HuggeK:feat/ha-sidebar-panel
Nov 12, 2026
Merged

frahlg merged 3 commits into
srcfl:mainfrom
HuggeK:feat/ha-sidebar-panel

Conversation

@HuggeK

@HuggeK HuggeK commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Note

Stopgap until #25 ships. #25 together with srcfl/ftw#1786 runs FTW itself inside Home Assistant's sidebar as an iframe, like other add-ons. #1786 sends frame-ancestors 'self'/SAMEORIGIN on ingress requests, rewrites the UI's absolute URLs under X-Ingress-Path and trusts Supervisor-authenticated requests as the owner. #25 is blocked until a FTW beta containing #1786 is published. This PR offers the sidebar entry with today's FTW package and needs no Core change. The two PRs conflict (same ftw-0x-beta files and the ingress slot), so close this one when #25 is ready to merge, or skip it if #25 lands soon.

Lets people pin FTW to Home Assistant's sidebar. The app now turns on ingress, so its Info tab offers Show in sidebar. The sidebar entry (and Open web UI) opens a small launcher page with an Open FTW button, which opens FTW on port 8080 in a new tab.

  • config.yaml: ingress: true, ingress_port: 8093, panel_icon: mdi:solar-power-variant, panel_title: FTW. webui, ports and the update flow are unchanged.
  • panel/index.html: a static page with no external assets. It builds the FTW address from the hostname used to reach HA and warns when that hostname isn't local by FTW's own rules (private/loopback IP, localhost, .local/.localhost/.home.arpa). English, plus Swedish when the browser language is sv.
  • run.sh / Dockerfile: adds Debian's busybox and starts busybox httpd as uid 100:101 before Core. If it fails to start, it logs a line and Core starts anyway.
  • panel/httpd.conf: answers only Supervisor's ingress proxy (172.30.32.2), because the port sits on the host network.
  • smoke_native.sh: checks that the panel runs as 100:101 and refuses 127.0.0.1 with 403.
  • DOCS/README: describe Open FTW and Show in sidebar.
Why a launcher instead of embedding FTW in the panel

HA's ingress panel is an iframe. FTW can't run in it today:

  • FTW sends frame-ancestors 'none' / X-Frame-Options: DENY on every response (clickjacking guard from fix(api): refuse to frame the dashboard ftw#909). It matters because, with lan_auth off, every LAN browser is an owner.
  • The web UI uses about 91 absolute URLs (/api/..., /components/..., /setup), which break under /api/hassio_ingress/<token>/.
  • Requests through ingress arrive from Supervisor with forwarding headers (and a public hostname over Nabu Casa), so FTW's locality rules treat them as remote and refuse protected writes.

An embedded panel would need FTW changes: allow frame-ancestors 'self' only for ingress requests, support a base path from X-Ingress-Path, and decide whether an HA-authenticated ingress request counts as an owner. srcfl/ftw#1786 makes exactly these changes; #25 is the app side.

Notes for review
  • Port 8093 is arbitrary. With host_network it must not clash with other add-ons, and 8099 (HA's default) and 8095 (Music Assistant) are common. ingress_port: 0 would need hassio_api to read the assigned port, so I kept a fixed port.
  • "Open web UI" now opens the launcher (HA prefers ingress over webui), so first setup takes one extra click.
  • No version bump or CHANGELOG entry. The app version must equal the FTW tag (native_pin.py), and the pin bot prepends the changelog entry. This reaches users with the next FTW pin. Happy to add an entry wherever you prefer.
  • srcfl/ftw docs/home-assistant-app.md and the Swedish setup guide still say the app does not use ingress. feat(ha): open FTW through HA ingress without a second password ftw#1786 already rewrites them for the embedded mode.

Tested

  • scripts/validate.py, unittest discover -s tests, native_pin.py check: pass (run in python:3.12-slim with scripts/requirements.txt)
  • shellcheck on run.sh, healthcheck.sh, smoke_native.sh: clean
  • Built the image for amd64 and ran scripts/smoke_native.sh against it: PASS. This includes cold backup/restore and "Core death ends the container" with httpd running.
  • On a Docker network shaped like hassio (172.30.32.0/23), a client at 172.30.32.2 gets the page (200) and 172.30.32.9 gets 403.
  • Not tested on a real HA OS/Supervisor: the Show in sidebar toggle and the panel in the HA frontend.

🤖 Generated with Claude Code

Turn on ingress with a small launcher page, so the app's Info tab offers
Show in sidebar. FTW refuses to be framed (frame-ancestors 'none') and its UI
uses absolute paths, so the panel does not embed it: an Open FTW button opens
FTW on port 8080 in a new tab. busybox httpd serves the page as uid 100 and
answers only Supervisor's ingress proxy (172.30.32.2).

Co-authored-by: HuggeK <[email protected]>
@HuggeK
HuggeK marked this pull request as ready for review October 21, 2026 15:28
@HuggeK
HuggeK requested a review from frahlg as a code owner October 21, 2026 15:28

@miravoss26 miravoss26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds an ingress-backed launcher panel so FTW can be pinned to HA's sidebar, since FTW itself refuses to be framed. Panel is a static page that opens FTW on port 8080 in a new tab; busybox httpd serves it, locked to Supervisor's proxy IP only.

Findings:

  • Home Assistant app lint is genuinely red, not flaky: 'webui' should be removed, Ingress is enabled. config.yaml keeps both webui: http://[HOST]:[PORT:8080]/ and ingress: true. The PR body doesn't mention this failure or say whether it's intentional (you note "HA prefers ingress over webui" at runtime, but the addon-linter spec still rejects having both keys set). Worth a decision: drop webui to satisfy the linter, or confirm the combination is deliberate and the check should be waived.
  • Security looks solid on the parts I can check without real HA/Supervisor: panel/httpd.conf ACL (A:172.30.32.2 / D:*) matches the stated intent, index.html builds the URL and writes it via textContent/href rather than innerHTML (no obvious XSS surface), and smoke_native.sh now asserts 403 from a non-Supervisor IP and that the panel runs as uid 100:101, not root.
  • run.sh's panel startup is non-fatal (|| printf ... >&2), so a busybox failure can't block Core — matches the PR's own stated goal.

Not tested against a real HA OS/Supervisor (noted in the PR itself), and the PR description flags this as a stopgap that conflicts with #25 — that call and the lint question both need a human. Everything else reads safe to merge from my read.

The Home Assistant app linter rejects having both keys. Open web UI
now opens the ingress launcher; FTW itself stays on port 8080.

Signed-off-by: Fredrik Ahlgren <[email protected]>
@frahlg

frahlg commented Nov 12, 2026

Copy link
Copy Markdown
Member

Review (Claude CLI, 2026-11-12): the sidebar launcher looks sound (ACL on 172.30.32.2 only, no XSS path, panel failure is non-fatal for Core). Two blockers are now addressed on this branch:

  • Merged current main so the app keeps the v0.163.0-beta.1 pin (the original branch still had v0.154.2-beta.1 and would have downgraded the pin).
  • Removed webui from config.yaml. The Home Assistant app linter requires that once ingress is enabled; Open web UI now opens the launcher, and FTW itself stays on port 8080.

Will squash-merge once Check is green. Users get the sidebar on the next FTW pin, because the app version has to stay equal to the pin.

@frahlg
frahlg merged commit bf162e9 into srcfl:main Nov 12, 2026
7 checks passed
frahlg added a commit that referenced this pull request Nov 28, 2026
Builds on #25's ingress commits (cherry-picked above) and on #26,
which main merged since.

- Drop #26's launcher page and its busybox httpd. Core now answers
  ingress itself on 18099, so the sidebar panel opens FTW directly.
- Drop the `.ha.N` app revision from #25. Fredrik chose to ship
  ingress with the next beta, so the app keeps the Core version.
  Notes under "## Unreleased" in CHANGELOG.md now ship with the
  next pin instead of sitting below it.
- Drop the empty translations; the app has no ports or options.
- Tell people to pair the FTW app with the link or QR: the short
  code needs FTW's own web port, which the app closes.

Refs #25

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>
frahlg added a commit that referenced this pull request Nov 28, 2026
…er, name it FTW (beta) (#56)

* feat: open the FTW app through Home Assistant ingress

(cherry picked from commit af0b502)
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix: use Supervisors default admin-only ingress panel

(cherry picked from commit ff21dc2)
Signed-off-by: Fredrik Ahlgren <[email protected]>

* docs: show the FTW sidebar option in the ingress app

(cherry picked from commit d8d32d9)
Signed-off-by: Fredrik Ahlgren <[email protected]>

* feat(ftw-0x-beta): finish ingress on current main

Builds on #25's ingress commits (cherry-picked above) and on #26,
which main merged since.

- Drop #26's launcher page and its busybox httpd. Core now answers
  ingress itself on 18099, so the sidebar panel opens FTW directly.
- Drop the `.ha.N` app revision from #25. Fredrik chose to ship
  ingress with the next beta, so the app keeps the Core version.
  Notes under "## Unreleased" in CHANGELOG.md now ship with the
  next pin instead of sitting below it.
- Drop the empty translations; the app has no ports or options.
- Tell people to pair the FTW app with the link or QR: the short
  code needs FTW's own web port, which the app closes.

Refs #25

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* feat(ftw-0x-beta): give Core Home Assistant's MQTT broker

The app now declares `services: - mqtt:want`. At start, run.sh asks
Supervisor for the broker (GET http://supervisor/services/mqtt) and
passes host, port, user and password to Core in FTW_HA_MQTT_*. Core
uses them while its own broker setting is empty (paired Core PR), so
FTW's entities appear in Home Assistant without typing anything.

No broker, a refusal, TLS only or a bad answer leaves the variables
unset and logs one line; Core always starts. Only Supervisor's answer
may set them: run.sh unsets any inherited values first.

The image gains jq to read the answer. The smoke test now runs Core
with a Supervisor that offers no broker and checks that Core starts
without one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* feat(ftw-0x-beta): name the app FTW (beta)

Rename the store entry from "FTW (0.x beta)" to "FTW (beta)". The slug
stays ftw-0x-beta, so installs keep their data. The docs now say
"version 0.x" or "3.x" where the retired 3.x app, once also called
FTW (beta), could be confused with this one.

Start on boot is already Supervisor's default (`boot: auto`), and the
app linter refuses a key that repeats a default. It also refuses the
old `watchdog:` key as obsolete: Supervisor's Watchdog acts on the
Docker HEALTHCHECK, which already asks Core's /api/health. So the
manifest gains neither key; the docs drop the Start on boot step and
keep the one Watchdog switch Supervisor leaves off by default.

The README and the install steps get the My Home Assistant button that
opens the add-repository dialog with this repository filled in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* docs(ftw-0x-beta): name the paired Core PR

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

* fix(ftw-0x-beta): steady smoke test; no minimum Home Assistant version

- smoke_native.sh captured nothing before `grep -q`. Under pipefail,
  grep stops reading at its first match, the writer can die of
  SIGPIPE, and the line fails at random. That failed the aarch64 smoke
  in run 46113515200 ("MQTT broker lookup did not report"). The log,
  the redirect headers and the setup page are now read into a variable
  first.
- Drop `homeassistant: "2026.10.2"` from #25. Nothing here needs it:
  ingress and the X-Remote-User-Id header the app relies on come from
  Supervisor (since 2023), which updates itself, and the floor would
  only turn away beta users on an older Home Assistant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Fredrik Ahlgren <[email protected]>

---------

Signed-off-by: Fredrik Ahlgren <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

4 participants