sort desc by date
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"slices"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
@@ -49,7 +50,6 @@ func Run(ctx context.Context, args []string) error {
|
||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasPrefix(r.URL.Path, "/media/") {
|
||||
http.StripPrefix("/media/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println(r.URL.Path, "vs", *d)
|
||||
http.FileServer(http.Dir(*d)).ServeHTTP(w, r)
|
||||
})).ServeHTTP(w, r)
|
||||
return
|
||||
@@ -88,11 +88,14 @@ func Run(ctx context.Context, args []string) error {
|
||||
for _, v := range seriesByKey {
|
||||
series = append(series, v)
|
||||
}
|
||||
slices.SortFunc(series, func(a, b Series) int {
|
||||
return -1 * strings.Compare(path.Base(a.Thumbnail), path.Base(b.Thumbnail))
|
||||
})
|
||||
|
||||
if err := tmpl.Execute(w, map[string]any{
|
||||
"Series": series,
|
||||
}); err != nil {
|
||||
log.Println(err, *d)
|
||||
log.Println(err)
|
||||
}
|
||||
}),
|
||||
BaseContext: func(net.Listener) context.Context {
|
||||
|
||||
Reference in New Issue
Block a user