move tokenauth to apiutil

This commit is contained in:
tobi 2025-02-04 14:34:38 +01:00
commit e3857b90bb
186 changed files with 226 additions and 427 deletions

View file

@ -24,7 +24,6 @@ import (
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
// PublicTimelineGETHandler swagger:operation GET /api/v1/timelines/public publicTimeline
@ -108,15 +107,15 @@ import (
// '400':
// description: bad request
func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
var authed *oauth.Auth
var authed *apiutil.Auth
var err error
if config.GetInstanceExposePublicTimeline() {
// If the public timeline is allowed to be exposed, still check if we
// can extract various authentication properties, but don't require them.
authed, err = oauth.Authed(c, false, false, false, false)
authed, err = apiutil.TokenAuth(c, false, false, false, false)
} else {
authed, err = oauth.Authed(c, true, true, true, true)
authed, err = apiutil.TokenAuth(c, true, true, true, true)
}
if err != nil {