aboutsummaryrefslogtreecommitdiffhomepage
path: root/routes/api/v1/remoteVideos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2015-11-06 17:34:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2015-11-06 17:34:31 +0100
commitf5a60a5138135a3412dfbcfd6e564f7aa47a55c2 (patch)
tree2516f410a33792f9112b4b4253929e5292908a3f /routes/api/v1/remoteVideos.js
parenta6fa7ac141637a5026388157084c439f920c5ff1 (diff)
downloadPeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.gz
PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.tar.zst
PeerTube-f5a60a5138135a3412dfbcfd6e564f7aa47a55c2.zip
Add API versionning
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})()