mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 12:50:01 +00:00
api/core: rename tunnel limiter, move to endpoint
This commit is contained in:
parent
f2248d4e9a
commit
38fcee4a50
1 changed files with 2 additions and 4 deletions
|
@ -81,7 +81,7 @@ export const runAPI = (express, app, __dirname) => {
|
||||||
handler: handleRateExceeded
|
handler: handleRateExceeded
|
||||||
})
|
})
|
||||||
|
|
||||||
const apiLimiterStream = rateLimit({
|
const apiTunnelLimiter = rateLimit({
|
||||||
windowMs: env.rateLimitWindow * 1000,
|
windowMs: env.rateLimitWindow * 1000,
|
||||||
max: env.rateLimitMax,
|
max: env.rateLimitMax,
|
||||||
standardHeaders: true,
|
standardHeaders: true,
|
||||||
|
@ -105,8 +105,6 @@ export const runAPI = (express, app, __dirname) => {
|
||||||
...corsConfig,
|
...corsConfig,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
app.use('/tunnel', apiLimiterStream);
|
|
||||||
|
|
||||||
app.post('/', (req, res, next) => {
|
app.post('/', (req, res, next) => {
|
||||||
if (!acceptRegex.test(req.header('Accept'))) {
|
if (!acceptRegex.test(req.header('Accept'))) {
|
||||||
return fail(res, "error.api.header.accept");
|
return fail(res, "error.api.header.accept");
|
||||||
|
@ -231,7 +229,7 @@ export const runAPI = (express, app, __dirname) => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.get('/tunnel', (req, res) => {
|
app.get('/tunnel', apiTunnelLimiter, (req, res) => {
|
||||||
const id = String(req.query.id);
|
const id = String(req.query.id);
|
||||||
const exp = String(req.query.exp);
|
const exp = String(req.query.exp);
|
||||||
const sig = String(req.query.sig);
|
const sig = String(req.query.sig);
|
||||||
|
|
Loading…
Reference in a new issue