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>
This commit is contained in:
2026-08-15 11:50:27 +02:00
co-authored by Copilot
parent e4fe39ecc5
commit a51578cbf1
6 changed files with 19 additions and 24 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# eBook Library (Go + templ)
Minimalistic, no-JS eBook library web app for reading files (EPUB/PDF) on a
Minimalistic, no-JS eBook library web app for reading EPUB files on a
Tolino e-reader browser. UI text/comments are in German.
## Build & run
+2 -5
View File
@@ -4,7 +4,7 @@ Minimalistische eBook-Bibliothek für den Tolino-Webbrowser.
## Features (MVP)
- Listet EPUB/PDF-Dateien aus `books/`
- Listet EPUB-Dateien aus `books/`
- Detailseite pro Buch
- Download-Link pro Buch (für Tolino)
- Schlichtes, kontrastreiches UI ohne JavaScript-Abhängigkeit
@@ -56,10 +56,7 @@ go run ./cmd/server
## Bücher hinzufügen
Lege deine Dateien in den Ordner `books/`:
- `.epub` (bevorzugt)
- `.pdf` (optional)
Lege deine EPUB-Dateien in den Ordner `books/`.
Alternativ können Benutzer mit Upload-Recht Bücher direkt im Browser hochladen.
+1 -3
View File
@@ -44,7 +44,7 @@ func (s *Service) ListBooks() ([]Book, error) {
}
ext := strings.ToLower(filepath.Ext(e.Name()))
if ext != ".epub" && ext != ".pdf" {
if ext != ".epub" {
continue
}
@@ -55,7 +55,6 @@ func (s *Service) ListBooks() ([]Book, error) {
hasCover := false
title := fallbackTitle
if ext == ".epub" {
meta, err := readEPUBMetadata(fullPath)
if err == nil {
if strings.TrimSpace(meta.Title) != "" {
@@ -66,7 +65,6 @@ func (s *Service) ListBooks() ([]Book, error) {
}
hasCover = meta.HasCover
}
}
books = append(books, Book{
ID: id,
+2 -2
View File
@@ -210,8 +210,8 @@ func (h *Handler) uploadSubmit(w http.ResponseWriter, r *http.Request) {
defer file.Close()
ext := strings.ToLower(filepath.Ext(header.Filename))
if ext != ".epub" && ext != ".pdf" {
render(w, r.Context(), views.UploadPage("Nur EPUB- und PDF-Dateien erlaubt."))
if ext != ".epub" {
render(w, r.Context(), views.UploadPage("Nur EPUB-Dateien erlaubt."))
return
}
+3 -3
View File
@@ -77,8 +77,8 @@ templ UploadPage(errMsg string) {
<p class="error">{ errMsg }</p>
}
<form method="post" action="/upload" enctype="multipart/form-data" class="upload-form">
<label for="book">EPUB oder PDF auswählen</label>
<input id="book" type="file" name="book" accept=".epub,.pdf" required />
<label for="book">EPUB auswählen</label>
<input id="book" type="file" name="book" accept=".epub" required />
<button type="submit" class="btn">Hochladen</button>
</form>
}
@@ -104,7 +104,7 @@ templ IndexPage(books []library.Book, canUpload bool) {
}
</section>
if len(books) == 0 {
<p>Keine eBooks gefunden. Lege EPUB- oder PDF-Dateien im Ordner <code>books/</code> ab.</p>
<p>Keine eBooks gefunden. Lege EPUB-Dateien im Ordner <code>books/</code> ab.</p>
} else {
<ul class="book-list">
for _, b := range books {
+2 -2
View File
@@ -262,7 +262,7 @@ func UploadPage(errMsg string) templ.Component {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " <form method=\"post\" action=\"/upload\" enctype=\"multipart/form-data\" class=\"upload-form\"><label for=\"book\">EPUB oder PDF auswählen</label> <input id=\"book\" type=\"file\" name=\"book\" accept=\".epub,.pdf\" required> <button type=\"submit\" class=\"btn\">Hochladen</button></form>")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, " <form method=\"post\" action=\"/upload\" enctype=\"multipart/form-data\" class=\"upload-form\"><label for=\"book\">EPUB auswählen</label> <input id=\"book\" type=\"file\" name=\"book\" accept=\".epub\" required> <button type=\"submit\" class=\"btn\">Hochladen</button></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -435,7 +435,7 @@ func IndexPage(books []library.Book, canUpload bool) templ.Component {
return templ_7745c5c3_Err
}
if len(books) == 0 {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<p>Keine eBooks gefunden. Lege EPUB- oder PDF-Dateien im Ordner <code>books/</code> ab.</p>")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<p>Keine eBooks gefunden. Lege EPUB-Dateien im Ordner <code>books/</code> ab.</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}