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
Owner

Issue

Closes #9

Summary

  • Backend: GET /api/list-wavs lists WAV files; GET /wavs/ serves static WAVs from ./output/wavs
  • Web UI: WAV Browser section with AudioContext-based playback (zero deps), progress bar, time display, file grid with Play buttons

Testing

  • 3 new tests for handleListWavs
  • Fix TestFindAkaiutil with t.Chdir(tmp) to avoid accidentally finding repo akaiutil binary
  • 65% coverage, go vet clean, golangci-lint 0 issues
## Issue Closes #9 ## Summary - Backend: GET /api/list-wavs lists WAV files; GET /wavs/ serves static WAVs from ./output/wavs - Web UI: WAV Browser section with AudioContext-based playback (zero deps), progress bar, time display, file grid with Play buttons ## Testing - 3 new tests for handleListWavs - Fix TestFindAkaiutil with t.Chdir(tmp) to avoid accidentally finding repo akaiutil binary - 65% coverage, go vet clean, golangci-lint 0 issues
david added 1 commit 2026-06-22 07:01:32 +00:00
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
david added 1 commit 2026-06-22 07:02:37 +00:00
Avoid 'Cannot read properties of null (reading error)' when server
returns null or non-JSON. Also check resp.ok before parsing JSON.
david added 1 commit 2026-06-22 07:10:56 +00:00
- 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
david added 1 commit 2026-06-22 07:16:45 +00:00
@electron/rebuild and node-abi require node >=22.12.0.
System node (22.9.0) caused EBADENGINE errors during electron-build.
david added 1 commit 2026-06-22 07:22:23 +00:00
electron-builder requires an exact version (not a range like ^33.0.0)
because it downloads platform-specific binaries for a specific release.
david added 1 commit 2026-06-22 07:42:20 +00:00
david added 1 commit 2026-06-22 07:46:32 +00:00
var files []string marshals to JSON null, breaking the frontend
which expects an array. Using files := []string{} ensures [].
david added 1 commit 2026-06-22 08:05:47 +00:00
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.
david added 1 commit 2026-06-22 08:10:42 +00:00
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.
david added 1 commit 2026-06-22 09:23:27 +00:00
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
david merged commit b5650c53ba into main 2026-06-22 09:25:29 +00:00
david deleted branch feat/audio-preview-player 2026-06-22 09:25:29 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/akai-utils#14