more
This commit is contained in:
parent
7c5546c0c0
commit
fcd5a97225
@ -95,8 +95,12 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(path, "/b/") {
|
||||
// board handler
|
||||
parts := strings.Split(path[3:], "/")
|
||||
page := 0
|
||||
group := parts[0]
|
||||
page := 0
|
||||
pages := self.database.GetGroupPageCount(group)
|
||||
if self.invertPagination {
|
||||
page = int(pages) - 1
|
||||
}
|
||||
if len(parts) > 1 && parts[1] != "" && parts[1] != "json" {
|
||||
var err error
|
||||
page, err = strconv.Atoi(parts[1])
|
||||
@ -116,8 +120,6 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if banned {
|
||||
goto notfound
|
||||
}
|
||||
|
||||
pages := self.database.GetGroupPageCount(group)
|
||||
if page >= int(pages) {
|
||||
goto notfound
|
||||
}
|
||||
|
@ -283,17 +283,13 @@ func (self *templateEngine) genUkkoPaginated(prefix, frontend string, wr io.Writ
|
||||
}
|
||||
}
|
||||
obj := map[string]interface{}{"prefix": prefix, "threads": threads, "page": page}
|
||||
if invertPagination {
|
||||
obj["prev"] = map[string]interface{}{"no": page - 1}
|
||||
} else if page > 0 {
|
||||
if page > 0 {
|
||||
obj["prev"] = map[string]interface{}{"no": page - 1}
|
||||
}
|
||||
if invertPagination {
|
||||
obj["next"] = map[string]interface{}{"no": page + 1}
|
||||
} else {
|
||||
if page < 10 {
|
||||
obj["next"] = map[string]interface{}{"no": page + 1}
|
||||
}
|
||||
} else if page < 10 {
|
||||
obj["next"] = map[string]interface{}{"no": page + 1}
|
||||
}
|
||||
if json {
|
||||
self.renderJSON(wr, obj)
|
||||
|
Reference in New Issue
Block a user