aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-03-18 16:44:54 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-03-18 16:44:54 +0100
commit8c9c1942f6b5675cfca802e2f707bef3c217afbf (patch)
treecf86a39e5cda278f29cb6297b90f7ac4ff13dbad
parenta4c157519738d89f8a77143b91e92dfd2e70380a (diff)
downloadPeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.tar.gz
PeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.tar.zst
PeerTube-8c9c1942f6b5675cfca802e2f707bef3c217afbf.zip
Change name of fields for add video api
-rw-r--r--client/angular/videos/components/add/videos-add.component.html2
-rw-r--r--client/angular/videos/components/add/videos-add.component.ts2
-rw-r--r--server/controllers/api/v1/videos.js4
-rw-r--r--server/tests/api/checkParams.js16
-rw-r--r--server/tests/api/utils.js2
5 files changed, 13 insertions, 13 deletions
diff --git a/client/angular/videos/components/add/videos-add.component.html b/client/angular/videos/components/add/videos-add.component.html
index 4252d7abd..7336ad0c0 100644
--- a/client/angular/videos/components/add/videos-add.component.html
+++ b/client/angular/videos/components/add/videos-add.component.html
@@ -15,7 +15,7 @@
15 <div class="form-group"> 15 <div class="form-group">
16 <div class="btn btn-default btn-file"> 16 <div class="btn btn-default btn-file">
17 <span>Select the video...</span> 17 <span>Select the video...</span>
18 <input type="file" name="input_video" id="input_video"> 18 <input type="file" name="videofile" id="videofile">
19 </div> 19 </div>
20 20
21 <span *ngIf="fileToUpload">{{ fileToUpload.name }}</span> 21 <span *ngIf="fileToUpload">{{ fileToUpload.name }}</span>
diff --git a/client/angular/videos/components/add/videos-add.component.ts b/client/angular/videos/components/add/videos-add.component.ts
index 9926aed63..0004cfa20 100644
--- a/client/angular/videos/components/add/videos-add.component.ts
+++ b/client/angular/videos/components/add/videos-add.component.ts
@@ -22,7 +22,7 @@ export class VideosAddComponent implements OnInit {
22 constructor(private _router: Router, private _elementRef: ElementRef) {} 22 constructor(private _router: Router, private _elementRef: ElementRef) {}
23 23
24 ngOnInit() { 24 ngOnInit() {
25 jQuery(this._elementRef.nativeElement).find('#input_video').fileupload({ 25 jQuery(this._elementRef.nativeElement).find('#videofile').fileupload({
26 url: '/api/v1/videos', 26 url: '/api/v1/videos',
27 dataType: 'json', 27 dataType: 'json',
28 singleFileUploads: true, 28 singleFileUploads: true,
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js
index 4384724c1..97d3e6b5a 100644
--- a/server/controllers/api/v1/videos.js
+++ b/server/controllers/api/v1/videos.js
@@ -35,7 +35,7 @@ const storage = multer.diskStorage({
35 } 35 }
36}) 36})
37 37
38const reqFiles = multer({ storage: storage }).fields([{ name: 'input_video', maxCount: 1 }]) 38const reqFiles = multer({ storage: storage }).fields([{ name: 'videofile', maxCount: 1 }])
39 39
40router.get('/', cacheMiddleware.cache(false), listVideos) 40router.get('/', cacheMiddleware.cache(false), listVideos)
41router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo) 41router.post('/', reqFiles, reqValidator.videosAdd, cacheMiddleware.cache(false), addVideo)
@@ -50,7 +50,7 @@ module.exports = router
50// --------------------------------------------------------------------------- 50// ---------------------------------------------------------------------------
51 51
52function addVideo (req, res, next) { 52function addVideo (req, res, next) {
53 const video_file = req.files.input_video[0] 53 const video_file = req.files.videofile[0]
54 const video_infos = req.body 54 const video_infos = req.body
55 55
56 videos.seed(video_file.path, function (err, torrent) { 56 videos.seed(video_file.path, function (err, torrent) {
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js
index b31b0e894..dcc190e97 100644
--- a/server/tests/api/checkParams.js
+++ b/server/tests/api/checkParams.js
@@ -137,7 +137,7 @@ describe('Test parameters validator', function () {
137 description: 'my super description' 137 description: 'my super description'
138 } 138 }
139 const attach = { 139 const attach = {
140 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 140 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
141 } 141 }
142 makePostRequest(path, data, attach, done) 142 makePostRequest(path, data, attach, done)
143 }) 143 })
@@ -148,7 +148,7 @@ describe('Test parameters validator', function () {
148 description: 'my super description' 148 description: 'my super description'
149 } 149 }
150 const attach = { 150 const attach = {
151 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 151 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
152 } 152 }
153 makePostRequest(path, data, attach, done) 153 makePostRequest(path, data, attach, done)
154 }) 154 })
@@ -158,7 +158,7 @@ describe('Test parameters validator', function () {
158 name: 'my super name' 158 name: 'my super name'
159 } 159 }
160 const attach = { 160 const attach = {
161 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 161 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
162 } 162 }
163 makePostRequest(path, data, attach, done) 163 makePostRequest(path, data, attach, done)
164 }) 164 })
@@ -171,7 +171,7 @@ describe('Test parameters validator', function () {
171 'very very very very very very very very very very very very very very very long' 171 'very very very very very very very very very very very very very very very long'
172 } 172 }
173 const attach = { 173 const attach = {
174 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 174 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
175 } 175 }
176 makePostRequest(path, data, attach, done) 176 makePostRequest(path, data, attach, done)
177 }) 177 })
@@ -191,7 +191,7 @@ describe('Test parameters validator', function () {
191 description: 'my super description' 191 description: 'my super description'
192 } 192 }
193 const attach = { 193 const attach = {
194 'input_video': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') 194 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
195 } 195 }
196 makePostRequest(path, data, attach, done) 196 makePostRequest(path, data, attach, done)
197 }) 197 })
@@ -202,12 +202,12 @@ describe('Test parameters validator', function () {
202 description: 'my super description' 202 description: 'my super description'
203 } 203 }
204 const attach = { 204 const attach = {
205 'input_video': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 205 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
206 } 206 }
207 makePostRequest(path, data, attach, function () { 207 makePostRequest(path, data, attach, function () {
208 attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4') 208 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.mp4')
209 makePostRequest(path, data, attach, function () { 209 makePostRequest(path, data, attach, function () {
210 attach.input_video = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv') 210 attach.videofile = pathUtils.join(__dirname, 'fixtures', 'video_short.ogv')
211 makePostRequest(path, data, attach, done, true) 211 makePostRequest(path, data, attach, done, true)
212 }, true) 212 }, true)
213 }, true) 213 }, true)
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js
index ea0982e81..1b2f61059 100644
--- a/server/tests/api/utils.js
+++ b/server/tests/api/utils.js
@@ -185,7 +185,7 @@ function uploadVideo (url, name, description, fixture, end) {
185 .set('Accept', 'application/json') 185 .set('Accept', 'application/json')
186 .field('name', name) 186 .field('name', name)
187 .field('description', description) 187 .field('description', description)
188 .attach('input_video', pathUtils.join(__dirname, 'fixtures', fixture)) 188 .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
189 .expect(204) 189 .expect(204)
190 .end(end) 190 .end(end)
191} 191}