aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-13 16:31:14 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-13 16:31:14 +0200
commitb3b926474204ad736ec434aafc8afc6bc55079f6 (patch)
treeba235886357a8c032fea7ef17cd9ab9519ea6a2b /server/controllers
parent5dda52c924763a889e98b4cf97c588b34ef01812 (diff)
downloadPeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.tar.gz
PeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.tar.zst
PeerTube-b3b926474204ad736ec434aafc8afc6bc55079f6.zip
Authenticate before make/quit friends (server + tests)
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/v1/pods.js13
-rw-r--r--server/controllers/api/v1/remoteVideos.js6
-rw-r--r--server/controllers/api/v1/users.js2
-rw-r--r--server/controllers/api/v1/videos.js6
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
5const logger = require('../../../helpers/logger') 5const logger = require('../../../helpers/logger')
6const friends = require('../../../lib/friends') 6const friends = require('../../../lib/friends')
7const middleware = require('../../../middlewares') 7const middlewares = require('../../../middlewares')
8const Pods = require('../../../models/pods') 8const Pods = require('../../../models/pods')
9const reqValidator = middleware.reqValidators.pods 9const oAuth2 = middlewares.oauth2
10const secureMiddleware = middleware.secure 10const reqValidator = middlewares.reqValidators.pods
11const secureRequest = middleware.reqValidators.remote.secureRequest 11const secureMiddleware = middlewares.secure
12const secureRequest = middlewares.reqValidators.remote.secureRequest
12const videos = require('../../../lib/videos') 13const videos = require('../../../lib/videos')
13const Videos = require('../../../models/videos') 14const Videos = require('../../../models/videos')
14 15
@@ -16,8 +17,8 @@ const router = express.Router()
16 17
17router.get('/', listPods) 18router.get('/', listPods)
18router.post('/', reqValidator.podsAdd, addPods) 19router.post('/', reqValidator.podsAdd, addPods)
19router.get('/makefriends', reqValidator.makeFriends, makeFriends) 20router.get('/makefriends', oAuth2.authenticate, reqValidator.makeFriends, makeFriends)
20router.get('/quitfriends', quitFriends) 21router.get('/quitfriends', oAuth2.authenticate, quitFriends)
21// Post because this is a secured request 22// Post because this is a secured request
22router.post('/remove', secureRequest, secureMiddleware.decryptBody, removePods) 23router.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 @@
3const express = require('express') 3const express = require('express')
4const map = require('lodash/map') 4const map = require('lodash/map')
5 5
6const middleware = require('../../../middlewares') 6const middlewares = require('../../../middlewares')
7const secureMiddleware = middleware.secure 7const secureMiddleware = middlewares.secure
8const reqValidator = middleware.reqValidators.remote 8const reqValidator = middlewares.reqValidators.remote
9const logger = require('../../../helpers/logger') 9const logger = require('../../../helpers/logger')
10const Videos = require('../../../models/videos') 10const Videos = require('../../../models/videos')
11const videos = require('../../../lib/videos') 11const 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
3const config = require('config') 3const config = require('config')
4const express = require('express') 4const express = require('express')
5const oAuth2 = require('../../../middlewares/oauth2') 5const oAuth2 = require('../../../middlewares').oauth2
6 6
7const Users = require('../../../models/users') 7const 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')
9const constants = require('../../../initializers/constants') 9const constants = require('../../../initializers/constants')
10const logger = require('../../../helpers/logger') 10const logger = require('../../../helpers/logger')
11const friends = require('../../../lib/friends') 11const friends = require('../../../lib/friends')
12const middleware = require('../../../middlewares') 12const middlewares = require('../../../middlewares')
13const oAuth2 = require('../../../middlewares/oauth2') 13const oAuth2 = middlewares.oauth2
14const reqValidator = middleware.reqValidators.videos 14const reqValidator = middlewares.reqValidators.videos
15const utils = require('../../../helpers/utils') 15const utils = require('../../../helpers/utils')
16const Videos = require('../../../models/videos') // model 16const Videos = require('../../../models/videos') // model
17const videos = require('../../../lib/videos') 17const videos = require('../../../lib/videos')