Support /t/TAG/ID paths (closes #117)

This commit is contained in:
video-prize-ranch 2023-06-29 22:23:14 +00:00
parent ea74f69c45
commit c163ae690e
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View File

@ -118,6 +118,7 @@ func main() {
app.Get("/a/:postID", pages.HandlePost) app.Get("/a/:postID", pages.HandlePost)
app.Get("/a/:postID/embed", pages.HandleEmbed) app.Get("/a/:postID/embed", pages.HandleEmbed)
app.Get("/t/:tag", pages.HandleTag) app.Get("/t/:tag", pages.HandleTag)
app.Get("/t/:tag/:postID", pages.HandlePost)
app.Get("/user/:userID", pages.HandleUser) app.Get("/user/:userID", pages.HandleUser)
app.Get("/r/:sub/:postID", pages.HandlePost) app.Get("/r/:sub/:postID", pages.HandlePost)
app.Get("/user/:userID/cover", pages.HandleUserCover) app.Get("/user/:userID/cover", pages.HandleUserCover)

View File

@ -20,6 +20,8 @@ func HandlePost(c *fiber.Ctx) error {
post, err = ApiClient.FetchAlbum(c.Params("postID")) post, err = ApiClient.FetchAlbum(c.Params("postID"))
case strings.HasPrefix(c.Path(), "/gallery"): case strings.HasPrefix(c.Path(), "/gallery"):
post, err = ApiClient.FetchPosts(c.Params("postID")) post, err = ApiClient.FetchPosts(c.Params("postID"))
case strings.HasPrefix(c.Path(), "/t"):
post, err = ApiClient.FetchPosts(c.Params("postID"))
default: default:
post, err = ApiClient.FetchMedia(c.Params("postID")) post, err = ApiClient.FetchMedia(c.Params("postID"))
} }