Fix ebook upload: new books appear at top, 50 MB limit frontend/backend
All checks were successful
Build and push Docker image / build (push) Successful in 14s
Test / test (push) Successful in 17s

- Create EBookProgress on upload so new books get a last_read timestamp
  and sort to the top of the book list
- Update frontend file size check from 10 MB to 50 MB
- Fix backend error message to say 50 MB instead of 10 MB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
marwin 2026-04-04 21:01:32 +02:00
parent 4274f49971
commit 9c0a046c57
2 changed files with 4 additions and 3 deletions

View file

@ -67,7 +67,7 @@ def upload_book(request):
return JsonResponse({'error': 'invalid base64 in data_ct'}, status=400)
if raw_size > max_bytes:
return JsonResponse({'error': 'file too large (max 10 MB)'}, status=400)
return JsonResponse({'error': 'file too large (max 50 MB)'}, status=400)
book = EBook.objects.create(
user=request.user,
@ -76,6 +76,7 @@ def upload_book(request):
data_ct=data_ct,
data_iv=data_iv,
)
EBookProgress.objects.create(user=request.user, book=book)
return JsonResponse({'ok': True, 'id': book.id})

View file

@ -2884,8 +2884,8 @@ async function uploadEbook(file) {
if (statusEl) statusEl.textContent = 'Only .epub and .pdf files are supported.';
return;
}
if (file.size > 10 * 1024 * 1024) {
if (statusEl) statusEl.textContent = 'File too large (max 10 MB).';
if (file.size > 50 * 1024 * 1024) {
if (statusEl) statusEl.textContent = 'File too large (max 50 MB).';
return;
}