mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-24 15:36:19 -06:00
move tokenauth to apiutil
This commit is contained in:
parent
f734a94c1c
commit
e3857b90bb
186 changed files with 226 additions and 427 deletions
|
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
// HomeTimelineGETHandler swagger:operation GET /api/v1/timelines/home homeTimeline
|
||||
|
|
@ -107,7 +106,7 @@ import (
|
|||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) HomeTimelineGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
// ListTimelineGETHandler swagger:operation GET /api/v1/timelines/list/{id} listTimeline
|
||||
|
|
@ -106,7 +105,7 @@ import (
|
|||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) ListTimelineGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
// TagTimelineGETHandler swagger:operation GET /api/v1/timelines/tag/{tag_name} tagTimeline
|
||||
|
|
@ -108,7 +107,7 @@ import (
|
|||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) TagTimelineGETHandler(c *gin.Context) {
|
||||
authed, err := oauth.Authed(c, true, true, true, true)
|
||||
authed, err := apiutil.TokenAuth(c, true, true, true, true)
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue