Compare commits
2 Commits
20c5df67cd
...
44c7126ac5
| Author | SHA1 | Date | |
|---|---|---|---|
| 44c7126ac5 | |||
| e4c4cdce41 |
7
Justfile
7
Justfile
@@ -1,8 +1,11 @@
|
|||||||
dev:
|
dev:
|
||||||
PODCASTS_DIRPATH=./podcasts go run .
|
PODCASTS_DIRPATH=./podcasts go run .
|
||||||
|
|
||||||
build:
|
build tag="latest":
|
||||||
docker build -t podcaster .
|
docker build -t git.zatch.ru/tsivinsky/podcaster:{{tag}} .
|
||||||
|
|
||||||
|
push tag="latest":
|
||||||
|
docker push git.zatch.ru/tsivinsky/podcaster:{{tag}}
|
||||||
|
|
||||||
run:
|
run:
|
||||||
docker run -p 5000:5000 --name podcaster -e PODCASTS_DIRPATH=/podcasts -e DB_PATH=/db/sqlite.db -v ./db:/db -v ./podcasts:/podcasts podcaster:latest
|
docker run -p 5000:5000 --name podcaster -e PODCASTS_DIRPATH=/podcasts -e DB_PATH=/db/sqlite.db -v ./db:/db -v ./podcasts:/podcasts podcaster:latest
|
||||||
|
|||||||
9
main.go
9
main.go
@@ -11,6 +11,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -387,6 +388,14 @@ func main() {
|
|||||||
episode.CreatedAt = episode.CreatedAt.In(loc)
|
episode.CreatedAt = episode.CreatedAt.In(loc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slices.SortFunc(episodes, func(a, b *Episode) int {
|
||||||
|
if a.CreatedAt.Before(b.CreatedAt) {
|
||||||
|
return 1
|
||||||
|
} else {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
tmpl.ExecuteTemplate(w, "podcast.html", struct {
|
tmpl.ExecuteTemplate(w, "podcast.html", struct {
|
||||||
Podcast *Podcast
|
Podcast *Podcast
|
||||||
Episodes []*Episode
|
Episodes []*Episode
|
||||||
|
|||||||
Reference in New Issue
Block a user