fix(opds): epubcfi Atom compatibility, path deduplication, auth tokens

- Add <title> and <author><name> elements to Atom feed for compatibility
- Remove doubled /opds/opds/ path prefix in feed URLs
- Include ?token= auth param on all OPDS URLs
- Serve kepub links only for Kobo devices
- Fix URL construction for entries and acquisitions
This commit is contained in:
2026-06-02 19:45:21 -04:00
parent 8e4412544d
commit 5d22021e8e
2 changed files with 50 additions and 18 deletions
+13 -4
View File
@@ -22,8 +22,8 @@ type Feed struct {
type Entry struct {
ID string `xml:"id"`
Title string `xml:"dc:title"`
Creator string `xml:"dc:creator,omitempty"`
Title string `xml:"title"`
Author *Author `xml:"author,omitempty"`
Updated string `xml:"updated"`
Summary string `xml:"summary,omitempty"`
Links []Link `xml:"link"`
@@ -32,6 +32,12 @@ type Entry struct {
Categories []Category `xml:"category,omitempty"`
}
type Author struct {
XMLName xml.Name `xml:"author"`
Name string `xml:"name"`
URI string `xml:"uri,omitempty"`
}
type Link struct {
Href string `xml:"href,attr"`
Type string `xml:"type,attr"`
@@ -85,14 +91,17 @@ func (f *Feed) AddEntry(entry Entry) {
// NewEntry creates a new OPDS entry
func NewEntry(id, title, creator, updated string) Entry {
return Entry{
e := Entry{
ID: id,
Title: title,
Creator: creator,
Updated: updated,
Links: []Link{},
Metadata: []Meta{},
}
if creator != "" {
e.Author = &Author{Name: creator}
}
return e
}
// AddAcquisitionLink adds an acquisition link to the entry