aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-11 16:01:56 +0200
commit0a6658fdcbd779ada8f3758048c326e997902d5a (patch)
tree5de40bf901db0299011104b1344783637b964eb0 /client/src/app/videos
parente6d4b0ff2404dcf0b3a755c3fcc415ffeb6e754d (diff)
downloadPeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.gz
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.tar.zst
PeerTube-0a6658fdcbd779ada8f3758048c326e997902d5a.zip
Use global uuid instead of remoteId for videos
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/shared/video.model.ts7
-rw-r--r--client/src/app/videos/shared/video.service.ts18
-rw-r--r--client/src/app/videos/video-edit/video-update.component.ts6
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.html4
-rw-r--r--client/src/app/videos/video-watch/video-share.component.ts2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.html2
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts4
-rw-r--r--client/src/app/videos/videos-routing.module.ts8
8 files changed, 27 insertions, 24 deletions
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index f5e16fc13..9ed6a0641 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -14,7 +14,8 @@ export class Video implements VideoServerModel {
14 description: string 14 description: string
15 duration: number 15 duration: number
16 durationLabel: string 16 durationLabel: string
17 id: string 17 id: number
18 uuid: string
18 isLocal: boolean 19 isLocal: boolean
19 magnetUri: string 20 magnetUri: string
20 name: string 21 name: string
@@ -51,7 +52,8 @@ export class Video implements VideoServerModel {
51 language: number 52 language: number
52 description: string, 53 description: string,
53 duration: number 54 duration: number
54 id: string, 55 id: number,
56 uuid: string,
55 isLocal: boolean, 57 isLocal: boolean,
56 magnetUri: string, 58 magnetUri: string,
57 name: string, 59 name: string,
@@ -75,6 +77,7 @@ export class Video implements VideoServerModel {
75 this.duration = hash.duration 77 this.duration = hash.duration
76 this.durationLabel = Video.createDurationString(hash.duration) 78 this.durationLabel = Video.createDurationString(hash.duration)
77 this.id = hash.id 79 this.id = hash.id
80 this.uuid = hash.uuid
78 this.isLocal = hash.isLocal 81 this.isLocal = hash.isLocal
79 this.magnetUri = hash.magnetUri 82 this.magnetUri = hash.magnetUri
80 this.name = hash.name 83 this.name = hash.name
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts
index dc12c0637..67091a8d8 100644
--- a/client/src/app/videos/shared/video.service.ts
+++ b/client/src/app/videos/shared/video.service.ts
@@ -52,8 +52,8 @@ export class VideoService {
52 return this.loadVideoAttributeEnum('languages', this.videoLanguages) 52 return this.loadVideoAttributeEnum('languages', this.videoLanguages)
53 } 53 }
54 54
55 getVideo (id: string): Observable<Video> { 55 getVideo (uuid: string): Observable<Video> {
56 return this.http.get(VideoService.BASE_VIDEO_URL + id) 56 return this.http.get(VideoService.BASE_VIDEO_URL + uuid)
57 .map(this.restExtractor.extractDataGet) 57 .map(this.restExtractor.extractDataGet)
58 .map(videoHash => new Video(videoHash)) 58 .map(videoHash => new Video(videoHash))
59 .catch((res) => this.restExtractor.handleError(res)) 59 .catch((res) => this.restExtractor.handleError(res))
@@ -89,7 +89,7 @@ export class VideoService {
89 .catch((res) => this.restExtractor.handleError(res)) 89 .catch((res) => this.restExtractor.handleError(res))
90 } 90 }
91 91
92 removeVideo (id: string) { 92 removeVideo (id: number) {
93 return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id) 93 return this.authHttp.delete(VideoService.BASE_VIDEO_URL + id)
94 .map(this.restExtractor.extractDataBool) 94 .map(this.restExtractor.extractDataBool)
95 .catch((res) => this.restExtractor.handleError(res)) 95 .catch((res) => this.restExtractor.handleError(res))
@@ -106,7 +106,7 @@ export class VideoService {
106 .catch((res) => this.restExtractor.handleError(res)) 106 .catch((res) => this.restExtractor.handleError(res))
107 } 107 }
108 108
109 reportVideo (id: string, reason: string) { 109 reportVideo (id: number, reason: string) {
110 const url = VideoService.BASE_VIDEO_URL + id + '/abuse' 110 const url = VideoService.BASE_VIDEO_URL + id + '/abuse'
111 const body: VideoAbuseCreate = { 111 const body: VideoAbuseCreate = {
112 reason 112 reason
@@ -117,15 +117,15 @@ export class VideoService {
117 .catch((res) => this.restExtractor.handleError(res)) 117 .catch((res) => this.restExtractor.handleError(res))
118 } 118 }
119 119
120 setVideoLike (id: string) { 120 setVideoLike (id: number) {
121 return this.setVideoRate(id, 'like') 121 return this.setVideoRate(id, 'like')
122 } 122 }
123 123
124 setVideoDislike (id: string) { 124 setVideoDislike (id: number) {
125 return this.setVideoRate(id, 'dislike') 125 return this.setVideoRate(id, 'dislike')
126 } 126 }
127 127
128 getUserVideoRating (id: string): Observable<UserVideoRate> { 128 getUserVideoRating (id: number): Observable<UserVideoRate> {
129 const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating' 129 const url = UserService.BASE_USERS_URL + '/me/videos/' + id + '/rating'
130 130
131 return this.authHttp.get(url) 131 return this.authHttp.get(url)
@@ -133,13 +133,13 @@ export class VideoService {
133 .catch((res) => this.restExtractor.handleError(res)) 133 .catch((res) => this.restExtractor.handleError(res))
134 } 134 }
135 135
136 blacklistVideo (id: string) { 136 blacklistVideo (id: number) {
137 return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {}) 137 return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {})
138 .map(this.restExtractor.extractDataBool) 138 .map(this.restExtractor.extractDataBool)
139 .catch((res) => this.restExtractor.handleError(res)) 139 .catch((res) => this.restExtractor.handleError(res))
140 } 140 }
141 141
142 private setVideoRate (id: string, rateType: VideoRateType) { 142 private setVideoRate (id: number, rateType: VideoRateType) {
143 const url = VideoService.BASE_VIDEO_URL + id + '/rate' 143 const url = VideoService.BASE_VIDEO_URL + id + '/rate'
144 const body: UserVideoRateUpdate = { 144 const body: UserVideoRateUpdate = {
145 rating: rateType 145 rating: rateType
diff --git a/client/src/app/videos/video-edit/video-update.component.ts b/client/src/app/videos/video-edit/video-update.component.ts
index 9ee7ca6a8..6c57a23d8 100644
--- a/client/src/app/videos/video-edit/video-update.component.ts
+++ b/client/src/app/videos/video-edit/video-update.component.ts
@@ -85,8 +85,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
85 this.videoLicences = this.videoService.videoLicences 85 this.videoLicences = this.videoService.videoLicences
86 this.videoLanguages = this.videoService.videoLanguages 86 this.videoLanguages = this.videoService.videoLanguages
87 87
88 const id = this.route.snapshot.params['id'] 88 const uuid: string = this.route.snapshot.params['uuid']
89 this.videoService.getVideo(id) 89 this.videoService.getVideo(uuid)
90 .subscribe( 90 .subscribe(
91 video => { 91 video => {
92 this.video = video 92 this.video = video
@@ -118,7 +118,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
118 .subscribe( 118 .subscribe(
119 () => { 119 () => {
120 this.notificationsService.success('Success', 'Video updated.') 120 this.notificationsService.success('Success', 'Video updated.')
121 this.router.navigate([ '/videos/watch', this.video.id ]) 121 this.router.navigate([ '/videos/watch', this.video.uuid ])
122 }, 122 },
123 123
124 err => { 124 err => {
diff --git a/client/src/app/videos/video-list/video-miniature.component.html b/client/src/app/videos/video-list/video-miniature.component.html
index db6c4d6fb..6525b67bf 100644
--- a/client/src/app/videos/video-list/video-miniature.component.html
+++ b/client/src/app/videos/video-list/video-miniature.component.html
@@ -1,6 +1,6 @@
1<div class="video-miniature"> 1<div class="video-miniature">
2 <a 2 <a
3 [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description" 3 [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.description"
4 class="video-miniature-thumbnail" 4 class="video-miniature-thumbnail"
5 > 5 >
6 <img *ngIf="isVideoNSFWForThisUser() === false" [attr.src]="video.thumbnailUrl" alt="video thumbnail" /> 6 <img *ngIf="isVideoNSFWForThisUser() === false" [attr.src]="video.thumbnailUrl" alt="video thumbnail" />
@@ -16,7 +16,7 @@
16 16
17 <div class="video-miniature-informations"> 17 <div class="video-miniature-informations">
18 <span class="video-miniature-name"> 18 <span class="video-miniature-name">
19 <a [routerLink]="['/videos/watch', video.id]" [attr.title]="getVideoName()" class="video-miniature-name">{{ getVideoName() }}</a> 19 <a [routerLink]="['/videos/watch', video.uuid]" [attr.title]="getVideoName()" class="video-miniature-name">{{ getVideoName() }}</a>
20 </span> 20 </span>
21 21
22 <div class="video-miniature-tags"> 22 <div class="video-miniature-tags">
diff --git a/client/src/app/videos/video-watch/video-share.component.ts b/client/src/app/videos/video-watch/video-share.component.ts
index bbd25f5ef..133f93498 100644
--- a/client/src/app/videos/video-watch/video-share.component.ts
+++ b/client/src/app/videos/video-watch/video-share.component.ts
@@ -27,7 +27,7 @@ export class VideoShareComponent {
27 27
28 getVideoIframeCode () { 28 getVideoIframeCode () {
29 return '<iframe width="560" height="315" ' + 29 return '<iframe width="560" height="315" ' +
30 'src="' + window.location.origin + '/videos/embed/' + this.video.id + '" ' + 30 'src="' + window.location.origin + '/videos/embed/' + this.video.uuid + '" ' +
31 'frameborder="0" allowfullscreen>' + 31 'frameborder="0" allowfullscreen>' +
32 '</iframe>' 32 '</iframe>'
33 } 33 }
diff --git a/client/src/app/videos/video-watch/video-watch.component.html b/client/src/app/videos/video-watch/video-watch.component.html
index 8676b5b72..88863131a 100644
--- a/client/src/app/videos/video-watch/video-watch.component.html
+++ b/client/src/app/videos/video-watch/video-watch.component.html
@@ -65,7 +65,7 @@
65 65
66 <ul *dropdownMenu class="dropdown-menu" id="more-menu" role="menu" aria-labelledby="single-button"> 66 <ul *dropdownMenu class="dropdown-menu" id="more-menu" role="menu" aria-labelledby="single-button">
67 <li *ngIf="canUserUpdateVideo()" role="menuitem"> 67 <li *ngIf="canUserUpdateVideo()" role="menuitem">
68 <a class="dropdown-item" title="Update this video" href="#" [routerLink]="[ '/videos/edit', video.id ]"> 68 <a class="dropdown-item" title="Update this video" href="#" [routerLink]="[ '/videos/edit', video.uuid ]">
69 <span class="glyphicon glyphicon-pencil"></span> Update 69 <span class="glyphicon glyphicon-pencil"></span> Update
70 </a> 70 </a>
71 </li> 71 </li>
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index 6bd6c1f7e..104ba0db6 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -58,8 +58,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
58 58
59 ngOnInit () { 59 ngOnInit () {
60 this.paramsSub = this.route.params.subscribe(routeParams => { 60 this.paramsSub = this.route.params.subscribe(routeParams => {
61 let id = routeParams['id'] 61 let uuid = routeParams['uuid']
62 this.videoService.getVideo(id).subscribe( 62 this.videoService.getVideo(uuid).subscribe(
63 video => this.onVideoFetched(video), 63 video => this.onVideoFetched(video),
64 64
65 error => { 65 error => {
diff --git a/client/src/app/videos/videos-routing.module.ts b/client/src/app/videos/videos-routing.module.ts
index e18c1cec0..715671ba7 100644
--- a/client/src/app/videos/videos-routing.module.ts
+++ b/client/src/app/videos/videos-routing.module.ts
@@ -33,7 +33,7 @@ const videosRoutes: Routes = [
33 } 33 }
34 }, 34 },
35 { 35 {
36 path: 'edit/:id', 36 path: 'edit/:uuid',
37 component: VideoUpdateComponent, 37 component: VideoUpdateComponent,
38 data: { 38 data: {
39 meta: { 39 meta: {
@@ -42,11 +42,11 @@ const videosRoutes: Routes = [
42 } 42 }
43 }, 43 },
44 { 44 {
45 path: ':id', 45 path: ':uuid',
46 redirectTo: 'watch/:id' 46 redirectTo: 'watch/:uuid'
47 }, 47 },
48 { 48 {
49 path: 'watch/:id', 49 path: 'watch/:uuid',
50 component: VideoWatchComponent 50 component: VideoWatchComponent
51 } 51 }
52 ] 52 ]