]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/utils/videos/video-imports.ts
Fix notification icon position
[github/Chocobozzz/PeerTube.git] / shared / utils / videos / video-imports.ts
CommitLineData
bc22d608 1
d4681c00 2import { VideoImportCreate } from '../../models/videos'
d175a6f7 3import { makeGetRequest, makeUploadRequest } from '../requests/requests'
590fb506
C
4
5function getYoutubeVideoUrl () {
6 return 'https://youtu.be/msX3jv1XdvM'
7}
8
187501f8
C
9function getMagnetURI () {
10 // tslint:disable:max-line-length
3e17515e 11 return 'magnet:?xs=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Ftorrents%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.torrent&xt=urn:btih:0f498834733e8057ed5c6f2ee2b4efd8d84a76ee&dn=super+peertube2+video&tr=wss%3A%2F%2Fpeertube2.cpy.re%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube2.cpy.re%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube2.cpy.re%2Fstatic%2Fwebseed%2Fb209ca00-c8bb-4b2b-b421-1ede169f3dbc-720.mp4'
187501f8
C
12}
13
590fb506
C
14function importVideo (url: string, token: string, attributes: VideoImportCreate) {
15 const path = '/api/v1/videos/imports'
16
187501f8
C
17 let attaches: any = {}
18 if (attributes.torrentfile) attaches = { torrentfile: attributes.torrentfile }
19
20 return makeUploadRequest({
590fb506
C
21 url,
22 path,
23 token,
187501f8 24 attaches,
590fb506
C
25 fields: attributes,
26 statusCodeExpected: 200
27 })
28}
29
3e17515e 30function getMyVideoImports (url: string, token: string, sort?: string) {
590fb506
C
31 const path = '/api/v1/users/me/videos/imports'
32
3e17515e
C
33 const query = {}
34 if (sort) query['sort'] = sort
35
590fb506
C
36 return makeGetRequest({
37 url,
3e17515e 38 query,
590fb506
C
39 path,
40 token,
41 statusCodeExpected: 200
42 })
43}
44
45// ---------------------------------------------------------------------------
46
47export {
48 getYoutubeVideoUrl,
49 importVideo,
187501f8 50 getMagnetURI,
590fb506
C
51 getMyVideoImports
52}