Fix prev/next buttons for info pages, add support for --prefix to the same

This commit is contained in:
Seednode 2023-10-09 21:52:06 -05:00
parent 81d7e60d0c
commit dec38c8758
3 changed files with 13 additions and 15 deletions

View File

@ -184,19 +184,13 @@ func registerIndexHandlers(mux *httprouter.Router, args []string, index *fileInd
} }
func importIndex(args []string, index *fileIndex, formats types.Types) error { func importIndex(args []string, index *fileIndex, formats types.Types) error {
skipIndex := false
if IndexFile != "" { if IndexFile != "" {
err := index.Import(IndexFile) err := index.Import(IndexFile)
if err == nil {
skipIndex = true
}
}
if !skipIndex {
_, err := fileList(args, &filters{}, "", index, formats)
if err != nil { if err != nil {
return err _, err := fileList(args, &filters{}, "", index, formats)
if err != nil {
return err
}
} }
} }

View File

@ -57,18 +57,22 @@ func paginate(page int, fileCount int, ending bool) string {
html.WriteString("<tr><td>") html.WriteString("<tr><td>")
} }
html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '/html/%d';\">First</button>", html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '%s/index/html/%d';\">First</button>",
Prefix,
firstPage)) firstPage))
html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '/html/%d';\"%s>Prev</button>", html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '%s/index/html/%d';\"%s>Prev</button>",
Prefix,
prevPage, prevPage,
prevStatus)) prevStatus))
html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '/html/%d';\"%s>Next</button>", html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '%s/index/html/%d';\"%s>Next</button>",
Prefix,
nextPage, nextPage,
nextStatus)) nextStatus))
html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '/html/%d';\">Last</button>", html.WriteString(fmt.Sprintf("<button onclick=\"window.location.href = '%s/index/html/%d';\">Last</button>",
Prefix,
lastPage)) lastPage))
html.WriteString("</td></tr>\n") html.WriteString("</td></tr>\n")

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
ReleaseVersion string = "3.0.0" ReleaseVersion string = "3.0.1"
) )
var ( var (