Skip to content

Commit

Permalink
feat: add bypass to web on token verification
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilhermeasper committed Apr 21, 2024
1 parent 3957439 commit d8db5e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: [self-hosted, Linux, X64]
runs-on: [self-hosted, Linux, X64, marquinhos]

strategy:
matrix:
Expand Down
6 changes: 6 additions & 0 deletions src/middlewares/botAuth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { Request, Response, NextFunction } from 'express';
import { verifyDiscordToken } from './userAuth';

export function checkToken(req: Request, res: Response, next: NextFunction) {
const authorization = req.headers['authorization'] as string;
const isWebRequest = req.headers['marquinhos-agent'] === 'web';
if (isWebRequest) {
return verifyDiscordToken(req, res, next);
}
console.log(req.headers);
const token = authorization && authorization.split(' ')[1];
if (!token) {
return res.status(401).json({ message: 'Token not provided' });
Expand Down

0 comments on commit d8db5e8

Please sign in to comment.