Skip to content

feat: accept .amf in module allowlist#45

Merged
indigo423 merged 1 commit into
mainfrom
feat/add-amf-playback
May 22, 2026
Merged

feat: accept .amf in module allowlist#45
indigo423 merged 1 commit into
mainfrom
feat/add-amf-playback

Conversation

@indigo423
Copy link
Copy Markdown
Collaborator

@indigo423 indigo423 commented May 22, 2026

Summary

  • libopenmpt already decodes the Asylum Music Format V1.0 (Amiga) and DSMI's Advanced Module Format (PC); both ship as .amf. The bundled wasm decodes them already — the only blocker was the extension allowlist.
  • Widens MODULE_EXTENSIONS so .amf surfaces from Local drag-drop and the Library API (pages/api/library/* consume isModuleFile from components/sources, so this single edit covers client + server).
  • Extends the Amiga-style filename rewriter with an .amf entry plus the self-identity alias matching the pattern every existing native extension follows (idempotency, double-form collapse, case canonicalization all verified by walking the algorithm).

No new engine, worklet, magic-byte sniff, or wasm rebuild. Asylum AMF V1.0 magic ("ASYLUM Music Format V1.0" at offset 0) does not collide with the AHX/THX 4-byte prefix sniff, so the existing magic-dispatch in AudioPlayer.play() falls through to libopenmpt correctly.

Test plan

  • Smoke: rename a real .amf to .mod, drop into Local — confirmed plays through libopenmpt.
  • make typecheck — clean.
  • make test — 125 passed.
  • Drop a .amf (non-renamed) into Local — verify it surfaces as a row and plays.
  • If a LIBRARY_ROOT is configured: place a .amf under it and verify /api/library surfaces it and /api/library/file serves it.
  • Verify toAmigaStyle("Song.amf")"amf.Song" and toAmigaStyle("amf.Song")"amf.Song" (idempotent).

Known non-regressions (out of scope)

  • Mod Archive's sniffDownloadExtension falls back to .mod for .amf downloads. This is pre-existing for every non-AHX format (.xm, .it, .s3m, …); fixing it for all of them is a separate change.

libopenmpt already decodes Asylum Music Format V1.0 (Amiga) and DSMI
Advanced Module Format (PC); both share the .amf extension and are
distinguished by content. Smoke test: a real .amf renamed to .mod
played cleanly through the existing libopenmpt path. The bottleneck
was purely the extension allowlist — no new engine, worklet, or wasm
build needed.

Widens MODULE_EXTENSIONS (transitively widens local drag-drop and
the pages/api/library/* server allowlists via isModuleFile) and
extends the Amiga-style filename rewriter with an .amf entry plus
the self-identity alias matching the pattern every other native
extension follows.

Assisted-by: ClaudeCode:claude-opus-4-7
@indigo423 indigo423 merged commit 0926c27 into main May 22, 2026
3 checks passed
@indigo423 indigo423 deleted the feat/add-amf-playback branch May 22, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant