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 | |
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')
4 files changed, 6 insertions, 37 deletions
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts index 3816cab19..be0630395 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -30,7 +30,7 @@ import { FeedComponent } from './feeds' | |||
30 | import { LoaderComponent, SmallLoaderComponent } from './loaders' | 30 | import { LoaderComponent, SmallLoaderComponent } from './loaders' |
31 | import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' | 31 | import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' |
32 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' | 32 | import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' |
33 | import { LiveVideoService, RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' | 33 | import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' |
34 | import { VideoCaptionService } from './video-caption' | 34 | import { VideoCaptionService } from './video-caption' |
35 | import { VideoChannelService } from './video-channel' | 35 | import { VideoChannelService } from './video-channel' |
36 | 36 | ||
@@ -152,7 +152,6 @@ import { VideoChannelService } from './video-channel' | |||
152 | RedundancyService, | 152 | RedundancyService, |
153 | VideoImportService, | 153 | VideoImportService, |
154 | VideoOwnershipService, | 154 | VideoOwnershipService, |
155 | LiveVideoService, | ||
156 | VideoService, | 155 | VideoService, |
157 | 156 | ||
158 | VideoCaptionService, | 157 | VideoCaptionService, |
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 | } |