[feature] add paging support to rss feed endpoint, and support JSON / atom feed types (#4442)

originally based on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4396

hope this is okay https://codeberg.org/zordsdavini !

closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4411
closes https://codeberg.org/superseriousbusiness/gotosocial/issues/3407

Co-authored-by: Arnas Udovic <zordsdavini@gmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4442
Co-authored-by: kim <grufwub@gmail.com>
Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2025-09-18 16:33:23 +02:00 committed by kim
commit 6607e1c944
13 changed files with 447 additions and 182 deletions

View file

@ -27,6 +27,7 @@ import (
apiutil "code.superseriousbusiness.org/gotosocial/internal/api/util"
"code.superseriousbusiness.org/gotosocial/internal/gtserror"
"code.superseriousbusiness.org/gotosocial/internal/log"
"code.superseriousbusiness.org/gotosocial/internal/paging"
"github.com/gin-gonic/gin"
)
@ -122,14 +123,15 @@ func (m *Module) prepareProfile(c *gin.Context) *profile {
// Check if paging.
maxStatusID := apiutil.ParseMaxID(c.Query(apiutil.MaxIDKey), "")
paging := maxStatusID != ""
doPaging := (maxStatusID != "")
// If not paging, load pinned statuses.
var (
mediaOnly = account.WebLayout == "gallery"
pinnedStatuses []*apimodel.WebStatus
)
if !paging {
if !doPaging {
// If not paging, load pinned statuses.
var errWithCode gtserror.WithCode
pinnedStatuses, errWithCode = m.processor.Account().WebStatusesGetPinned(
ctx,
@ -156,9 +158,8 @@ func (m *Module) prepareProfile(c *gin.Context) *profile {
statusResp, errWithCode := m.processor.Account().WebStatusesGet(
ctx,
account.ID,
&paging.Page{Max: paging.MaxID(maxStatusID), Limit: limit},
mediaOnly,
limit,
maxStatusID,
)
if errWithCode != nil {
apiutil.WebErrorHandler(c, errWithCode, instanceGet)
@ -172,7 +173,7 @@ func (m *Module) prepareProfile(c *gin.Context) *profile {
robotsMeta: robotsMeta,
pinnedStatuses: pinnedStatuses,
statusResp: statusResp,
paging: paging,
paging: doPaging,
}
}