mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-18 10:37:29 -06:00
[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:
parent
e81bcb5171
commit
6607e1c944
13 changed files with 447 additions and 182 deletions
|
|
@ -26,6 +26,8 @@ const (
|
|||
appXMLText = `text/xml` // AppXML is only *recommended* in RFC7303
|
||||
AppXMLXRD = `application/xrd+xml`
|
||||
AppRSSXML = `application/rss+xml`
|
||||
AppAtomXML = `application/atom+xml`
|
||||
AppFeedJSON = `application/feed+json`
|
||||
AppActivityJSON = `application/activity+json`
|
||||
appActivityLDJSON = `application/ld+json` // without profile
|
||||
AppActivityLDJSON = appActivityLDJSON + `; profile="https://www.w3.org/ns/activitystreams"`
|
||||
|
|
|
|||
|
|
@ -71,6 +71,18 @@ func JSONType(c *gin.Context, code int, contentType string, data any) {
|
|||
EncodeJSONResponse(c.Writer, c.Request, code, contentType, data)
|
||||
}
|
||||
|
||||
// XML calls EncodeJSONResponse() using gin.Context{}, with content-type = AppXML,
|
||||
// This function handles the case of XML unmarshal errors and pools read buffers.
|
||||
func XML(c *gin.Context, code int, data any) {
|
||||
EncodeXMLResponse(c.Writer, c.Request, code, AppXML, data)
|
||||
}
|
||||
|
||||
// XML calls EncodeXMLResponse() using gin.Context{}, with given content-type.
|
||||
// This function handles the case of XML unmarshal errors and pools read buffers.
|
||||
func XMLType(c *gin.Context, code int, contentType string, data any) {
|
||||
EncodeXMLResponse(c.Writer, c.Request, code, contentType, data)
|
||||
}
|
||||
|
||||
// Data calls WriteResponseBytes() using gin.Context{}, with given content-type.
|
||||
func Data(c *gin.Context, code int, contentType string, data []byte) {
|
||||
WriteResponseBytes(c.Writer, c.Request, code, contentType, data)
|
||||
|
|
@ -230,6 +242,7 @@ func EncodeCSVResponse(
|
|||
|
||||
// Write all the records to the buffer.
|
||||
if err := csvWriter.WriteAll(records); err == nil {
|
||||
|
||||
// Respond with the now-known
|
||||
// size byte slice within buf.
|
||||
WriteResponseBytes(rw, r,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue