]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/controllers/api/pods.js
Add video category support
[github/Chocobozzz/PeerTube.git] / server / controllers / api / pods.js
index e1fe6fb5d0cc052172174ffc899f770af9094cb9..ab5763cf6a1f84f96decc08e6f8ec77cae648c53 100644 (file)
@@ -4,6 +4,7 @@ const express = require('express')
 const waterfall = require('async/waterfall')
 
 const db = require('../../initializers/database')
+const constants = require('../../initializers/constants')
 const logger = require('../../helpers/logger')
 const peertubeCrypto = require('../../helpers/peertube-crypto')
 const utils = require('../../helpers/utils')
@@ -12,16 +13,14 @@ const middlewares = require('../../middlewares')
 const admin = middlewares.admin
 const oAuth = middlewares.oauth
 const podsMiddleware = middlewares.pods
-const checkSignature = middlewares.secure.checkSignature
 const validators = middlewares.validators.pods
-const signatureValidator = middlewares.validators.remote.signature
 
 const router = express.Router()
 
 router.get('/', listPods)
 router.post('/',
+  podsMiddleware.setBodyHostPort, // We need to modify the host before running the validator!
   validators.podsAdd,
-  podsMiddleware.setBodyHostPort,
   addPods
 )
 router.post('/makefriends',
@@ -36,12 +35,6 @@ router.get('/quitfriends',
   admin.ensureIsAdmin,
   quitFriends
 )
-// Post because this is a secured request
-router.post('/remove',
-  signatureValidator.signature,
-  checkSignature,
-  removePods
-)
 
 // ---------------------------------------------------------------------------
 
@@ -80,7 +73,7 @@ function addPods (req, res, next) {
   ], function (err, cert) {
     if (err) return next(err)
 
-    return res.json({ cert: cert })
+    return res.json({ cert: cert, email: constants.CONFIG.ADMIN.EMAIL })
   })
 }
 
@@ -107,24 +100,6 @@ function makeFriends (req, res, next) {
   res.type('json').status(204).end()
 }
 
-function removePods (req, res, next) {
-  const host = req.body.signature.host
-
-  waterfall([
-    function loadPod (callback) {
-      db.Pod.loadByHost(host, callback)
-    },
-
-    function deletePod (pod, callback) {
-      pod.destroy().asCallback(callback)
-    }
-  ], function (err) {
-    if (err) return next(err)
-
-    return res.type('json').status(204).end()
-  })
-}
-
 function quitFriends (req, res, next) {
   friends.quitFriends(function (err) {
     if (err) return next(err)