aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
commit1a42c9e2c0fb64cdbebd81b311736e752f591e0a (patch)
treee893324d730878257491428ffca634a92f1eea05 /server/controllers/api
parentd56ec0d4129160a6e3b51ace3766bb325db1f101 (diff)
downloadPeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.gz
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.zst
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.zip
Server: udpate async to 2.0.0
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/v1/pods.js9
-rw-r--r--server/controllers/api/v1/remote.js7
-rw-r--r--server/controllers/api/v1/videos.js6
3 files changed, 12 insertions, 10 deletions
diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js
index 4413fbc1e..2bc761fef 100644
--- a/server/controllers/api/v1/pods.js
+++ b/server/controllers/api/v1/pods.js
@@ -1,8 +1,9 @@
1'use strict' 1'use strict'
2 2
3const async = require('async') 3const each = require('async/each')
4const express = require('express') 4const express = require('express')
5const mongoose = require('mongoose') 5const mongoose = require('mongoose')
6const waterfall = require('async/waterfall')
6 7
7const logger = require('../../../helpers/logger') 8const logger = require('../../../helpers/logger')
8const friends = require('../../../lib/friends') 9const friends = require('../../../lib/friends')
@@ -31,7 +32,7 @@ module.exports = router
31function addPods (req, res, next) { 32function addPods (req, res, next) {
32 const informations = req.body 33 const informations = req.body
33 34
34 async.waterfall([ 35 waterfall([
35 function addPod (callback) { 36 function addPod (callback) {
36 const pod = new Pod(informations) 37 const pod = new Pod(informations)
37 pod.save(function (err, podCreated) { 38 pod.save(function (err, podCreated) {
@@ -82,7 +83,7 @@ function makeFriends (req, res, next) {
82function removePods (req, res, next) { 83function removePods (req, res, next) {
83 const url = req.body.signature.url 84 const url = req.body.signature.url
84 85
85 async.waterfall([ 86 waterfall([
86 function loadPod (callback) { 87 function loadPod (callback) {
87 Pod.loadByUrl(url, callback) 88 Pod.loadByUrl(url, callback)
88 }, 89 },
@@ -106,7 +107,7 @@ function removePods (req, res, next) {
106 }, 107 },
107 108
108 function removeTheRemoteVideos (videosList, callback) { 109 function removeTheRemoteVideos (videosList, callback) {
109 async.each(videosList, function (video, callbackEach) { 110 each(videosList, function (video, callbackEach) {
110 video.remove(callbackEach) 111 video.remove(callbackEach)
111 }, callback) 112 }, callback)
112 } 113 }
diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js
index 9c2ca86e0..f452986b8 100644
--- a/server/controllers/api/v1/remote.js
+++ b/server/controllers/api/v1/remote.js
@@ -1,6 +1,7 @@
1'use strict' 1'use strict'
2 2
3const async = require('async') 3const each = require('async/each')
4const eachSeries = require('async/eachSeries')
4const express = require('express') 5const express = require('express')
5const mongoose = require('mongoose') 6const mongoose = require('mongoose')
6 7
@@ -32,7 +33,7 @@ function remoteVideos (req, res, next) {
32 33
33 // We need to process in the same order to keep consistency 34 // We need to process in the same order to keep consistency
34 // TODO: optimization 35 // TODO: optimization
35 async.eachSeries(requests, function (request, callbackEach) { 36 eachSeries(requests, function (request, callbackEach) {
36 const videoData = request.data 37 const videoData = request.data
37 38
38 if (request.type === 'add') { 39 if (request.type === 'add') {
@@ -72,7 +73,7 @@ function removeRemoteVideo (videoToRemoveData, fromUrl, callback) {
72 logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl }) 73 logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl })
73 } 74 }
74 75
75 async.each(videosList, function (video, callbackEach) { 76 each(videosList, function (video, callbackEach) {
76 logger.debug('Removing remote video %s.', video.magnetUri) 77 logger.debug('Removing remote video %s.', video.magnetUri)
77 78
78 video.remove(callbackEach) 79 video.remove(callbackEach)
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index a37e9278e..1f939b077 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -1,10 +1,10 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const config = require('config') 3const config = require('config')
5const express = require('express') 4const express = require('express')
6const mongoose = require('mongoose') 5const mongoose = require('mongoose')
7const multer = require('multer') 6const multer = require('multer')
7const waterfall = require('async/waterfall')
8 8
9const logger = require('../../../helpers/logger') 9const logger = require('../../../helpers/logger')
10const friends = require('../../../lib/friends') 10const friends = require('../../../lib/friends')
@@ -85,7 +85,7 @@ function addVideo (req, res, next) {
85 const videoFile = req.files.videofile[0] 85 const videoFile = req.files.videofile[0]
86 const videoInfos = req.body 86 const videoInfos = req.body
87 87
88 async.waterfall([ 88 waterfall([
89 89
90 function insertIntoDB (callback) { 90 function insertIntoDB (callback) {
91 const videoData = { 91 const videoData = {
@@ -152,7 +152,7 @@ function listVideos (req, res, next) {
152function removeVideo (req, res, next) { 152function removeVideo (req, res, next) {
153 const videoId = req.params.id 153 const videoId = req.params.id
154 154
155 async.waterfall([ 155 waterfall([
156 function getVideo (callback) { 156 function getVideo (callback) {
157 Video.load(videoId, callback) 157 Video.load(videoId, callback)
158 }, 158 },