mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-13 16:58:28 +00:00
uncommmented some code
This commit is contained in:
parent
5bf86f1daa
commit
b0952fcbbf
@ -154,33 +154,33 @@ export const runAPI = async (express, app, __dirname, isPrimary = true) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.post('/', (req, res, next) => {
|
app.post('/', (req, res, next) => {
|
||||||
// if (!env.sessionEnabled || req.rateLimitKey) {
|
if (!env.sessionEnabled || req.rateLimitKey) {
|
||||||
// return next();
|
return next();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// const authorization = req.header("Authorization");
|
const authorization = req.header("Authorization");
|
||||||
// if (!authorization) {
|
if (!authorization) {
|
||||||
// return fail(res, "error.api.auth.jwt.missing");
|
return fail(res, "error.api.auth.jwt.missing");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (authorization.length >= 256) {
|
if (authorization.length >= 256) {
|
||||||
// return fail(res, "error.api.auth.jwt.invalid");
|
return fail(res, "error.api.auth.jwt.invalid");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const [ type, token, ...rest ] = authorization.split(" ");
|
const [ type, token, ...rest ] = authorization.split(" ");
|
||||||
// if (!token || type.toLowerCase() !== 'bearer' || rest.length) {
|
if (!token || type.toLowerCase() !== 'bearer' || rest.length) {
|
||||||
// return fail(res, "error.api.auth.jwt.invalid");
|
return fail(res, "error.api.auth.jwt.invalid");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (!jwt.verify(token)) {
|
if (!jwt.verify(token)) {
|
||||||
// return fail(res, "error.api.auth.jwt.invalid");
|
return fail(res, "error.api.auth.jwt.invalid");
|
||||||
// }
|
}
|
||||||
|
|
||||||
// req.rateLimitKey = hashHmac(token, 'rate');
|
req.rateLimitKey = hashHmac(token, 'rate');
|
||||||
// } catch {
|
} catch {
|
||||||
// return fail(res, "error.api.generic");
|
return fail(res, "error.api.generic");
|
||||||
// }
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user