aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--config/default.yaml2
-rw-r--r--config/test-1.yaml2
-rw-r--r--config/test-2.yaml2
-rw-r--r--config/test-3.yaml2
-rw-r--r--config/test-4.yaml2
-rw-r--r--config/test-5.yaml2
-rw-r--r--config/test-6.yaml2
-rw-r--r--server.js6
-rw-r--r--server/controllers/api/v1/videos.js2
-rw-r--r--server/initializers/checker.js2
-rw-r--r--server/initializers/constants.js2
-rw-r--r--server/models/video.js4
-rw-r--r--server/tests/api/single-pod.js11
13 files changed, 24 insertions, 17 deletions
diff --git a/config/default.yaml b/config/default.yaml
index 6a1e22204..909bec177 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -14,7 +14,7 @@ database:
14# From the project root directory 14# From the project root directory
15storage: 15storage:
16 certs: 'certs/' 16 certs: 'certs/'
17 uploads: 'uploads/' 17 videos: 'videos/'
18 logs: 'logs/' 18 logs: 'logs/'
19 thumbnails: 'thumbnails/' 19 thumbnails: 'thumbnails/'
20 torrents: 'torrents/' 20 torrents: 'torrents/'
diff --git a/config/test-1.yaml b/config/test-1.yaml
index a59566cc4..4be44abc7 100644
--- a/config/test-1.yaml
+++ b/config/test-1.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test1/certs/' 13 certs: 'test1/certs/'
14 uploads: 'test1/uploads/' 14 videos: 'test1/videos/'
15 logs: 'test1/logs/' 15 logs: 'test1/logs/'
16 thumbnails: 'test1/thumbnails/' 16 thumbnails: 'test1/thumbnails/'
17 torrents: 'test1/torrents/' 17 torrents: 'test1/torrents/'
diff --git a/config/test-2.yaml b/config/test-2.yaml
index 1b937898f..c723e6863 100644
--- a/config/test-2.yaml
+++ b/config/test-2.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test2/certs/' 13 certs: 'test2/certs/'
14 uploads: 'test2/uploads/' 14 videos: 'test2/videos/'
15 logs: 'test2/logs/' 15 logs: 'test2/logs/'
16 thumbnails: 'test2/thumbnails/' 16 thumbnails: 'test2/thumbnails/'
17 torrents: 'test2/torrents/' 17 torrents: 'test2/torrents/'
diff --git a/config/test-3.yaml b/config/test-3.yaml
index e522c13e7..58417c34b 100644
--- a/config/test-3.yaml
+++ b/config/test-3.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test3/certs/' 13 certs: 'test3/certs/'
14 uploads: 'test3/uploads/' 14 videos: 'test3/videos/'
15 logs: 'test3/logs/' 15 logs: 'test3/logs/'
16 thumbnails: 'test3/thumbnails/' 16 thumbnails: 'test3/thumbnails/'
17 torrents: 'test3/torrents/' 17 torrents: 'test3/torrents/'
diff --git a/config/test-4.yaml b/config/test-4.yaml
index e30cd7978..68253cae9 100644
--- a/config/test-4.yaml
+++ b/config/test-4.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test4/certs/' 13 certs: 'test4/certs/'
14 uploads: 'test4/uploads/' 14 videos: 'test4/videos/'
15 logs: 'test4/logs/' 15 logs: 'test4/logs/'
16 thumbnails: 'test4/thumbnails/' 16 thumbnails: 'test4/thumbnails/'
17 torrents: 'test4/torrents/' 17 torrents: 'test4/torrents/'
diff --git a/config/test-5.yaml b/config/test-5.yaml
index 3a54599f5..aafd45889 100644
--- a/config/test-5.yaml
+++ b/config/test-5.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test5/certs/' 13 certs: 'test5/certs/'
14 uploads: 'test5/uploads/' 14 videos: 'test5/videos/'
15 logs: 'test5/logs/' 15 logs: 'test5/logs/'
16 thumbnails: 'test5/thumbnails/' 16 thumbnails: 'test5/thumbnails/'
17 torrents: 'test5/torrents/' 17 torrents: 'test5/torrents/'
diff --git a/config/test-6.yaml b/config/test-6.yaml
index 31608add2..ba83b0bc1 100644
--- a/config/test-6.yaml
+++ b/config/test-6.yaml
@@ -11,7 +11,7 @@ database:
11# From the project root directory 11# From the project root directory
12storage: 12storage:
13 certs: 'test6/certs/' 13 certs: 'test6/certs/'
14 uploads: 'test6/uploads/' 14 videos: 'test6/videos/'
15 logs: 'test6/logs/' 15 logs: 'test6/logs/'
16 thumbnails: 'test6/thumbnails/' 16 thumbnails: 'test6/thumbnails/'
17 torrents: 'test6/torrents/' 17 torrents: 'test6/torrents/'
diff --git a/server.js b/server.js
index e90ed5c25..b2d9be9aa 100644
--- a/server.js
+++ b/server.js
@@ -77,9 +77,9 @@ app.use('/client/*', function (req, res, next) {
77const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents')) 77const torrentsPhysicalPath = path.join(__dirname, config.get('storage.torrents'))
78app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: 0 })) 78app.use(constants.STATIC_PATHS.TORRENTS, cors(), express.static(torrentsPhysicalPath, { maxAge: 0 }))
79 79
80// Uploads path for webseeding 80// Videos path for webseeding
81const uploadsPhysicalPath = path.join(__dirname, config.get('storage.uploads')) 81const videosPhysicalPath = path.join(__dirname, config.get('storage.videos'))
82app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(uploadsPhysicalPath, { maxAge: 0 })) 82app.use(constants.STATIC_PATHS.WEBSEED, cors(), express.static(videosPhysicalPath, { maxAge: 0 }))
83 83
84// Thumbnails path for express 84// Thumbnails path for express
85const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails')) 85const thumbnailsPhysicalPath = path.join(__dirname, config.get('storage.thumbnails'))
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index d633af76d..ee47ce7ac 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -25,7 +25,7 @@ const Video = mongoose.model('Video')
25// multer configuration 25// multer configuration
26const storage = multer.diskStorage({ 26const storage = multer.diskStorage({
27 destination: function (req, file, cb) { 27 destination: function (req, file, cb) {
28 cb(null, constants.CONFIG.STORAGE.UPLOAD_DIR) 28 cb(null, constants.CONFIG.STORAGE.VIDEOS_DIR)
29 }, 29 },
30 30
31 filename: function (req, file, cb) { 31 filename: function (req, file, cb) {
diff --git a/server/initializers/checker.js b/server/initializers/checker.js
index 85e9bc98b..0bc5df92f 100644
--- a/server/initializers/checker.js
+++ b/server/initializers/checker.js
@@ -17,7 +17,7 @@ function checkConfig () {
17 const required = [ 'listen.port', 17 const required = [ 'listen.port',
18 'webserver.https', 'webserver.host', 'webserver.port', 18 'webserver.https', 'webserver.host', 'webserver.port',
19 'database.host', 'database.port', 'database.suffix', 19 'database.host', 'database.port', 'database.suffix',
20 'storage.certs', 'storage.uploads', 'storage.logs', 'storage.thumbnails' 20 'storage.certs', 'storage.videos', 'storage.logs', 'storage.thumbnails'
21 ] 21 ]
22 const miss = [] 22 const miss = []
23 23
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index fb1cbc5f3..f77c4948f 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -38,7 +38,7 @@ const CONFIG = {
38 STORAGE: { 38 STORAGE: {
39 CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')), 39 CERT_DIR: path.join(__dirname, '..', '..', config.get('storage.certs')),
40 LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')), 40 LOG_DIR: path.join(__dirname, '..', '..', config.get('storage.logs')),
41 UPLOAD_DIR: path.join(__dirname, '..', '..', config.get('storage.uploads')), 41 VIDEOS_DIR: path.join(__dirname, '..', '..', config.get('storage.videos')),
42 THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails')), 42 THUMBNAILS_DIR: path.join(__dirname, '..', '..', config.get('storage.thumbnails')),
43 TORRENTS_DIR: path.join(__dirname, '..', '..', config.get('storage.torrents')) 43 TORRENTS_DIR: path.join(__dirname, '..', '..', config.get('storage.torrents'))
44 }, 44 },
diff --git a/server/models/video.js b/server/models/video.js
index 1feefe24f..05c4f51cb 100644
--- a/server/models/video.js
+++ b/server/models/video.js
@@ -94,7 +94,7 @@ VideoSchema.pre('save', function (next) {
94 const tasks = [] 94 const tasks = []
95 95
96 if (video.isOwned()) { 96 if (video.isOwned()) {
97 const videoPath = pathUtils.join(constants.CONFIG.STORAGE.UPLOAD_DIR, video.filename) 97 const videoPath = pathUtils.join(constants.CONFIG.STORAGE.VIDEOS_DIR, video.filename)
98 this.podUrl = constants.CONFIG.WEBSERVER.URL 98 this.podUrl = constants.CONFIG.WEBSERVER.URL
99 99
100 tasks.push( 100 tasks.push(
@@ -258,7 +258,7 @@ function removeThumbnail (video, callback) {
258} 258}
259 259
260function removeFile (video, callback) { 260function removeFile (video, callback) {
261 fs.unlink(constants.CONFIG.STORAGE.UPLOAD_DIR + video.filename, callback) 261 fs.unlink(constants.CONFIG.STORAGE.VIDEOS_DIR + video.filename, callback)
262} 262}
263 263
264// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process 264// Maybe the torrent is not seeded, but we catch the error to don't stop the removing process
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index 623a1a6a3..3125312ca 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -245,11 +245,18 @@ describe('Test a single pod', function () {
245 videosUtils.removeVideo(server.url, server.accessToken, videoId, function (err) { 245 videosUtils.removeVideo(server.url, server.accessToken, videoId, function (err) {
246 if (err) throw err 246 if (err) throw err
247 247
248 fs.readdir(pathUtils.join(__dirname, '../../../test1/uploads/'), function (err, files) { 248 fs.readdir(pathUtils.join(__dirname, '../../../test1/videos/'), function (err, files) {
249 if (err) throw err 249 if (err) throw err
250 250
251 expect(files.length).to.equal(0) 251 expect(files.length).to.equal(0)
252 done() 252
253 fs.readdir(pathUtils.join(__dirname, '../../../test1/thumbnails/'), function (err, files) {
254 if (err) throw err
255
256 expect(files.length).to.equal(0)
257
258 done()
259 })
253 }) 260 })
254 }) 261 })
255 }) 262 })