ActivityPub-federated video streaming platform using P2P directly in your web browser
Server: add cors policy for torrent file and thumbnails
Chocobozzzb9ab2e25fd7f
diff --git a/package.json b/package.jsonindex 909c181768..a7f76da527 100644--- a/package.json+++ b/package.json@@ -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",diff --git a/server.js b/server.jsindex 5feb214764..e90ed5c253 100644--- a/server.js+++ b/server.js@@ -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 webseedingconst 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 expressconst thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))