diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 16:31:14 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 16:31:14 +0200 |
commit | b3b926474204ad736ec434aafc8afc6bc55079f6 (patch) | |
tree | ba235886357a8c032fea7ef17cd9ab9519ea6a2b /server/controllers/api | |
parent | 5dda52c924763a889e98b4cf97c588b34ef01812 (diff) | |
download | PeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.tar.gz PeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.tar.zst PeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.zip |
Authenticate before make/quit friends (server + tests)
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/v1/pods.js | 13 | ||||
-rw-r--r-- | server/controllers/api/v1/remoteVideos.js | 6 | ||||
-rw-r--r-- | server/controllers/api/v1/users.js | 2 | ||||
-rw-r--r-- | server/controllers/api/v1/videos.js | 6 |
4 files changed, 14 insertions, 13 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index fd13034a2..cec51f272 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js | |||
@@ -4,11 +4,12 @@ const express = require('express') | |||
4 | 4 | ||
5 | const logger = require('../../../helpers/logger') | 5 | const logger = require('../../../helpers/logger') |
6 | const friends = require('../../../lib/friends') | 6 | const friends = require('../../../lib/friends') |
7 | const middleware = require('../../../middlewares') | 7 | const middlewares = require('../../../middlewares') |
8 | const Pods = require('../../../models/pods') | 8 | const Pods = require('../../../models/pods') |
9 | const reqValidator = middleware.reqValidators.pods | 9 | const oAuth2 = middlewares.oauth2 |
10 | const secureMiddleware = middleware.secure | 10 | const reqValidator = middlewares.reqValidators.pods |
11 | const secureRequest = middleware.reqValidators.remote.secureRequest | 11 | const secureMiddleware = middlewares.secure |
12 | const secureRequest = middlewares.reqValidators.remote.secureRequest | ||
12 | const videos = require('../../../lib/videos') | 13 | const videos = require('../../../lib/videos') |
13 | const Videos = require('../../../models/videos') | 14 | const Videos = require('../../../models/videos') |
14 | 15 | ||
@@ -16,8 +17,8 @@ const router = express.Router() | |||
16 | 17 | ||
17 | router.get('/', listPods) | 18 | router.get('/', listPods) |
18 | router.post('/', reqValidator.podsAdd, addPods) | 19 | router.post('/', reqValidator.podsAdd, addPods) |
19 | router.get('/makefriends', reqValidator.makeFriends, makeFriends) | 20 | router.get('/makefriends', oAuth2.authenticate, reqValidator.makeFriends, makeFriends) |
20 | router.get('/quitfriends', quitFriends) | 21 | router.get('/quitfriends', oAuth2.authenticate, quitFriends) |
21 | // Post because this is a secured request | 22 | // Post because this is a secured request |
22 | router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods) | 23 | router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods) |
23 | 24 | ||
diff --git a/server/controllers/api/v1/remoteVideos.js b/server/controllers/api/v1/remoteVideos.js index cc4bc41e2..2f41c0411 100644 --- a/server/controllers/api/v1/remoteVideos.js +++ b/server/controllers/api/v1/remoteVideos.js | |||
@@ -3,9 +3,9 @@ | |||
3 | const express = require('express') | 3 | const express = require('express') |
4 | const map = require('lodash/map') | 4 | const map = require('lodash/map') |
5 | 5 | ||
6 | const middleware = require('../../../middlewares') | 6 | const middlewares = require('../../../middlewares') |
7 | const secureMiddleware = middleware.secure | 7 | const secureMiddleware = middlewares.secure |
8 | const reqValidator = middleware.reqValidators.remote | 8 | const reqValidator = middlewares.reqValidators.remote |
9 | const logger = require('../../../helpers/logger') | 9 | const logger = require('../../../helpers/logger') |
10 | const Videos = require('../../../models/videos') | 10 | const Videos = require('../../../models/videos') |
11 | const videos = require('../../../lib/videos') | 11 | const videos = require('../../../lib/videos') |
diff --git a/server/controllers/api/v1/users.js b/server/controllers/api/v1/users.js index 54ff0d743..7ce0b9c6a 100644 --- a/server/controllers/api/v1/users.js +++ b/server/controllers/api/v1/users.js | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | const config = require('config') | 3 | const config = require('config') |
4 | const express = require('express') | 4 | const express = require('express') |
5 | const oAuth2 = require('../../../middlewares/oauth2') | 5 | const oAuth2 = require('../../../middlewares').oauth2 |
6 | 6 | ||
7 | const Users = require('../../../models/users') | 7 | const Users = require('../../../models/users') |
8 | 8 | ||
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index 9891bf4c6..b6e3de08f 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -9,9 +9,9 @@ const multer = require('multer') | |||
9 | const constants = require('../../../initializers/constants') | 9 | const constants = require('../../../initializers/constants') |
10 | const logger = require('../../../helpers/logger') | 10 | const logger = require('../../../helpers/logger') |
11 | const friends = require('../../../lib/friends') | 11 | const friends = require('../../../lib/friends') |
12 | const middleware = require('../../../middlewares') | 12 | const middlewares = require('../../../middlewares') |
13 | const oAuth2 = require('../../../middlewares/oauth2') | 13 | const oAuth2 = middlewares.oauth2 |
14 | const reqValidator = middleware.reqValidators.videos | 14 | const reqValidator = middlewares.reqValidators.videos |
15 | const utils = require('../../../helpers/utils') | 15 | const utils = require('../../../helpers/utils') |
16 | const Videos = require('../../../models/videos') // model | 16 | const Videos = require('../../../models/videos') // model |
17 | const videos = require('../../../lib/videos') | 17 | const videos = require('../../../lib/videos') |