u
This commit is contained in:
@@ -12,6 +12,7 @@ import { authMiddleware } from './middleware/auth.js';
|
||||
import { ensureConnection } from '../db/store.js';
|
||||
import { closeAll as closeAllSse } from './sse.js';
|
||||
import { getOrCreateCert } from '../util/cert.js';
|
||||
import v1Router from '../v1/index.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -85,6 +86,8 @@ async function createApi() {
|
||||
}
|
||||
|
||||
await loadRoutes(app, '/api');
|
||||
app.use('/v1', v1Router);
|
||||
app.use('/api/v1', v1Router);
|
||||
|
||||
app.use((err, _req, res, next) => {
|
||||
if (err.type === 'entity.too.large') {
|
||||
|
||||
@@ -51,6 +51,10 @@ export const authMiddleware = async (req, res, next) => {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (req.path.startsWith('/v1') || req.path.startsWith('/api/v1')) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (req.path.startsWith('/@') || req.path.startsWith('/node_modules') || req.path.startsWith('/src') || req.path === '/favicon.ico') {
|
||||
return next();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user