mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2026-02-26 10:19:28 +00:00
refactor api package comments
* use encoding/json for comment parsing * refactor by moving loop code to an UnmarshalJSON * use a preallocated array and indices to maintain order while using goroutines again, this was removed a while ago * use new struct in comment.hbs and contextComment.hbs * rewriteUrl partial to reduce rimgo-specific code in api * move RenderError into pages package to avoid import cycle between render and utils
This commit is contained in:
@@ -26,13 +26,13 @@ func HandleTag(w http.ResponseWriter, r *http.Request) error {
|
||||
|
||||
tag, err := ApiClient.FetchTag(r.PathValue("tag"), r.URL.Query().Get("sort"), page)
|
||||
if err != nil && err.Error() == "ratelimited by imgur" {
|
||||
return utils.RenderError(w, r, 429)
|
||||
return RenderError(w, r, 429)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tag.Display == "" {
|
||||
return utils.RenderError(w, r, 404)
|
||||
return RenderError(w, r, 404)
|
||||
}
|
||||
|
||||
return render.Render(w, "tag", map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user