From 93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 Aug 2017 11:36:23 +0200 Subject: Move video file metadata in their own table Will be used for user video quotas and multiple video resolutions --- server.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'server.ts') diff --git a/server.ts b/server.ts index 1ba208c28..2effa9340 100644 --- a/server.ts +++ b/server.ts @@ -26,7 +26,7 @@ const app = express() // ----------- Database ----------- // Do not use barrels because we don't want to load all modules here (we need to initialize database first) import { logger } from './server/helpers/logger' -import { API_VERSION, CONFIG } from './server/initializers/constants' +import { API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' // Initialize database and models import { database as db } from './server/initializers/database' db.init(false).then(() => onDatabaseInitDone()) @@ -57,10 +57,20 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers' // Enable CORS for develop if (isTestInstance()) { - app.use(cors({ - origin: 'http://localhost:3000', - credentials: true - })) + app.use((req, res, next) => { + // These routes have already cors + if ( + req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && + req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 + ) { + return (cors({ + origin: 'http://localhost:3000', + credentials: true + }))(req, res, next) + } + + return next() + }) } // For the logger -- cgit v1.2.3