Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/api/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
router = APIRouter(tags=["jobs"])
logger = logging.getLogger("stemdeck.api")

_ALLOWED_EXTS = frozenset((".mp3", ".wav", ".flac"))
_MAX_UPLOAD_BYTES = 100 * 1024 * 1024 # 100 MB
_ALLOWED_EXTS = frozenset((".mp3", ".wav", ".flac", ".mp4", ".m4a"))
_MAX_UPLOAD_BYTES = 400 * 1024 * 1024 # 400 MB
_WS_RE = re.compile(r"\s+")


Expand Down Expand Up @@ -161,7 +161,7 @@ async def _create_local_job(request: Request) -> dict[str, str]:
if cl_header:
try:
if int(cl_header) > _MAX_UPLOAD_BYTES + 4096:
raise HTTPException(status_code=422, detail="File exceeds 100 MB limit")
raise HTTPException(status_code=422, detail="File exceeds 400 MB limit")
except ValueError:
pass

Expand All @@ -177,7 +177,7 @@ async def _create_local_job(request: Request) -> dict[str, str]:
if ext not in _ALLOWED_EXTS:
raise HTTPException(
status_code=422,
detail=f"Unsupported file type '{ext}': only .mp3, .wav, and .flac are accepted",
detail=f"Unsupported file type '{ext}': accepted formats are .mp3, .wav, .flac, .mp4, and .m4a",
)

# Validate stems list from form field
Expand All @@ -196,7 +196,7 @@ async def _create_local_job(request: Request) -> dict[str, str]:
if file_size == 0:
raise HTTPException(status_code=422, detail="Uploaded file is empty")
if file_size > _MAX_UPLOAD_BYTES:
raise HTTPException(status_code=422, detail="File exceeds 100 MB limit")
raise HTTPException(status_code=422, detail="File exceeds 400 MB limit")

job_id = uuid.uuid4().hex[:12]
job_dir = JOBS_DIR / job_id
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<path d="M12 3v12 M7 8l5-5 5 5 M5 21h14"/>
</svg>
</button>
<input id="fileInput" type="file" accept=".mp3,.wav,.flac,audio/mpeg,audio/wav,audio/flac" style="display:none" aria-hidden="true" />
<input id="fileInput" type="file" accept=".mp3,.wav,.flac,.mp4,.m4a,audio/mpeg,audio/wav,audio/flac,video/mp4,audio/mp4" style="display:none" aria-hidden="true" />
</div>

<!-- Divider -->
Expand Down
9 changes: 5 additions & 4 deletions static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,18 @@ function wireFileDrop() {
return n < 1024 * 1024 ? `${(n / 1024).toFixed(0)} KB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
}

const MAX_UPLOAD_BYTES = 100 * 1024 * 1024; // must match server _MAX_UPLOAD_BYTES
const MAX_UPLOAD_BYTES = 400 * 1024 * 1024; // must match server _MAX_UPLOAD_BYTES

function applyFile(file) {
if (!file) return;
const lower = file.name.toLowerCase();
if (!lower.endsWith(".mp3") && !lower.endsWith(".wav") && !lower.endsWith(".flac")) {
showError("Only MP3, WAV, and FLAC files are supported.");
if (!lower.endsWith(".mp3") && !lower.endsWith(".wav") && !lower.endsWith(".flac") &&
!lower.endsWith(".mp4") && !lower.endsWith(".m4a")) {
showError("Only MP3, WAV, FLAC, MP4, and M4A files are supported.");
return;
}
if (file.size > MAX_UPLOAD_BYTES) {
showError(`File is too large (${formatBytes(file.size)}). Maximum is 100 MB.`);
showError(`File is too large (${formatBytes(file.size)}). Maximum is 400 MB.`);
return;
}
if (fileName) fileName.textContent = file.name;
Expand Down