Use the new API of epubgo
This commit is contained in:
parent
a1c029345b
commit
d51b7f935c
2 changed files with 6 additions and 6 deletions
2
cover.go
2
cover.go
|
@ -86,7 +86,7 @@ func GetCover(e *epubgo.Epub, title string) (bson.ObjectId, bson.ObjectId) {
|
|||
res := exp.FindSubmatch(txt)
|
||||
if res != nil {
|
||||
href := string(res[1])
|
||||
urlPart := strings.Split(it.Url(), "/")
|
||||
urlPart := strings.Split(it.URL(), "/")
|
||||
url := strings.Join(urlPart[:len(urlPart)-1], "/")
|
||||
if href[:3] == "../" {
|
||||
href = href[3:]
|
||||
|
|
10
reader.go
10
reader.go
|
@ -65,10 +65,10 @@ func getNextPrev(e *epubgo.Epub, file string, id string, base string) (string, s
|
|||
prev := ""
|
||||
next := ""
|
||||
for err == nil {
|
||||
if cleanLink(spine.Url()) == file {
|
||||
if cleanLink(spine.URL()) == file {
|
||||
break
|
||||
}
|
||||
prev = spine.Url()
|
||||
prev = spine.URL()
|
||||
err = spine.Next()
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -79,7 +79,7 @@ func getNextPrev(e *epubgo.Epub, file string, id string, base string) (string, s
|
|||
prev = genLink(id, base, prev)
|
||||
}
|
||||
if spine.Next() == nil {
|
||||
next = genLink(id, base, spine.Url())
|
||||
next = genLink(id, base, spine.URL())
|
||||
}
|
||||
return next, prev
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ func listChapters(nav *epubgo.NavigationIterator, depth int) []chapter {
|
|||
for err == nil {
|
||||
var c chapter
|
||||
c.Label = nav.Title()
|
||||
c.Link = nav.Url()
|
||||
c.Link = nav.URL()
|
||||
c.Depth = depth
|
||||
for c.Depth < depth {
|
||||
c.Out = append(c.Out, true)
|
||||
|
@ -143,7 +143,7 @@ func readStartHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
|||
notFound(w, r)
|
||||
return
|
||||
}
|
||||
http.Redirect(w, r, "/read/"+id+"/"+it.Url(), http.StatusTemporaryRedirect)
|
||||
http.Redirect(w, r, "/read/"+id+"/"+it.URL(), http.StatusTemporaryRedirect)
|
||||
}
|
||||
|
||||
func readHandler(w http.ResponseWriter, r *http.Request, sess *Session) {
|
||||
|
|
Reference in a new issue