the link type should have the kind
This commit is contained in:
parent
96c64350c2
commit
0523607f69
12
main.go
12
main.go
@ -42,7 +42,6 @@ type AcquisitionFeed struct {
|
||||
|
||||
type CatalogFeed atom.Feed
|
||||
|
||||
const catalogType = "application/atom+xml;profile=opds-catalog"
|
||||
const acquisitionType = "application/atom+xml;profile=opds-catalog;kind=acquisition"
|
||||
const navegationType = "application/atom+xml;profile=opds-catalog;kind=navigation"
|
||||
|
||||
@ -130,17 +129,11 @@ func writeCatalogFeed(w io.Writer, u *url.URL) error {
|
||||
}
|
||||
|
||||
for _, fi := range fis {
|
||||
isAcquisition, _ := isAcquisitionFeed(filepath.Join(abs_path, fi.Name()))
|
||||
|
||||
var linkType string
|
||||
if linkType = catalogType; isAcquisition {
|
||||
linkType = acquisitionType
|
||||
}
|
||||
link := atom.Link{
|
||||
Rel: "subsection",
|
||||
Title: fi.Name(),
|
||||
Href: filepath.Join(u.EscapedPath(), url.PathEscape(fi.Name())),
|
||||
Type: linkType,
|
||||
Type: acquisitionType,
|
||||
}
|
||||
entry := &atom.Entry{
|
||||
ID: filepath.Join(u.Path, fi.Name()),
|
||||
@ -169,7 +162,7 @@ func writeAcquisitionFeed(w io.Writer, u *url.URL) error {
|
||||
feed.Link = []atom.Link{{
|
||||
Rel: "start",
|
||||
Href: "/",
|
||||
Type: "application/atom+xml;profile=opds-catalog;kind=navigation",
|
||||
Type: navegationType,
|
||||
}}
|
||||
|
||||
abs_path := filepath.Join(dirRoot, u.Path)
|
||||
@ -191,6 +184,7 @@ func writeAcquisitionFeed(w io.Writer, u *url.URL) error {
|
||||
rel = "http://opds-spec.org/image/thumbnail"
|
||||
}
|
||||
link := atom.Link{
|
||||
Title: fi.Name(),
|
||||
Rel: rel,
|
||||
Type: mime_type,
|
||||
Href: filepath.Join(u.EscapedPath(), url.PathEscape(fi.Name())),
|
||||
|
Loading…
Reference in New Issue
Block a user