Skip to content

Commit

Permalink
Allow bot authentication for emoji management routes
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Jan 14, 2025
1 parent e9b0743 commit d513231
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/routes/servers/serverEmojiAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { verifyUpload } from '../../common/nerimityCDN';
export function serverEmojiAdd(Router: Router) {
Router.post(
'/servers/:serverId/emojis',
authenticate(),
authenticate({allowBot: true}),
serverMemberVerification(),
memberHasRolePermissionMiddleware(ROLE_PERMISSIONS.ADMIN),
body('name')
Expand Down
2 changes: 1 addition & 1 deletion src/routes/servers/serverEmojiUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { addServerEmoji, updateServerEmoji } from '../../services/Server';

export function serverEmojiUpdate(Router: Router) {
Router.post('/servers/:serverId/emojis/:id',
authenticate(),
authenticate({allowBot: true}),
serverMemberVerification(),
memberHasRolePermissionMiddleware(ROLE_PERMISSIONS.ADMIN),
body('name')
Expand Down
2 changes: 1 addition & 1 deletion src/routes/servers/serverEmojisDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { deleteServerEmoji, getServerEmojis } from '../../services/Server';

export function serverEmojiDelete(Router: Router) {
Router.delete('/servers/:serverId/emojis/:id',
authenticate(),
authenticate({allowBot: true}),
serverMemberVerification(),
memberHasRolePermissionMiddleware(ROLE_PERMISSIONS.ADMIN),
rateLimit({
Expand Down
9 changes: 4 additions & 5 deletions src/routes/servers/serverEmojisGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { serverMemberVerification } from '../../middleware/serverMemberVerificat
import { getServerEmojis } from '../../services/Server';

export function serverEmojisGet(Router: Router) {
Router.get('/servers/:serverId/emojis',
authenticate(),
Router.get(
'/servers/:serverId/emojis',
authenticate({ allowBot: true }),
serverMemberVerification(),
memberHasRolePermissionMiddleware(ROLE_PERMISSIONS.ADMIN),
rateLimit({
Expand All @@ -22,12 +23,10 @@ export function serverEmojisGet(Router: Router) {
);
}



async function route(req: Request, res: Response) {
const [updated, error] = await getServerEmojis(req.serverCache.id);
if (error) {
return res.status(400).json(error);
}
res.json(updated);
}
}

0 comments on commit d513231

Please sign in to comment.