sort desc by date
parent
93aecf47c6
commit
5b67d5c5f0
|
|
@ -6,10 +6,11 @@
|
|||
<body>
|
||||
<div>
|
||||
{{ range .Series }}
|
||||
<div style="display: inline-block;">
|
||||
<div style="display: inline-block; max-width: 12em; max-height: 9em; margin-bottom: .7em;">
|
||||
<a href="/media/{{ .HREF }}">
|
||||
<img src="/media/{{ .Thumbnail }}" alt="{{ .Thumbnail }}"/>
|
||||
<p>{{ .Thumbnail }}</p>
|
||||
<span>{{ .Thumbnail }}</span>
|
||||
<br>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue