aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-17 16:04:53 +0100
committerChocobozzz <me@florianbigard.com>2021-11-18 09:04:30 +0100
commitb46cf4b920984492df598c1b61179acfc7f6f22e (patch)
tree21fda049c85be48ab3d37b537aafa98e94649ad7 /client/src/app/shared/shared-main
parent3cfa817672657df18260ece5b354efa0f3b6e317 (diff)
downloadPeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.gz
PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.zst
PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.zip
Add ability to remove hls/webtorrent files
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts11
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts9
2 files changed, 19 insertions, 1 deletions
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 472a8c810..4203ff1c0 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -14,7 +14,8 @@ import {
14 VideoPrivacy, 14 VideoPrivacy,
15 VideoScheduleUpdate, 15 VideoScheduleUpdate,
16 VideoState, 16 VideoState,
17 VideoStreamingPlaylist 17 VideoStreamingPlaylist,
18 VideoStreamingPlaylistType
18} from '@shared/models' 19} from '@shared/models'
19 20
20export class Video implements VideoServerModel { 21export class Video implements VideoServerModel {
@@ -219,6 +220,14 @@ export class Video implements VideoServerModel {
219 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) 220 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
220 } 221 }
221 222
223 hasHLS () {
224 return this.streamingPlaylists?.some(p => p.type === VideoStreamingPlaylistType.HLS)
225 }
226
227 hasWebTorrent () {
228 return this.files && this.files.length !== 0
229 }
230
222 isLiveInfoAvailableBy (user: AuthUser) { 231 isLiveInfoAvailableBy (user: AuthUser) {
223 return this.isLive && 232 return this.isLive &&
224 user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE)) 233 user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.GET_ANY_LIVE))
diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts
index 570e8e3be..d135a27dc 100644
--- a/client/src/app/shared/shared-main/video/video.service.ts
+++ b/client/src/app/shared/shared-main/video/video.service.ts
@@ -299,6 +299,15 @@ export class VideoService {
299 ) 299 )
300 } 300 }
301 301
302 removeVideoFiles (videoIds: (number | string)[], type: 'hls' | 'webtorrent') {
303 return from(videoIds)
304 .pipe(
305 concatMap(id => this.authHttp.delete(VideoService.BASE_VIDEO_URL + '/' + id + '/' + type)),
306 toArray(),
307 catchError(err => this.restExtractor.handleError(err))
308 )
309 }
310
302 loadCompleteDescription (descriptionPath: string) { 311 loadCompleteDescription (descriptionPath: string) {
303 return this.authHttp 312 return this.authHttp
304 .get<{ description: string }>(environment.apiUrl + descriptionPath) 313 .get<{ description: string }>(environment.apiUrl + descriptionPath)