Server: add cors policy for torrent file and thumbnails
This commit is contained in:
parent
d22629bd93
commit
b9ab2e25fd
|
@ -40,6 +40,7 @@
|
|||
"body-parser": "^1.12.4",
|
||||
"concurrently": "^2.0.0",
|
||||
"config": "^1.14.0",
|
||||
"cors": "^2.8.1",
|
||||
"create-torrent": "^3.24.5",
|
||||
"debug": "^2.2.0",
|
||||
"dezalgo": "^1.0.3",
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
// ----------- Node modules -----------
|
||||
const bodyParser = require('body-parser')
|
||||
const cors = require('cors')
|
||||
const express = require('express')
|
||||
const expressValidator = require('express-validator')
|
||||
const http = require('http')
|
||||
|
@ -74,11 +75,11 @@ app.use('/client/*', function (req, res, next) {
|
|||
})
|
||||
|
||||
const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents'))
|
||||
app.use(constants.STATIC_PATHS.TORRENTS, express.static(torrentsPhysicalPath, { maxAge: 0 }))
|
||||
app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: 0 }))
|
||||
|
||||
// Uploads path for webseeding
|
||||
const uploadsPhysicalPath = path.join(__dirname, config.get('storage.uploads'))
|
||||
app.use(constants.STATIC_PATHS.WEBSEED, express.static(uploadsPhysicalPath, { maxAge: 0 }))
|
||||
app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(uploadsPhysicalPath, { maxAge: 0 }))
|
||||
|
||||
// Thumbnails path for express
|
||||
const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))
|
||||
|
|
Loading…
Reference in New Issue