Skip to content

Plugins page: Documentation link for each plugin - #18

Merged
yurivibes merged 3 commits into
masterfrom
feat/plugin-docs-link
Nov 26, 2026
Merged

yurivibes merged 3 commits into
masterfrom
feat/plugin-docs-link

Conversation

@yurivibes

@yurivibes yurivibes commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

What

  • /plugins: when the plugin's /health reports "docs": "/docs", its row's Details cell ends with a thin horizontal rule and a small Documentation link that opens in a new tab. The Address field and Save address are unchanged.
  • GET /plugins/docs/<name>: the viewer fetches the plugin's docs page with its saved token (X-Plugin-Token, or X-Controller-Token for the Mobile Controller) and serves it under a sandbox CSP. The URL and path come only from the viewer's own config plus the plugin's /health, never from the request. Limits: no redirects, text/html only, 2 MiB max, 10 s timeout. Failures return a 502 page with a link back to /plugins.
  • /api/plugins rows and /api/config/controller carry docs: true/false.
  • PLUGIN_API.md / BUILD_PLUGIN_API.md document the optional docs health field and GET /docs.

Why

The browser never talks to a plugin directly. The ESP32 plugins listen only on 127.0.0.1, and the Mac plugins need a token that a browser tab can't send.

Paired PRs (add GET /docs to each plugin)

A plugin shows the link only after its PR is deployed. Until then its row looks exactly as it does today.

Tested

  • python3 -m unittest discover -s tests -t .: 634 tests OK, 18 new in tests/test_plugin_docs.py (proxy pass-through and CSP, token header, unknown name, invalid docs paths, redirect, non-HTML, oversize, offline, login redirect, status docs).
  • node --check on the plugins.html inline script.
  • Scratch instance with one fake plugin that has docs and one that doesn't: the link shows (in Details, under a rule) only for the first and opens the rendered page in a new tab.

Plugins that advertise "docs" in GET /health get a Documentation link under
their address on /plugins. The link opens /plugins/docs/<name>, which the
viewer fetches from the plugin with its saved token (no redirects, text/html
only, 2 MiB cap) and serves under a sandbox CSP. /api/plugins rows and the
controller's live status carry docs: true/false. PLUGIN_API.md and
BUILD_PLUGIN_API.md document the optional docs field and GET /docs.
@yurivibes
yurivibes merged commit 8fb0eb8 into master Nov 26, 2026
2 checks passed
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