Repository navigation
Plugins page: Documentation link for each plugin - #18
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/healthreports"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, orX-Controller-Tokenfor 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/htmlonly, 2 MiB max, 10 s timeout. Failures return a 502 page with a link back to /plugins./api/pluginsrows and/api/config/controllercarrydocs: true/false.PLUGIN_API.md/BUILD_PLUGIN_API.mddocument the optionaldocshealth field andGET /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 /docsto 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 intests/test_plugin_docs.py(proxy pass-through and CSP, token header, unknown name, invalid docs paths, redirect, non-HTML, oversize, offline, login redirect, statusdocs).node --checkon the plugins.html inline script.