aboutsummaryrefslogtreecommitdiffhomepage
path: root/server.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-10-07 15:12:53 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-10-07 15:12:53 +0200
commitb9ab2e25fd7fff1ded999153371fb4699c9abaf1 (patch)
treefc5227ef376f9bfb8614f381d9ce6619a0bbbb97 /server.js
parentd22629bd9356193aa6b956dec84cd3b7eb08d12a (diff)
downloadPeerTube-b9ab2e25fd7fff1ded999153371fb4699c9abaf1.tar.gz
PeerTube-b9ab2e25fd7fff1ded999153371fb4699c9abaf1.tar.zst
PeerTube-b9ab2e25fd7fff1ded999153371fb4699c9abaf1.zip
Server: add cors policy for torrent file and thumbnails
Diffstat (limited to 'server.js')
-rw-r--r--server.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/server.js b/server.js
index 5feb21476..e90ed5c25 100644
--- a/server.js
+++ b/server.js
@@ -2,6 +2,7 @@
2 2
3// ----------- Node modules ----------- 3// ----------- Node modules -----------
4const bodyParser = require('body-parser') 4const bodyParser = require('body-parser')
5const cors = require('cors')
5const express = require('express') 6const express = require('express')
6const expressValidator = require('express-validator') 7const expressValidator = require('express-validator')
7const http = require('http') 8const http = require('http')
@@ -74,11 +75,11 @@ app.use('/client/*', function (req, res, next) {
74}) 75})
75 76
76const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) 77const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents'))
77app.use(constants.STATIC_PATHS.TORRENTS, express.static(torrentsPhysicalPath, { maxAge: 0 })) 78app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: 0 }))
78 79
79// Uploads path for webseeding 80// Uploads path for webseeding
80const uploadsPhysicalPath = path.join(__dirname, config.get('storage.uploads')) 81const uploadsPhysicalPath = path.join(__dirname, config.get('storage.uploads'))
81app.use(constants.STATIC_PATHS.WEBSEED, express.static(uploadsPhysicalPath, { maxAge: 0 })) 82app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(uploadsPhysicalPath, { maxAge: 0 }))
82 83
83// Thumbnails path for express 84// Thumbnails path for express
84const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) 85const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))