mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-24 11:36:21 -06:00
enforce scopes
This commit is contained in:
parent
e3857b90bb
commit
21d9edac54
191 changed files with 1473 additions and 648 deletions
|
|
@ -107,19 +107,25 @@ import (
|
|||
// '400':
|
||||
// description: bad request
|
||||
func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
|
||||
var authed *apiutil.Auth
|
||||
var err error
|
||||
|
||||
var (
|
||||
authed *apiutil.Auth
|
||||
errWithCode gtserror.WithCode
|
||||
)
|
||||
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 = apiutil.TokenAuth(c, false, false, false, false)
|
||||
authed, errWithCode = apiutil.TokenAuth(c,
|
||||
false, false, false, false,
|
||||
)
|
||||
} else {
|
||||
authed, err = apiutil.TokenAuth(c, true, true, true, true)
|
||||
authed, errWithCode = apiutil.TokenAuth(c,
|
||||
true, true, true, true,
|
||||
apiutil.ScopeReadStatuses,
|
||||
)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
apiutil.ErrorHandler(c, gtserror.NewErrorUnauthorized(err, err.Error()), m.processor.InstanceGetV1)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue