aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/api/v1/remoteVideos.js
diff options
context:
space:
mode:
Diffstat (limited to 'routes/api/v1/remoteVideos.js')
-rw-r--r--routes/api/v1/remoteVideos.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/routes/api/v1/remoteVideos.js b/routes/api/v1/remoteVideos.js
new file mode 100644
index 000000000..88b8e879b
--- /dev/null
+++ b/routes/api/v1/remoteVideos.js
@@ -0,0 +1,29 @@
1;(function () {
2 'use strict'
3
4 var express = require('express')
5 var router = express.Router()
6 var middleware = require('../../../middlewares')
7 var videos = require('../../../src/videos')
8
9 function addRemoteVideos (req, res, next) {
10 videos.addRemote(req.body.data, function (err, video) {
11 if (err) return next(err)
12
13 res.json(video)
14 })
15 }
16
17 function removeRemoteVideo (req, res, next) {
18 videos.removeRemote(req.body.signature.url, req.body.data.magnetUri, function (err) {
19 if (err) return next(err)
20
21 res.status(204)
22 })
23 }
24
25 router.post('/add', middleware.cache(false), middleware.decryptBody, addRemoteVideos)
26 router.post('/remove', middleware.cache(false), middleware.decryptBody, removeRemoteVideo)
27
28 module.exports = router
29})()