diff options
author | 2023-01-02 13:10:50 +0100 | |
---|---|---|
committer | 2023-01-02 12:10:50 +0000 | |
commit | 941893a774c83802afdc4cc76e1d30c59b6c5585 (patch) | |
tree | 6e7296146dedfeac8e83655157270f41e190724b /internal/web/rss.go | |
parent | [chore]: Bump github.com/abema/go-mp4 from 0.8.0 to 0.9.0 (#1287) (diff) | |
download | gotosocial-941893a774c83802afdc4cc76e1d30c59b6c5585.tar.xz |
[chore] The Big Middleware and API Refactor (tm) (#1250)
* interim commit: start refactoring middlewares into package under router
* another interim commit, this is becoming a big job
* another fucking massive interim commit
* refactor bookmarks to new style
* ambassador, wiz zeze commits you are spoiling uz
* she compiles, we're getting there
* we're just normal men; we're just innocent men
* apiutil
* whoopsie
* i'm glad noone reads commit msgs haha :blob_sweat:
* use that weirdo go-bytesize library for maxMultipartMemory
* fix media module paths
Diffstat (limited to 'internal/web/rss.go')
-rw-r--r-- | internal/web/rss.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/web/rss.go b/internal/web/rss.go index 827a19e87..27f4a34db 100644 --- a/internal/web/rss.go +++ b/internal/web/rss.go @@ -27,12 +27,12 @@ import ( "time" "github.com/gin-gonic/gin" - "github.com/superseriousbusiness/gotosocial/internal/api" + apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/log" ) -const appRSSUTF8 = string(api.AppRSSXML + "; charset=utf-8") +const appRSSUTF8 = string(apiutil.AppRSSXML + "; charset=utf-8") func (m *Module) GetRSSETag(urlPath string, lastModified time.Time, getRSSFeed func() (string, gtserror.WithCode)) (string, error) { if cachedETag, ok := m.eTagCache.Get(urlPath); ok && !lastModified.After(cachedETag.lastModified) { @@ -81,8 +81,8 @@ func (m *Module) rssFeedGETHandler(c *gin.Context) { c.Header(cacheControlHeader, cacheControlNoCache) ctx := c.Request.Context() - if _, err := api.NegotiateAccept(c, api.AppRSSXML); err != nil { - api.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet) + if _, err := apiutil.NegotiateAccept(c, apiutil.AppRSSXML); err != nil { + apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGet) return } @@ -90,7 +90,7 @@ func (m *Module) rssFeedGETHandler(c *gin.Context) { username := strings.ToLower(c.Param(usernameKey)) if username == "" { err := errors.New("no account username specified") - api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet) return } @@ -99,7 +99,7 @@ func (m *Module) rssFeedGETHandler(c *gin.Context) { getRssFeed, accountLastPostedPublic, errWithCode := m.processor.AccountGetRSSFeedForUsername(ctx, username) if errWithCode != nil { - api.ErrorHandler(c, errWithCode, m.processor.InstanceGet) + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet) return } @@ -111,13 +111,13 @@ func (m *Module) rssFeedGETHandler(c *gin.Context) { // we either have no cache entry for this, or we have an expired cache entry; generate a new one rssFeed, errWithCode = getRssFeed() if errWithCode != nil { - api.ErrorHandler(c, errWithCode, m.processor.InstanceGet) + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet) return } eTag, err := generateEtag(bytes.NewBufferString(rssFeed)) if err != nil { - api.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) + apiutil.ErrorHandler(c, gtserror.NewErrorInternalError(err), m.processor.InstanceGet) return } @@ -145,7 +145,7 @@ func (m *Module) rssFeedGETHandler(c *gin.Context) { // we had a cache entry already so we didn't call to get the rss feed yet rssFeed, errWithCode = getRssFeed() if errWithCode != nil { - api.ErrorHandler(c, errWithCode, m.processor.InstanceGet) + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGet) return } } |