Commit Graph
27 Commits
Author SHA1 Message Date
arnefandCopilot be3dfaeb47 Allow selecting and uploading multiple EPUB files at once
- views/pages.templ: upload input now has "multiple" attribute; page
  title/heading updated to plural ("Bücher hochladen"); templ regenerated
- internal/web/handlers.go: uploadSubmit now reads all files from
  r.MultipartForm.File["book"] instead of a single r.FormFile, saving
  each via a new saveUpload helper; partial failures are reported per
  filename while successfully saved files are kept

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-15 14:23:05 +02:00
arnefandCopilot a51578cbf1 Drop PDF support, EPUB only
Docker Image bauen und veröffentlichen / docker (push) Successful in 2m38s
- internal/library: ListBooks only scans .epub files, dropping the
  pdf-specific metadata branch (epub metadata reading is now
  unconditional)
- internal/web: uploadSubmit rejects non-.epub uploads with updated
  error message
- views: upload form/file input and empty-library hint now reference
  only EPUB; templ regenerated
- README/copilot-instructions updated to reflect EPUB-only scope

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-15 11:50:27 +02:00
arnefandCopilot e4fe39ecc5 Fix book grid layout with long titles
- static/styles.css: use CSS grid instead of inline-block for .book-list
  so rows align consistently regardless of card content height; add
  overflow-wrap/word-break to titles/authors
- views/pages.templ: truncate long titles/authors server-side
  (truncateTitle helper) instead of relying on CSS line-clamp, which
  behaved inconsistently across browsers (esp. Firefox with flex);
  full title kept in title attribute and on the book detail page
- views/pages_templ.go regenerated via templ generate

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-15 11:12:48 +02:00
arnefandCopilot 0c3e5cec9f Auto-create books directory, log upload errors, document Docker deployment
- library.New now creates BOOKS_DIR (MkdirAll) on startup so uploads
  don't fail when the directory is missing on a fresh bind mount
- uploadSubmit logs the underlying OS error on save/write failures
- README: document docker-compose deployment, container UID/GID (100/101)
  for bind-mounted ./data permissions, and running the admin CLI via
  docker compose exec

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-15 07:11:33 +02:00
arnefandCopilot 4c0aa053ac Add cleanup step to docker workflow to free build agent disk space
Docker Image bauen und veröffentlichen / docker (push) Successful in 2m28s
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-14 22:37:53 +02:00
arnefandCopilot 952a4c9b52 Trigger docker workflow on develop branch instead of main
Docker Image bauen und veröffentlichen / docker (push) Successful in 2m49s
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-14 22:01:57 +02:00
arnefandCopilot d60d3a703e Add Docker image and multi-arch build workflow
- Add multi-stage Dockerfile (alpine, non-root, builds server+admin binaries)
- Add .dockerignore
- Add GitHub Actions workflow (also read by Gitea Actions) building and
  pushing linux/amd64 + linux/arm64 images to git.arnef.de/arnef/ebooks

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-14 21:53:39 +02:00
arnefandCopilot c877abf302 style: .btn als flex-Button mit konsistentem Styling
Ermöglicht die Verwendung von .btn auf <button>-Elementen
(nicht nur <a>-Links) mit einheitlicher Ausrichtung, Schrift
und Cursor.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-14 21:32:19 +02:00
arnefandCopilot 817763887a refactor: replace can_upload boolean with role-based access control
Introduces a three-tier role hierarchy: reader < uploader < admin.

- internal/users/role.go: Role type, roleLevel map, AtLeast(min),
  ParseRole() — new roles added by inserting into roleLevel only
- internal/users/store.go: versioned migrations via _schema_version table;
  v2 migration adds 'role' column and migrates existing can_upload data;
  SetRole() replaces SetUpload(); Session carries Role instead of CanUpload
- internal/web/middleware.go: generic requireRole(minRole) middleware
  replaces the ad-hoc requireUpload
- internal/web/handlers.go: upload routes use requireRole(RoleUploader);
  listBooks derives canUpload from sess.Role.AtLeast(RoleUploader)
- cmd/admin/main.go: user add --role <reader|uploader|admin>,
  user set-role replaces user set-upload
- README, copilot-instructions updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-11 19:43:39 +02:00
arnefandCopilot a66c370de4 feat: add authentication and book upload
- Session-based login (username/password, 30-day cookie)
- SQLite user store with bcrypt password hashing (modernc.org/sqlite)
- Per-user upload permission (can_upload flag)
- Admin CLI (cmd/admin) for user management:
  user add/list/delete/set-upload
- Upload handler for EPUB/PDF with path-traversal protection
- All routes protected by requireAuth middleware;
  /upload additionally requires requireUpload
- Login/logout UI, upload form, logout button in header
- New env var: USERS_DB (default: users.db, gitignored)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-08-11 19:11:40 +02:00
ArneandCopilot Autofix powered by AI a8b31dae8a Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-08 13:40:53 +02:00
ArneandCopilot Autofix powered by AI 1f31d7afae Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-08 13:40:38 +02:00
ArneandCopilot Autofix powered by AI 15d323541c Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-08 13:40:23 +02:00
ArneandCopilot Autofix powered by AI e5931aa5c7 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-08-08 13:40:09 +02:00
arnef a936c61ba3 update pages_templ 2026-08-08 13:36:19 +02:00
Arne 91173750ad Use Tolino-compatible three-column overview layout 2026-08-06 22:02:44 +02:00
Arne d5a03bc05f Switch overview to three-column book grid 2026-08-06 21:12:34 +02:00
Arne 22cb8eca3b Tighten header layout for app-like back button 2026-08-06 21:09:39 +02:00
Arne 229c1520ef Use compact back icon in header 2026-08-06 21:07:40 +02:00
Arne 5757e6bbea Move detail back navigation into header 2026-08-06 21:05:30 +02:00
Arne a735f1a8d4 Simplify styles for Tolino-friendly reader layout 2026-08-06 20:46:56 +02:00
Arne 0db5777354 Import strings in templ view for format placeholder 2026-08-06 20:43:54 +02:00
Arne 6b42ab0dd6 Fix cover content type detection build error 2026-08-06 20:42:42 +02:00
Arne b163aade71 Add ebook metadata, author and cover display 2026-08-06 20:40:40 +02:00
arnef 060d822654 use latest templ and ignore content of books dir 2026-08-06 17:18:23 +02:00
Arne 8d499c28a7 Initial MVP: Go + templ Tolino-optimized ebook library scaffold 2026-08-06 06:52:41 +02:00
Arne bf077c0cf6 Initial commit 2026-08-06 06:52:40 +02:00