aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-02 15:43:44 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitaf4ae64f6faf38f8179f2e07d3cd4ad60006be92 (patch)
treea2d39ddc138d49619f03f11e003c2302f824286c /shared
parent77e9f859c6ad75ba179dec74e5410cc651eaa49b (diff)
downloadPeerTube-af4ae64f6faf38f8179f2e07d3cd4ad60006be92.tar.gz
PeerTube-af4ae64f6faf38f8179f2e07d3cd4ad60006be92.tar.zst
PeerTube-af4ae64f6faf38f8179f2e07d3cd4ad60006be92.zip
Begin live tests
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/server/servers.ts5
-rw-r--r--shared/extra-utils/videos/live.ts14
-rw-r--r--shared/models/activitypub/objects/video-torrent-object.ts2
-rw-r--r--shared/models/users/user-right.enum.ts1
-rw-r--r--shared/models/videos/video-create.model.ts4
5 files changed, 17 insertions, 9 deletions
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 994aac628..b4bd55968 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -10,10 +10,12 @@ import { randomInt } from '../../core-utils/miscs/miscs'
10 10
11interface ServerInfo { 11interface ServerInfo {
12 app: ChildProcess 12 app: ChildProcess
13
13 url: string 14 url: string
14 host: string 15 host: string
15 16 hostname: string
16 port: number 17 port: number
18
17 parallel: boolean 19 parallel: boolean
18 internalServerNumber: number 20 internalServerNumber: number
19 serverNumber: number 21 serverNumber: number
@@ -109,6 +111,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
109 serverNumber, 111 serverNumber,
110 url: `http://localhost:${port}`, 112 url: `http://localhost:${port}`,
111 host: `localhost:${port}`, 113 host: `localhost:${port}`,
114 hostname: 'localhost',
112 client: { 115 client: {
113 id: null, 116 id: null,
114 secret: null 117 secret: null
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts
index f500fdc3e..65942db0a 100644
--- a/shared/extra-utils/videos/live.ts
+++ b/shared/extra-utils/videos/live.ts
@@ -2,8 +2,8 @@ import * as ffmpeg from 'fluent-ffmpeg'
2import { LiveVideoCreate, LiveVideoUpdate, VideoDetails, VideoState } from '@shared/models' 2import { LiveVideoCreate, LiveVideoUpdate, VideoDetails, VideoState } from '@shared/models'
3import { buildAbsoluteFixturePath, wait } from '../miscs/miscs' 3import { buildAbsoluteFixturePath, wait } from '../miscs/miscs'
4import { makeGetRequest, makePutBodyRequest, makeUploadRequest } from '../requests/requests' 4import { makeGetRequest, makePutBodyRequest, makeUploadRequest } from '../requests/requests'
5import { ServerInfo } from '../server/servers' 5import { getVideoWithToken } from './videos'
6import { getVideo, getVideoWithToken } from './videos' 6import { omit } from 'lodash'
7 7
8function getLive (url: string, token: string, videoId: number | string, statusCodeExpected = 200) { 8function getLive (url: string, token: string, videoId: number | string, statusCodeExpected = 200) {
9 const path = '/api/v1/videos/live' 9 const path = '/api/v1/videos/live'
@@ -31,16 +31,18 @@ function updateLive (url: string, token: string, videoId: number | string, field
31function createLive (url: string, token: string, fields: LiveVideoCreate, statusCodeExpected = 200) { 31function createLive (url: string, token: string, fields: LiveVideoCreate, statusCodeExpected = 200) {
32 const path = '/api/v1/videos/live' 32 const path = '/api/v1/videos/live'
33 33
34 let attaches: any = {} 34 const attaches: any = {}
35 if (fields.thumbnailfile) attaches = { thumbnailfile: fields.thumbnailfile } 35 if (fields.thumbnailfile) attaches.thumbnailfile = fields.thumbnailfile
36 if (fields.previewfile) attaches = { previewfile: fields.previewfile } 36 if (fields.previewfile) attaches.previewfile = fields.previewfile
37
38 const updatedFields = omit(fields, 'thumbnailfile', 'previewfile')
37 39
38 return makeUploadRequest({ 40 return makeUploadRequest({
39 url, 41 url,
40 path, 42 path,
41 token, 43 token,
42 attaches, 44 attaches,
43 fields, 45 fields: updatedFields,
44 statusCodeExpected 46 statusCodeExpected
45 }) 47 })
46} 48}
diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts
index 5b035a371..d99d273c3 100644
--- a/shared/models/activitypub/objects/video-torrent-object.ts
+++ b/shared/models/activitypub/objects/video-torrent-object.ts
@@ -21,7 +21,9 @@ export interface VideoObject {
21 views: number 21 views: number
22 22
23 sensitive: boolean 23 sensitive: boolean
24
24 isLiveBroadcast: boolean 25 isLiveBroadcast: boolean
26 liveSaveReplay: boolean
25 27
26 commentsEnabled: boolean 28 commentsEnabled: boolean
27 downloadEnabled: boolean 29 downloadEnabled: boolean
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index 4c3d9e7c8..e815fa893 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -30,6 +30,7 @@ export const enum UserRight {
30 UPDATE_ANY_VIDEO, 30 UPDATE_ANY_VIDEO,
31 UPDATE_ANY_VIDEO_PLAYLIST, 31 UPDATE_ANY_VIDEO_PLAYLIST,
32 32
33 GET_ANY_LIVE,
33 SEE_ALL_VIDEOS, 34 SEE_ALL_VIDEOS,
34 CHANGE_VIDEO_OWNERSHIP, 35 CHANGE_VIDEO_OWNERSHIP,
35 36
diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts
index 175327afa..9e980529d 100644
--- a/shared/models/videos/video-create.model.ts
+++ b/shared/models/videos/video-create.model.ts
@@ -18,6 +18,6 @@ export interface VideoCreate {
18 scheduleUpdate?: VideoScheduleUpdate 18 scheduleUpdate?: VideoScheduleUpdate
19 originallyPublishedAt?: Date | string 19 originallyPublishedAt?: Date | string
20 20
21 thumbnailfile?: Blob 21 thumbnailfile?: Blob | string
22 previewfile?: Blob 22 previewfile?: Blob | string
23} 23}