feat: Audio Preview Player #14

Merged
david merged 10 commits from feat/audio-preview-player into main 2026-06-22 09:25:29 +00:00

10 Commits

Author SHA1 Message Date
david b5650c53ba test: add JS test framework using Node built-in test runner
Extracted pure utility functions (esc, sanitize, formatBytes, formatTime)
into web/ui/util.js with CommonJS export for Node testing compatibility.
Added 19 tests across 4 suites using node:test + node:assert (zero deps).

- util.js: browser-compatible utility functions
- util.test.js: 19 tests (5 esc, 3 sanitize, 6 formatBytes, 5 formatTime)
- package.json: 'test' script → node --test util.test.js
- mise.toml: js-test task
- app.js: removed duplicate helper functions (now in util.js)
- index.html: load util.js before app.js
2026-06-22 02:23:24 -07:00
david d7a17eb054 fix: show extract API errors in UI instead of false 'Extraction complete'
doExtract() only checked data.message, so JSON responses with
error key (e.g. 'no ISO files found') would show green success.
Now checks data.error first and displays it in red.
2026-06-22 01:10:40 -07:00
david fe3e92ce33 feat: recursive WAV browsing in subdirectories
Handle ListWavs now uses filepath.WalkDir to find .wav files
in all subdirectories. Returns relative paths (e.g. Kicks/kick.wav).
Serves them correctly via /wavs/ prefix.

Fixed: WalkDir swallows root errors differently than ReadDir —
now detects and reports non-existent root directory errors.

Added test for recursive subdirectory traversal.
2026-06-22 01:05:44 -07:00
david 371feaf0cb fix: initialize files as empty slice instead of nil var
var files []string marshals to JSON null, breaking the frontend
which expects an array. Using files := []string{} ensures [].
2026-06-22 00:46:30 -07:00
david b69e1d81ab debug: add console logging to browseWavs and playWav 2026-06-22 00:42:18 -07:00
david cd8484de0c fix: pin electron to exact version 33.4.11
electron-builder requires an exact version (not a range like ^33.0.0)
because it downloads platform-specific binaries for a specific release.
2026-06-22 00:22:19 -07:00
david d194a25bf8 chore: pin node to 22.12 to fix electron-build engine requirements
@electron/rebuild and node-abi require node >=22.12.0.
System node (22.9.0) caused EBADENGINE errors during electron-build.
2026-06-22 00:16:42 -07:00
david 4f03524668 chore: add JS/ESLint toolchain, refactor onclick to event delegation
- Add ESLint config for web/ui (flat config, golangci-lint-compatible)
- Add js-lint task to mise.toml (npm run lint in web/ui)
- Add ESLint check to check-toolchain.sh
- Add .golangci.yml for golangci-lint v2 with correct exclusions
- Refactor app.js: replace inline onclick with data-action + event delegation
- Add null checks and HTTP status checks to browseWavs
- Add web/ui/node_modules/ to .gitignore
2026-06-22 00:10:49 -07:00
david f716902580 fix: handle null data in browseWavs, add HTTP status check
Avoid 'Cannot read properties of null (reading error)' when server
returns null or non-JSON. Also check resp.ok before parsing JSON.
2026-06-22 00:02:32 -07:00
david cf53912a33 feat: Audio Preview Player — browse and play WAV samples via Web Audio API
Issue: #9

Backend:
- GET /api/list-wavs?dir=<path> — lists .wav files in a directory
- GET /wavs/<file> — static file serving from ./output/wavs

Web UI:
- WAV Browser section with path input + Browse button
- AudioContext-based playback (zero deps) — progress bar, time display
- WAV file grid with Play buttons, active item highlighting

Tests:
- 3 new tests for handleListWavs (wav files, empty dir, nonexistent dir)
- Fix TestFindAkaiutil: add t.Chdir(tmp) so relative path lookups don't
  accidentally find the repo's third_party/akaiutil/akaiutil binary
2026-06-22 00:01:15 -07:00