aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/index.js8
-rw-r--r--server/controllers/api/remote/index.js16
-rw-r--r--server/controllers/api/remote/videos.js (renamed from server/controllers/api/remote.js)8
3 files changed, 23 insertions, 9 deletions
diff --git a/server/controllers/api/index.js b/server/controllers/api/index.js
index 4cb65ed55..f13ff922c 100644
--- a/server/controllers/api/index.js
+++ b/server/controllers/api/index.js
@@ -2,6 +2,8 @@
2 2
3const express = require('express') 3const express = require('express')
4 4
5const utils = require('../../helpers/utils')
6
5const router = express.Router() 7const router = express.Router()
6 8
7const clientsController = require('./clients') 9const clientsController = require('./clients')
@@ -18,7 +20,7 @@ router.use('/requests', requestsController)
18router.use('/users', usersController) 20router.use('/users', usersController)
19router.use('/videos', videosController) 21router.use('/videos', videosController)
20router.use('/ping', pong) 22router.use('/ping', pong)
21router.use('/*', badRequest) 23router.use('/*', utils.badRequest)
22 24
23// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
24 26
@@ -29,7 +31,3 @@ module.exports = router
29function pong (req, res, next) { 31function pong (req, res, next) {
30 return res.send('pong').status(200).end() 32 return res.send('pong').status(200).end()
31} 33}
32
33function badRequest (req, res, next) {
34 res.type('json').status(400).end()
35}
diff --git a/server/controllers/api/remote/index.js b/server/controllers/api/remote/index.js
new file mode 100644
index 000000000..2947632d5
--- /dev/null
+++ b/server/controllers/api/remote/index.js
@@ -0,0 +1,16 @@
1'use strict'
2
3const express = require('express')
4
5const utils = require('../../../helpers/utils')
6
7const router = express.Router()
8
9const videosRemoteController = require('./videos')
10
11router.use('/videos', videosRemoteController)
12router.use('/*', utils.badRequest)
13
14// ---------------------------------------------------------------------------
15
16module.exports = router
diff --git a/server/controllers/api/remote.js b/server/controllers/api/remote/videos.js
index be5e6dc98..87c49bff9 100644
--- a/server/controllers/api/remote.js
+++ b/server/controllers/api/remote/videos.js
@@ -4,15 +4,15 @@ const eachSeries = require('async/eachSeries')
4const express = require('express') 4const express = require('express')
5const waterfall = require('async/waterfall') 5const waterfall = require('async/waterfall')
6 6
7const db = require('../../initializers/database') 7const db = require('../../../initializers/database')
8const middlewares = require('../../middlewares') 8const middlewares = require('../../../middlewares')
9const secureMiddleware = middlewares.secure 9const secureMiddleware = middlewares.secure
10const validators = middlewares.validators.remote 10const validators = middlewares.validators.remote
11const logger = require('../../helpers/logger') 11const logger = require('../../../helpers/logger')
12 12
13const router = express.Router() 13const router = express.Router()
14 14
15router.post('/videos', 15router.post('/',
16 validators.signature, 16 validators.signature,
17 secureMiddleware.checkSignature, 17 secureMiddleware.checkSignature,
18 validators.remoteVideos, 18 validators.remoteVideos,