Use limit query param in reddit widget

This commit is contained in:
Svilen Markov
2025-04-28 18:49:10 +01:00
parent d7a17aab01
commit 9dde306c0c

View File

@@ -8,6 +8,7 @@ import (
"html/template"
"net/http"
"net/url"
"strconv"
"strings"
"time"
)
@@ -184,6 +185,10 @@ func (widget *redditWidget) fetchSubredditPosts() (forumPostList, error) {
}
}
if widget.Limit > 25 {
query.Set("limit", strconv.Itoa(widget.Limit))
}
if widget.Search != "" {
query.Set("q", widget.Search+" subreddit:"+widget.Subreddit)
query.Set("sort", widget.SortBy)