aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/api/remoteVideos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-06-09 17:41:40 +0200
committerChocobozzz <florian.bigard@gmail.com>2015-10-29 23:14:54 +0100
commit8c308c2bf7f658945d80be9d5880361238635f5b (patch)
tree2130ae60af58e59dab3df07a5d5cdd5174f91ae8 /routes/api/remoteVideos.js
parent8cb4b4e00ee57eb98dfe1455b6d2de36fc561797 (diff)
downloadPeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.gz
PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.tar.zst
PeerTube-8c308c2bf7f658945d80be9d5880361238635f5b.zip
Spawn
Diffstat (limited to 'routes/api/remoteVideos.js')
-rw-r--r--routes/api/remoteVideos.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/routes/api/remoteVideos.js b/routes/api/remoteVideos.js
new file mode 100644
index 000000000..eed586d23
--- /dev/null
+++ b/routes/api/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) 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) 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})()