aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-05 10:56:23 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitf8c00564e7e66c7c9d65ea044a4c1485df0e4c7c (patch)
tree895792776837b477d4daff3d1c112942015d0371 /client/src/app/shared/shared-main
parentba881f0e3f60218b28abbb59d23118db5f97d5f8 (diff)
downloadPeerTube-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')
-rw-r--r--client/src/app/shared/shared-main/shared-main.module.ts3
-rw-r--r--client/src/app/shared/shared-main/video/index.ts1
-rw-r--r--client/src/app/shared/shared-main/video/live-video.service.ts34
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts5
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'
30import { LoaderComponent, SmallLoaderComponent } from './loaders' 30import { LoaderComponent, SmallLoaderComponent } from './loaders'
31import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc' 31import { HelpComponent, ListOverflowComponent, TopMenuDropdownComponent } from './misc'
32import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users' 32import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users'
33import { LiveVideoService, RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video' 33import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video'
34import { VideoCaptionService } from './video-caption' 34import { VideoCaptionService } from './video-caption'
35import { VideoChannelService } from './video-channel' 35import { 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 @@
1export * from './live-video.service'
2export * from './redundancy.service' 1export * from './redundancy.service'
3export * from './video-details.model' 2export * from './video-details.model'
4export * from './video-edit.model' 3export * 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 @@
1import { catchError } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core'
4import { RestExtractor } from '@app/core'
5import { LiveVideo, LiveVideoCreate, LiveVideoUpdate } from '@shared/models'
6import { environment } from '../../../../environments/environment'
7
8@Injectable()
9export 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 }