|
|
@ -7,7 +7,7 @@ class APIRouteMiddleware extends Middleware {
|
|
|
|
|
|
|
|
|
|
|
|
async test(req, res, next, { allow_token = true, allow_user = true }) {
|
|
|
|
async test(req, res, next, { allow_token = true, allow_user = true }) {
|
|
|
|
// First, check if there is a user in the session.
|
|
|
|
// First, check if there is a user in the session.
|
|
|
|
if ( allow_user && req.is_auth ) {
|
|
|
|
if ( allow_user && req.user ) {
|
|
|
|
return next()
|
|
|
|
return next()
|
|
|
|
} else if ( allow_token ) {
|
|
|
|
} else if ( allow_token ) {
|
|
|
|
if ( !req.oauth ) req.oauth = {}
|
|
|
|
if ( !req.oauth ) req.oauth = {}
|
|
|
|