diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-08-25 11:36:23 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-08-25 11:36:23 +0200 |
commit | 93e1258c7cbc0d1235ca6d2a1f7c1875985328b8 (patch) | |
tree | b0a1f77af7ab54dc5f58f569fcd1e9d84b04c533 /server.ts | |
parent | 69f224587e99d56008e1fa129d0641840a486620 (diff) | |
download | PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.gz PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.tar.zst PeerTube-93e1258c7cbc0d1235ca6d2a1f7c1875985328b8.zip |
Move video file metadata in their own table
Will be used for user video quotas and multiple video resolutions
Diffstat (limited to 'server.ts')
-rw-r--r-- | server.ts | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -26,7 +26,7 @@ const app = express() | |||
26 | // ----------- Database ----------- | 26 | // ----------- Database ----------- |
27 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | 27 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) |
28 | import { logger } from './server/helpers/logger' | 28 | import { logger } from './server/helpers/logger' |
29 | import { API_VERSION, CONFIG } from './server/initializers/constants' | 29 | import { API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' |
30 | // Initialize database and models | 30 | // Initialize database and models |
31 | import { database as db } from './server/initializers/database' | 31 | import { database as db } from './server/initializers/database' |
32 | db.init(false).then(() => onDatabaseInitDone()) | 32 | db.init(false).then(() => onDatabaseInitDone()) |
@@ -57,10 +57,20 @@ import { apiRouter, clientsRouter, staticRouter } from './server/controllers' | |||
57 | 57 | ||
58 | // Enable CORS for develop | 58 | // Enable CORS for develop |
59 | if (isTestInstance()) { | 59 | if (isTestInstance()) { |
60 | app.use(cors({ | 60 | app.use((req, res, next) => { |
61 | origin: 'http://localhost:3000', | 61 | // These routes have already cors |
62 | credentials: true | 62 | if ( |
63 | })) | 63 | req.path.indexOf(STATIC_PATHS.TORRENTS) === -1 && |
64 | req.path.indexOf(STATIC_PATHS.WEBSEED) === -1 | ||
65 | ) { | ||
66 | return (cors({ | ||
67 | origin: 'http://localhost:3000', | ||
68 | credentials: true | ||
69 | }))(req, res, next) | ||
70 | } | ||
71 | |||
72 | return next() | ||
73 | }) | ||
64 | } | 74 | } |
65 | 75 | ||
66 | // For the logger | 76 | // For the logger |