feat: временный публичный /exp без авторизации (v0.4.9)
This commit is contained in:
@@ -76,6 +76,25 @@ async function start() {
|
||||
// JWKS endpoint для валидации токенов внешними сервисами (только в mock-режиме)
|
||||
if (auth.jwksHandler) app.get('/.well-known/jwks.json', auth.jwksHandler);
|
||||
|
||||
// ── ВРЕМЕННЫЙ публичный endpoint /exp (без авторизации) ──────────────────
|
||||
// TODO: убрать когда /export станет публичным по ТЗ п. 4.7
|
||||
{
|
||||
const { exportLimiter } = require('./src/middleware/rateLimit');
|
||||
const { aggregateCIDRs } = require('./src/validators');
|
||||
app.get('/exp', exportLimiter, async (req, res) => {
|
||||
try {
|
||||
const cidrs = await q.getExportCIDRs(null); // null = все компании
|
||||
const aggregated = aggregateCIDRs(cidrs);
|
||||
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
||||
res.setHeader('Content-Disposition', 'inline; filename="whitelist.txt"');
|
||||
res.send(aggregated.join('\n') + (aggregated.length ? '\n' : ''));
|
||||
} catch (e) {
|
||||
console.error('/exp error:', e);
|
||||
res.status(500).send('Export error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ── REST API v1 (Bearer JWT, без сессий/CSRF) ─────────────────────────────
|
||||
const { createApiRouter } = require('./src/api/index');
|
||||
app.use('/api/v1', createApiRouter({ auth, q }));
|
||||
|
||||
Reference in New Issue
Block a user