@@ -39,6 +39,10 @@ const patchLimiter = rateLimit({
3939} )
4040const Bots = RequestHandler ( )
4141 . get ( async ( req : GetApiRequest , res ) => {
42+ const auth = req . headers . authorization
43+ ? await get . BotAuthorization ( req . headers . authorization )
44+ : await get . Authorization ( req . cookies . token )
45+ if ( ! auth ) return ResponseWrapper ( res , { code : 401 } )
4246 const bot = await get . bot . load ( req . query . id )
4347 if ( ! bot ) return ResponseWrapper ( res , { code : 404 , message : '존재하지 않는 봇입니다.' } )
4448 else {
@@ -200,7 +204,7 @@ const Bots = RequestHandler()
200204
201205 const isPerkAvailable =
202206 checkBotFlag ( bot . flags , 'partnered' ) || checkBotFlag ( bot . flags , 'trusted' )
203-
207+
204208 const userInfo = await get . user . load ( user )
205209 if (
206210 [ 'reported' , 'blocked' , 'archived' ] . includes ( bot . state ) &&
@@ -219,7 +223,8 @@ const Bots = RequestHandler()
219223 const csrfValidated = checkToken ( req , res , req . body . _csrf )
220224 if ( ! csrfValidated ) return
221225
222- const validated : ManageBot = await getManageBotSchema ( isPerkAvailable ) . validate ( req . body , { abortEarly : false } )
226+ const validated : ManageBot = await getManageBotSchema ( isPerkAvailable )
227+ . validate ( req . body , { abortEarly : false } )
223228 . then ( ( el ) => el )
224229 . catch ( ( e ) => {
225230 ResponseWrapper ( res , { code : 400 , errors : e . errors } )
0 commit comments