From baaef7c8fa61f9affe9b8b62511f004c9f95fb2c Mon Sep 17 00:00:00 2001 From: William Emfinger Date: Tue, 18 Aug 2026 16:17:16 -0500 Subject: [PATCH] feat(docs): auto-generated web-apps landing page + generalized app hosting - The docs workflow now hosts ANY component's web/ directory (components/*/web/*.html + .js) automatically instead of hardcoding the two existing dirs, and generates docs/apps/index.html afterward. - New doc/generate_apps_index.py builds the landing page from each app's and <meta name=description> -- a future app is listed by simply having those two tags, no registry to maintain. Theme-aware (light/dark), responsive card grid. - Added <meta name=description> to all five existing apps (head-only edits). - New doc/en/web_apps.rst (linked from the docs index) describing the hosted tools and the add-an-app convention. Verified locally: the generator indexes all 5 apps with titles+descriptions and the output parses cleanly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --- .github/workflows/build_and_publish_docs.yml | 18 ++-- .../odrive_ascii/web/hid_visualizer.html | 1 + .../odrive_ascii/web/odrive_console.html | 1 + .../web/odrive_control_panel.html | 1 + .../web/odrive_webusb_console.html | 1 + components/usb_device/web/board_console.html | 1 + doc/en/index.rst | 4 +- doc/en/web_apps.rst | 32 ++++++ doc/generate_apps_index.py | 102 ++++++++++++++++++ 9 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 doc/en/web_apps.rst create mode 100644 doc/generate_apps_index.py diff --git a/.github/workflows/build_and_publish_docs.yml b/.github/workflows/build_and_publish_docs.yml index bc5866fb76..b8769a1053 100644 --- a/.github/workflows/build_and_publish_docs.yml +++ b/.github/workflows/build_and_publish_docs.yml @@ -53,22 +53,24 @@ jobs: # Host the interactive single-file web apps (Web Serial / WebUSB / # WebHID tools) alongside the docs. GitHub Pages serves over https # (a secure context), so the browser APIs work directly from these - # hosted copies. + # hosted copies. ANY component's web/ directory is hosted + # automatically -- drop an .html (plus optional same-origin .js + # assets) into components/<name>/web/ and it ships. mkdir -p ../docs/apps # nullglob makes a "no matches" case a no-op (the glob expands to # nothing) while a genuine copy error still fails the job, instead # of being swallowed by `|| true`. shopt -s nullglob - consoles=(../components/odrive_ascii/web/*.html) - if [ ${#consoles[@]} -gt 0 ]; then - cp "${consoles[@]}" ../docs/apps/ + apps=(../components/*/web/*.html ../components/*/web/*.js) + if [ ${#apps[@]} -gt 0 ]; then + cp "${apps[@]}" ../docs/apps/ else - echo "No hosted web consoles found to copy." >&2 + echo "No hosted web apps found to copy." >&2 fi - for f in ../components/usb_device/web/*.html ../components/usb_device/web/*.js; do - cp "$f" ../docs/apps/. - done shopt -u nullglob + # Generate the landing page (docs/apps/index.html) listing every + # hosted app by its <title> + <meta name="description">. + python3 generate_apps_index.py ../docs/apps - name: Build Documentation (PDF) run: | diff --git a/components/odrive_ascii/web/hid_visualizer.html b/components/odrive_ascii/web/hid_visualizer.html index 63efd2264d..5a0da898bd 100644 --- a/components/odrive_ascii/web/hid_visualizer.html +++ b/components/odrive_ascii/web/hid_visualizer.html @@ -4,6 +4,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>WebHID Gamepad Input Visualizer +