diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
commit | a6375e69668ea42e19531c6bc68dcd37f3f7cbd7 (patch) | |
tree | 03204a408d56311692c3528bedcf95d2455e94f2 /server/controllers/api/v1/videos.js | |
parent | 052937db8a8d282eccdbdf38d487ed8d85d3c0a7 (diff) | |
parent | c4403b29ad4db097af528a7f04eea07e0ed320d0 (diff) | |
download | PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.gz PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.zst PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.zip |
Merge branch 'master' into webseed-merged
Diffstat (limited to 'server/controllers/api/v1/videos.js')
-rw-r--r-- | server/controllers/api/v1/videos.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index 1f939b077..70d22f139 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -1,11 +1,11 @@ | |||
1 | 'use strict' | 1 | 'use strict' |
2 | 2 | ||
3 | const config = require('config') | ||
4 | const express = require('express') | 3 | const express = require('express') |
5 | const mongoose = require('mongoose') | 4 | const mongoose = require('mongoose') |
6 | const multer = require('multer') | 5 | const multer = require('multer') |
7 | const waterfall = require('async/waterfall') | 6 | const waterfall = require('async/waterfall') |
8 | 7 | ||
8 | const constants = require('../../../initializers/constants') | ||
9 | const logger = require('../../../helpers/logger') | 9 | const logger = require('../../../helpers/logger') |
10 | const friends = require('../../../lib/friends') | 10 | const friends = require('../../../lib/friends') |
11 | const middlewares = require('../../../middlewares') | 11 | const middlewares = require('../../../middlewares') |
@@ -20,13 +20,12 @@ const sort = middlewares.sort | |||
20 | const utils = require('../../../helpers/utils') | 20 | const utils = require('../../../helpers/utils') |
21 | 21 | ||
22 | const router = express.Router() | 22 | const router = express.Router() |
23 | const uploads = config.get('storage.uploads') | ||
24 | const Video = mongoose.model('Video') | 23 | const Video = mongoose.model('Video') |
25 | 24 | ||
26 | // multer configuration | 25 | // multer configuration |
27 | const storage = multer.diskStorage({ | 26 | const storage = multer.diskStorage({ |
28 | destination: function (req, file, cb) { | 27 | destination: function (req, file, cb) { |
29 | cb(null, uploads) | 28 | cb(null, constants.CONFIG.STORAGE.UPLOAD_DIR) |
30 | }, | 29 | }, |
31 | 30 | ||
32 | filename: function (req, file, cb) { | 31 | filename: function (req, file, cb) { |
@@ -142,7 +141,7 @@ function getVideo (req, res, next) { | |||
142 | } | 141 | } |
143 | 142 | ||
144 | function listVideos (req, res, next) { | 143 | function listVideos (req, res, next) { |
145 | Video.list(req.query.start, req.query.count, req.query.sort, function (err, videosList, videosTotal) { | 144 | Video.listForApi(req.query.start, req.query.count, req.query.sort, function (err, videosList, videosTotal) { |
146 | if (err) return next(err) | 145 | if (err) return next(err) |
147 | 146 | ||
148 | res.json(getFormatedVideos(videosList, videosTotal)) | 147 | res.json(getFormatedVideos(videosList, videosTotal)) |