1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
;(function () {
'use strict'
var express = require('express')
var router = express.Router()
var middleware = require('../../../middlewares')
var videos = require('../../../src/videos')
function addRemoteVideos (req, res, next) {
videos.addRemote(req.body.data, function (err, video) {
if (err) return next(err)
res.json(video)
})
}
function removeRemoteVideo (req, res, next) {
videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) {
if (err) return next(err)
res.status(204)
})
}
router.post('/add', middleware.cache(false), middleware.decryptBody, addRemoteVideos)
router.post('/remove', middleware.cache(false), middleware.decryptBody, removeRemoteVideo)
module.exports = router
})()
|