mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-02-15 04:55:59 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f1fbc2401 | ||
|
|
4afb7cefe7 |
2
Justfile
2
Justfile
@@ -4,7 +4,7 @@ build:
|
||||
|
||||
dev:
|
||||
tailwindcss -i static/tailwind.css -o static/app.css -m -w &
|
||||
go run github.com/cosmtrek/air@latest -c .air.toml
|
||||
go run github.com/air-verse/air@latest -c .air.toml
|
||||
|
||||
tag-vpr:
|
||||
podman pull codeberg.org/rimgo/rimgo:latest
|
||||
|
||||
@@ -37,16 +37,21 @@ func HandlePost(c *fiber.Ctx) error {
|
||||
utils.SetHeaders(c)
|
||||
c.Set("X-Frame-Options", "DENY")
|
||||
|
||||
postId := c.Params("postID")
|
||||
if strings.Contains(postId, "-") {
|
||||
postId = postId[len(postId)-7:]
|
||||
}
|
||||
|
||||
post, err := api.Album{}, error(nil)
|
||||
switch {
|
||||
case strings.HasPrefix(c.Path(), "/a"):
|
||||
post, err = ApiClient.FetchAlbum(c.Params("postID"))
|
||||
post, err = ApiClient.FetchAlbum(postId)
|
||||
case strings.HasPrefix(c.Path(), "/gallery"):
|
||||
post, err = ApiClient.FetchPosts(c.Params("postID"))
|
||||
post, err = ApiClient.FetchPosts(postId)
|
||||
case strings.HasPrefix(c.Path(), "/t"):
|
||||
post, err = ApiClient.FetchPosts(c.Params("postID"))
|
||||
post, err = ApiClient.FetchPosts(postId)
|
||||
default:
|
||||
post, err = ApiClient.FetchMedia(c.Params("postID"))
|
||||
post, err = ApiClient.FetchMedia(postId)
|
||||
}
|
||||
if err != nil && err.Error() == "ratelimited by imgur" {
|
||||
return utils.RenderError(c, 429)
|
||||
@@ -61,7 +66,7 @@ func HandlePost(c *fiber.Ctx) error {
|
||||
comments := []api.Comment{}
|
||||
if post.SharedWithCommunity {
|
||||
c.Set("Cache-Control", "public,max-age=604800")
|
||||
comments, err = ApiClient.FetchComments(c.Params("postID"))
|
||||
comments, err = ApiClient.FetchComments(postId)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user