diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-05 10:56:23 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-11-09 15:33:04 +0100 |
commit | f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c (patch) | |
tree | 895792776837b477d4daff3d1c112942015d0371 /client/src/app/shared/shared-main/video | |
parent | ba881f0e3f60218b28abbb59d23118db5f97d5f8 (diff) | |
download | PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.gz PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.tar.zst PeerTube-f8c00564e7e66c7c9d65ea044a4c1485df0e4c7c.zip |
Add live info in watch page
Diffstat (limited to 'client/src/app/shared/shared-main/video')
-rw-r--r-- | client/src/app/shared/shared-main/video/index.ts | 1 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/video/live-video.service.ts | 34 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/video/video.model.ts | 5 |
3 files changed, 5 insertions, 35 deletions
diff --git a/client/src/app/shared/shared-main/video/index.ts b/client/src/app/shared/shared-main/video/index.ts index f69089517..3053df4ef 100644 --- a/client/src/app/shared/shared-main/video/index.ts +++ b/client/src/app/shared/shared-main/video/index.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | export * from './live-video.service' | ||
2 | export * from './redundancy.service' | 1 | export * from './redundancy.service' |
3 | export * from './video-details.model' | 2 | export * from './video-details.model' |
4 | export * from './video-edit.model' | 3 | export * from './video-edit.model' |
diff --git a/client/src/app/shared/shared-main/video/live-video.service.ts b/client/src/app/shared/shared-main/video/live-video.service.ts deleted file mode 100644 index 093d65e83..000000000 --- a/client/src/app/shared/shared-main/video/live-video.service.ts +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import { catchError } from 'rxjs/operators' | ||
2 | import { HttpClient } from '@angular/common/http' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { RestExtractor } from '@app/core' | ||
5 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models' | ||
6 | import { environment } from '../../../../environments/environment' | ||
7 | |||
8 | @Injectable() | ||
9 | export class LiveVideoService { | ||
10 | static BASE_VIDEO_LIVE_URL = environment.apiUrl + '/api/v1/videos/live/' | ||
11 | |||
12 | constructor ( | ||
13 | private authHttp: HttpClient, | ||
14 | private restExtractor: RestExtractor | ||
15 | ) {} | ||
16 | |||
17 | goLive (video: LiveVideoCreate) { | ||
18 | return this.authHttp | ||
19 | .post<{ video: { id: number, uuid: string } }>(LiveVideoService.BASE_VIDEO_LIVE_URL, video) | ||
20 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
21 | } | ||
22 | |||
23 | getVideoLive (videoId: number | string) { | ||
24 | return this.authHttp | ||
25 | .get<LiveVideo>(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId) | ||
26 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
27 | } | ||
28 | |||
29 | updateLive (videoId: number | string, liveUpdate: LiveVideoUpdate) { | ||
30 | return this.authHttp | ||
31 | .put(LiveVideoService.BASE_VIDEO_LIVE_URL + videoId, liveUpdate) | ||
32 | .pipe(catchError(err => this.restExtractor.handleError(err))) | ||
33 | } | ||
34 | } | ||
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts index e3a52af3d..92f5bc0c0 100644 --- a/client/src/app/shared/shared-main/video/video.model.ts +++ b/client/src/app/shared/shared-main/video/video.model.ts | |||
@@ -193,6 +193,11 @@ export class Video implements VideoServerModel { | |||
193 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) | 193 | return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) |
194 | } | 194 | } |
195 | 195 | ||
196 | isLiveInfoAvailableBy (user: AuthUser) { | ||
197 | return this.isLive && | ||
198 | user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE)) | ||
199 | } | ||
200 | |||
196 | canBeDuplicatedBy (user: AuthUser) { | 201 | canBeDuplicatedBy (user: AuthUser) { |
197 | return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) | 202 | return user && this.isLocal === false && user.hasRight(UserRight.MANAGE_VIDEOS_REDUNDANCIES) |
198 | } | 203 | } |