feat(v2): audio page, beat endpoints and an Audio menu button
Restores the live audio section from esp32-eth: /audio page, /audio.wav stream, /beats event feed, POST /tap and /time, and the mic and beat state in /status. The web build adds an Audio entry to the header menu and the mobile dropdown for the v2 copy of index.html only, so the Pi UI is unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d332d447aa
commit
f7ac4ab290
7 files changed
+280
-9
No files matched your search
+15
-1
@@ -21,10 +21,24 @@ for f in "$SRC"/static/*; do
|
||||
*) cp "$f" "$OUT/static/$b" ;;
|
||||
esac
|
||||
done
|
||||
# The Pi does not serve /audio, so the Audio menu entries are added for this build only
|
||||
# (desktop button row and the mobile dropdown, both just before Help).
|
||||
tmp=$(mktemp -d)
|
||||
sed -e "s|<button class=\"btn btn-secondary\" id=\"help-btn\">Help</button>|<button class=\"btn btn-secondary\" id=\"audio-btn\" onclick=\"location.href='/audio'\">Audio</button>\n&|" \
|
||||
-e "s|<button type=\"button\" data-target=\"help-btn\">Help</button>|<button type=\"button\" data-target=\"audio-btn\">Audio</button>\n&|" \
|
||||
"$SRC/templates/index.html" > "$tmp/index.html"
|
||||
cp "$SRC/templates/settings.html" "$tmp/settings.html"
|
||||
grep -q 'id="audio-btn"' "$tmp/index.html" && [ "$(grep -c 'audio-btn' "$tmp/index.html")" -eq 2 ] \
|
||||
|| { echo "ERROR: could not add the Audio menu entries to index.html" >&2; exit 1; }
|
||||
for p in index settings; do
|
||||
npx --yes html-minifier-terser@7.2.0 --collapse-whitespace --remove-comments \
|
||||
--minify-css true --minify-js true -o "$OUT/$p.html" "$SRC/templates/$p.html"
|
||||
--minify-css true --minify-js true -o "$OUT/$p.html" "$tmp/$p.html"
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
|
||||
# Live audio and beat page (served at /audio)
|
||||
npx --yes html-minifier-terser@7.2.0 --collapse-whitespace --remove-comments \
|
||||
--minify-css true --minify-js true -o "$OUT/audio.html" web/audio.html
|
||||
|
||||
# Ship only the .gz copies; the server sends Content-Encoding: gzip
|
||||
find "$OUT" -type f -exec gzip -9 -n -f {} \;
|
||||
|
||||
Reference in new issue
Block a user