aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-04-04 21:37:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-04-04 21:37:03 +0200
commit92fb909c9b4a92a00b0d0da7629e6fb003de281b (patch)
tree8119c6720d5dec0474983501843f1e699fde150a /client/src
parent1d49e1e27d63db1dfc9a7fd28c9902f488831a89 (diff)
downloadPeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.gz
PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.tar.zst
PeerTube-92fb909c9b4a92a00b0d0da7629e6fb003de281b.zip
Client: Handle NSFW video
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/app.component.ts4
-rw-r--r--client/src/app/core/auth/auth-user.model.ts15
-rw-r--r--client/src/app/core/config/config.service.ts36
-rw-r--r--client/src/app/core/config/index.ts1
-rw-r--r--client/src/app/core/core.module.ts4
-rw-r--r--client/src/app/core/index.ts1
-rw-r--r--client/src/app/shared/users/user.model.ts10
-rw-r--r--client/src/app/videos/shared/video.model.ts12
-rw-r--r--client/src/app/videos/video-add/video-add.component.html8
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts3
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.html8
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.scss15
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.ts14
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts44
-rw-r--r--client/src/app/videos/video-watch/webtorrent.service.ts4
15 files changed, 157 insertions, 22 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 4e33fae52..3c06b320e 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -1,7 +1,7 @@
1import { Component, OnInit, ViewContainerRef } from '@angular/core'; 1import { Component, OnInit, ViewContainerRef } from '@angular/core';
2import { Router } from '@angular/router'; 2import { Router } from '@angular/router';
3 3
4import { AuthService } from './core'; 4import { AuthService, ConfigService } from './core';
5import { VideoService } from './videos'; 5import { VideoService } from './videos';
6import { UserService } from './shared'; 6import { UserService } from './shared';
7 7
@@ -27,6 +27,7 @@ export class AppComponent implements OnInit {
27 constructor( 27 constructor(
28 private router: Router, 28 private router: Router,
29 private authService: AuthService, 29 private authService: AuthService,
30 private configService: ConfigService,
30 private userService: UserService, 31 private userService: UserService,
31 private videoService: VideoService, 32 private videoService: VideoService,
32 viewContainerRef: ViewContainerRef 33 viewContainerRef: ViewContainerRef
@@ -38,6 +39,7 @@ export class AppComponent implements OnInit {
38 this.userService.checkTokenValidity(); 39 this.userService.checkTokenValidity();
39 } 40 }
40 41
42 this.configService.loadConfig();
41 this.videoService.loadVideoCategories(); 43 this.videoService.loadVideoCategories();
42 this.videoService.loadVideoLicences(); 44 this.videoService.loadVideoLicences();
43 } 45 }
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 5d61954d6..cb7e88d19 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -5,7 +5,8 @@ export class AuthUser extends User {
5 private static KEYS = { 5 private static KEYS = {
6 ID: 'id', 6 ID: 'id',
7 ROLE: 'role', 7 ROLE: 'role',
8 USERNAME: 'username' 8 USERNAME: 'username',
9 DISPLAY_NSFW: 'display_nsfw'
9 }; 10 };
10 11
11 tokens: Tokens; 12 tokens: Tokens;
@@ -17,7 +18,8 @@ export class AuthUser extends User {
17 { 18 {
18 id: parseInt(localStorage.getItem(this.KEYS.ID)), 19 id: parseInt(localStorage.getItem(this.KEYS.ID)),
19 username: localStorage.getItem(this.KEYS.USERNAME), 20 username: localStorage.getItem(this.KEYS.USERNAME),
20 role: localStorage.getItem(this.KEYS.ROLE) 21 role: localStorage.getItem(this.KEYS.ROLE),
22 displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true'
21 }, 23 },
22 Tokens.load() 24 Tokens.load()
23 ); 25 );
@@ -30,10 +32,16 @@ export class AuthUser extends User {
30 localStorage.removeItem(this.KEYS.USERNAME); 32 localStorage.removeItem(this.KEYS.USERNAME);
31 localStorage.removeItem(this.KEYS.ID); 33 localStorage.removeItem(this.KEYS.ID);
32 localStorage.removeItem(this.KEYS.ROLE); 34 localStorage.removeItem(this.KEYS.ROLE);
35 localStorage.removeItem(this.KEYS.DISPLAY_NSFW);
33 Tokens.flush(); 36 Tokens.flush();
34 } 37 }
35 38
36 constructor(userHash: { id: number, username: string, role: string }, hashTokens: any) { 39 constructor(userHash: {
40 id: number,
41 username: string,
42 role: string,
43 displayNSFW: boolean
44 }, hashTokens: any) {
37 super(userHash); 45 super(userHash);
38 this.tokens = new Tokens(hashTokens); 46 this.tokens = new Tokens(hashTokens);
39 } 47 }
@@ -59,6 +67,7 @@ export class AuthUser extends User {
59 localStorage.setItem(AuthUser.KEYS.ID, this.id.toString()); 67 localStorage.setItem(AuthUser.KEYS.ID, this.id.toString());
60 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username); 68 localStorage.setItem(AuthUser.KEYS.USERNAME, this.username);
61 localStorage.setItem(AuthUser.KEYS.ROLE, this.role); 69 localStorage.setItem(AuthUser.KEYS.ROLE, this.role);
70 localStorage.setItem(AuthUser.KEYS.DISPLAY_NSFW, JSON.stringify(this.displayNSFW);
62 this.tokens.save(); 71 this.tokens.save();
63 } 72 }
64} 73}
diff --git a/client/src/app/core/config/config.service.ts b/client/src/app/core/config/config.service.ts
new file mode 100644
index 000000000..295e68c36
--- /dev/null
+++ b/client/src/app/core/config/config.service.ts
@@ -0,0 +1,36 @@
1import { Injectable } from '@angular/core';
2import { Http } from '@angular/http';
3
4import { RestExtractor } from '../../shared/rest';
5
6@Injectable()
7export class ConfigService {
8 private static BASE_CONFIG_URL = '/api/v1/config/';
9
10 private config: {
11 signup: {
12 enabled: boolean
13 }
14 } = {
15 signup: {
16 enabled: false
17 }
18 };
19
20 constructor(
21 private http: Http,
22 private restExtractor: RestExtractor,
23 ) {}
24
25 loadConfig() {
26 this.http.get(ConfigService.BASE_CONFIG_URL)
27 .map(this.restExtractor.extractDataGet)
28 .subscribe(data => {
29 this.config = data;
30 });
31 }
32
33 getConfig() {
34 return this.config;
35 }
36}
diff --git a/client/src/app/core/config/index.ts b/client/src/app/core/config/index.ts
new file mode 100644
index 000000000..90392254a
--- /dev/null
+++ b/client/src/app/core/config/index.ts
@@ -0,0 +1 @@
export * from './config.service';
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts
index ae2930552..9a5ee5221 100644
--- a/client/src/app/core/core.module.ts
+++ b/client/src/app/core/core.module.ts
@@ -7,6 +7,7 @@ import { SimpleNotificationsModule } from 'angular2-notifications';
7import { ModalModule } from 'ng2-bootstrap/modal'; 7import { ModalModule } from 'ng2-bootstrap/modal';
8 8
9import { AuthService } from './auth'; 9import { AuthService } from './auth';
10import { ConfigService } from './config';
10import { ConfirmComponent, ConfirmService } from './confirm'; 11import { ConfirmComponent, ConfirmService } from './confirm';
11import { MenuComponent, MenuAdminComponent } from './menu'; 12import { MenuComponent, MenuAdminComponent } from './menu';
12import { throwIfAlreadyLoaded } from './module-import-guard'; 13import { throwIfAlreadyLoaded } from './module-import-guard';
@@ -37,7 +38,8 @@ import { throwIfAlreadyLoaded } from './module-import-guard';
37 38
38 providers: [ 39 providers: [
39 AuthService, 40 AuthService,
40 ConfirmService 41 ConfirmService,
42 ConfigService
41 ] 43 ]
42}) 44})
43export class CoreModule { 45export class CoreModule {
diff --git a/client/src/app/core/index.ts b/client/src/app/core/index.ts
index 9b4dd1999..96b28658b 100644
--- a/client/src/app/core/index.ts
+++ b/client/src/app/core/index.ts
@@ -1,4 +1,5 @@
1export * from './auth'; 1export * from './auth';
2export * from './config';
2export * from './confirm'; 3export * from './confirm';
3export * from './menu'; 4export * from './menu';
4export * from './core.module' 5export * from './core.module'
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 52d89e004..f7859f495 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -2,12 +2,20 @@ export class User {
2 id: number; 2 id: number;
3 username: string; 3 username: string;
4 role: string; 4 role: string;
5 displayNSFW: boolean;
5 createdAt: Date; 6 createdAt: Date;
6 7
7 constructor(hash: { id: number, username: string, role: string, createdAt?: Date }) { 8 constructor(hash: {
9 id: number,
10 username: string,
11 role: string,
12 displayNSFW?: boolean,
13 createdAt?: Date,
14 }) {
8 this.id = hash.id; 15 this.id = hash.id;
9 this.username = hash.username; 16 this.username = hash.username;
10 this.role = hash.role; 17 this.role = hash.role;
18 this.displayNSFW = hash.displayNSFW;
11 19
12 if (hash.createdAt) { 20 if (hash.createdAt) {
13 this.createdAt = hash.createdAt; 21 this.createdAt = hash.createdAt;
diff --git a/client/src/app/videos/shared/video.model.ts b/client/src/app/videos/shared/video.model.ts
index 5ed622dce..3c588c446 100644
--- a/client/src/app/videos/shared/video.model.ts
+++ b/client/src/app/videos/shared/video.model.ts
@@ -1,3 +1,5 @@
1import { User } from '../../shared';
2
1export class Video { 3export class Video {
2 author: string; 4 author: string;
3 by: string; 5 by: string;
@@ -16,6 +18,7 @@ export class Video {
16 views: number; 18 views: number;
17 likes: number; 19 likes: number;
18 dislikes: number; 20 dislikes: number;
21 nsfw: boolean;
19 22
20 private static createByString(author: string, podHost: string) { 23 private static createByString(author: string, podHost: string) {
21 return author + '@' + podHost; 24 return author + '@' + podHost;
@@ -47,6 +50,7 @@ export class Video {
47 views: number, 50 views: number,
48 likes: number, 51 likes: number,
49 dislikes: number, 52 dislikes: number,
53 nsfw: boolean
50 }) { 54 }) {
51 this.author = hash.author; 55 this.author = hash.author;
52 this.createdAt = new Date(hash.createdAt); 56 this.createdAt = new Date(hash.createdAt);
@@ -64,11 +68,17 @@ export class Video {
64 this.views = hash.views; 68 this.views = hash.views;
65 this.likes = hash.likes; 69 this.likes = hash.likes;
66 this.dislikes = hash.dislikes; 70 this.dislikes = hash.dislikes;
71 this.nsfw = hash.nsfw;
67 72
68 this.by = Video.createByString(hash.author, hash.podHost); 73 this.by = Video.createByString(hash.author, hash.podHost);
69 } 74 }
70 75
71 isRemovableBy(user) { 76 isRemovableBy(user: User) {
72 return this.isLocal === true && user && this.author === user.username; 77 return this.isLocal === true && user && this.author === user.username;
73 } 78 }
79
80 isVideoNSFWForUser(user: User) {
81 // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos...
82 return (this.nsfw && (!user || user.displayNSFW === false));
83 }
74} 84}
diff --git a/client/src/app/videos/video-add/video-add.component.html b/client/src/app/videos/video-add/video-add.component.html
index 97a3c846a..a3c25c14b 100644
--- a/client/src/app/videos/video-add/video-add.component.html
+++ b/client/src/app/videos/video-add/video-add.component.html
@@ -15,6 +15,14 @@
15 </div> 15 </div>
16 16
17 <div class="form-group"> 17 <div class="form-group">
18 <label for="nsfw">NSFW</label>
19 <input
20 type="checkbox" id="nsfw"
21 formControlName="nsfw"
22 >
23 </div>
24
25 <div class="form-group">
18 <label for="category">Category</label> 26 <label for="category">Category</label>
19 <select class="form-control" id="category" formControlName="category"> 27 <select class="form-control" id="category" formControlName="category">
20 <option></option> 28 <option></option>
diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts
index 8fae233d3..ea7ad2e5c 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -71,6 +71,7 @@ export class VideoAddComponent extends FormReactive implements OnInit {
71 buildForm() { 71 buildForm() {
72 this.form = this.formBuilder.group({ 72 this.form = this.formBuilder.group({
73 name: [ '', VIDEO_NAME.VALIDATORS ], 73 name: [ '', VIDEO_NAME.VALIDATORS ],
74 nsfw: [ false ],
74 category: [ '', VIDEO_CATEGORY.VALIDATORS ], 75 category: [ '', VIDEO_CATEGORY.VALIDATORS ],
75 licence: [ '', VIDEO_LICENCE.VALIDATORS ], 76 licence: [ '', VIDEO_LICENCE.VALIDATORS ],
76 description: [ '', VIDEO_DESCRIPTION.VALIDATORS ], 77 description: [ '', VIDEO_DESCRIPTION.VALIDATORS ],
@@ -93,12 +94,14 @@ export class VideoAddComponent extends FormReactive implements OnInit {
93 94
94 this.uploader.onBuildItemForm = (item, form) => { 95 this.uploader.onBuildItemForm = (item, form) => {
95 const name = this.form.value['name']; 96 const name = this.form.value['name'];
97 const nsfw = this.form.value['nsfw'];
96 const category = this.form.value['category']; 98 const category = this.form.value['category'];
97 const licence = this.form.value['licence']; 99 const licence = this.form.value['licence'];
98 const description = this.form.value['description']; 100 const description = this.form.value['description'];
99 101
100 form.append('name', name); 102 form.append('name', name);
101 form.append('category', category); 103 form.append('category', category);
104 form.append('nsfw', nsfw);
102 form.append('licence', licence); 105 form.append('licence', licence);
103 form.append('description', description); 106 form.append('description', description);
104 107
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 b2bf35435..94b892698 100644
--- a/client/src/app/videos/video-list/video-miniature.component.html
+++ b/client/src/app/videos/video-list/video-miniature.component.html
@@ -3,7 +3,11 @@
3 [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description" 3 [routerLink]="['/videos/watch', video.id]" [attr.title]="video.description"
4 class="video-miniature-thumbnail" 4 class="video-miniature-thumbnail"
5 > 5 >
6 <img [attr.src]="video.thumbnailPath" alt="video thumbnail" /> 6 <img *ngIf="isVideoNSFWForThisUser() === false" [attr.src]="video.thumbnailPath" alt="video thumbnail" />
7 <div *ngIf="isVideoNSFWForThisUser()" class="thumbnail-nsfw">
8 NSFW
9 </div>
10
7 <span class="video-miniature-duration">{{ video.duration }}</span> 11 <span class="video-miniature-duration">{{ video.duration }}</span>
8 </a> 12 </a>
9 <span 13 <span
@@ -13,7 +17,7 @@
13 17
14 <div class="video-miniature-informations"> 18 <div class="video-miniature-informations">
15 <span class="video-miniature-name-tags"> 19 <span class="video-miniature-name-tags">
16 <a [routerLink]="['/videos/watch', video.id]" [attr.title]="video.name" class="video-miniature-name">{{ video.name }}</a> 20 <a [routerLink]="['/videos/watch', video.id]" [attr.title]="getVideoName()" class="video-miniature-name">{{ getVideoName() }}</a>
17 21
18 <div class="video-miniature-tags"> 22 <div class="video-miniature-tags">
19 <span *ngFor="let tag of video.tags" class="video-miniature-tag"> 23 <span *ngFor="let tag of video.tags" class="video-miniature-tag">
diff --git a/client/src/app/videos/video-list/video-miniature.component.scss b/client/src/app/videos/video-list/video-miniature.component.scss
index b5d24271a..b8e90e8c5 100644
--- a/client/src/app/videos/video-list/video-miniature.component.scss
+++ b/client/src/app/videos/video-list/video-miniature.component.scss
@@ -15,6 +15,21 @@
15 display: inline-block; 15 display: inline-block;
16 position: relative; 16 position: relative;
17 17
18 &:hover {
19 text-decoration: none !important;
20 }
21
22 .thumbnail-nsfw {
23 background-color: #000;
24 color: #fff;
25 text-align: center;
26 font-size: 30px;
27 line-height: 110px;
28
29 width: 200px;
30 height: 110px;
31 }
32
18 .video-miniature-duration { 33 .video-miniature-duration {
19 position: absolute; 34 position: absolute;
20 right: 5px; 35 right: 5px;
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts
index ba4715597..888026dde 100644
--- a/client/src/app/videos/video-list/video-miniature.component.ts
+++ b/client/src/app/videos/video-list/video-miniature.component.ts
@@ -2,7 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications'; 3import { NotificationsService } from 'angular2-notifications';
4 4
5import { ConfirmService } from '../../core'; 5import { ConfirmService, ConfigService } from '../../core';
6import { SortField, Video, VideoService } from '../shared'; 6import { SortField, Video, VideoService } from '../shared';
7import { User } from '../../shared'; 7import { User } from '../../shared';
8 8
@@ -24,6 +24,7 @@ export class VideoMiniatureComponent {
24 constructor( 24 constructor(
25 private notificationsService: NotificationsService, 25 private notificationsService: NotificationsService,
26 private confirmService: ConfirmService, 26 private confirmService: ConfirmService,
27 private configService: ConfigService,
27 private videoService: VideoService 28 private videoService: VideoService
28 ) {} 29 ) {}
29 30
@@ -31,6 +32,13 @@ export class VideoMiniatureComponent {
31 return this.hovering && this.video.isRemovableBy(this.user); 32 return this.hovering && this.video.isRemovableBy(this.user);
32 } 33 }
33 34
35 getVideoName() {
36 if (this.isVideoNSFWForThisUser())
37 return 'NSFW';
38
39 return this.video.name;
40 }
41
34 onBlur() { 42 onBlur() {
35 this.hovering = false; 43 this.hovering = false;
36 } 44 }
@@ -52,4 +60,8 @@ export class VideoMiniatureComponent {
52 } 60 }
53 ); 61 );
54 } 62 }
63
64 isVideoNSFWForThisUser() {
65 return this.video.isVideoNSFWForUser(this.user);
66 }
55} 67}
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 5678f6df8..37ed70a99 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,12 +1,13 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute, Router } from '@angular/router';
3import { Observable } from 'rxjs/Observable';
3import { Subscription } from 'rxjs/Subscription'; 4import { Subscription } from 'rxjs/Subscription';
4 5
5import * as videojs from 'video.js'; 6import * as videojs from 'video.js';
6import { MetaService } from '@nglibs/meta'; 7import { MetaService } from '@nglibs/meta';
7import { NotificationsService } from 'angular2-notifications'; 8import { NotificationsService } from 'angular2-notifications';
8 9
9import { AuthService } from '../../core'; 10import { AuthService, ConfirmService } from '../../core';
10import { VideoMagnetComponent } from './video-magnet.component'; 11import { VideoMagnetComponent } from './video-magnet.component';
11import { VideoShareComponent } from './video-share.component'; 12import { VideoShareComponent } from './video-share.component';
12import { VideoReportComponent } from './video-report.component'; 13import { VideoReportComponent } from './video-report.component';
@@ -47,7 +48,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
47 private elementRef: ElementRef, 48 private elementRef: ElementRef,
48 private ngZone: NgZone, 49 private ngZone: NgZone,
49 private route: ActivatedRoute, 50 private route: ActivatedRoute,
51 private router: Router,
50 private videoService: VideoService, 52 private videoService: VideoService,
53 private confirmService: ConfirmService,
51 private metaService: MetaService, 54 private metaService: MetaService,
52 private webTorrentService: WebTorrentService, 55 private webTorrentService: WebTorrentService,
53 private authService: AuthService, 56 private authService: AuthService,
@@ -58,15 +61,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
58 this.paramsSub = this.route.params.subscribe(routeParams => { 61 this.paramsSub = this.route.params.subscribe(routeParams => {
59 let id = routeParams['id']; 62 let id = routeParams['id'];
60 this.videoService.getVideo(id).subscribe( 63 this.videoService.getVideo(id).subscribe(
61 video => { 64 video => this.onVideoFetched(video),
62 this.video = video; 65
63 this.setOpenGraphTags(); 66 error => this.videoNotFound = true
64 this.loadVideo();
65 this.checkUserRating();
66 },
67 error => {
68 this.videoNotFound = true;
69 }
70 ); 67 );
71 }); 68 });
72 69
@@ -92,7 +89,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
92 window.clearInterval(this.torrentInfosInterval); 89 window.clearInterval(this.torrentInfosInterval);
93 window.clearTimeout(this.errorTimer); 90 window.clearTimeout(this.errorTimer);
94 91
95 if (this.video !== null) { 92 if (this.video !== null && this.webTorrentService.has(this.video.magnetUri)) {
96 this.webTorrentService.remove(this.video.magnetUri); 93 this.webTorrentService.remove(this.video.magnetUri);
97 } 94 }
98 95
@@ -206,6 +203,29 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
206 ); 203 );
207 } 204 }
208 205
206 private onVideoFetched(video: Video) {
207 this.video = video;
208
209 let observable;
210 if (this.video.isVideoNSFWForUser(this.authService.getUser())) {
211 observable = this.confirmService.confirm('This video is not safe for work. Are you sure you want to watch it?', 'NSFW');
212 } else {
213 observable = Observable.of(true);
214 }
215
216 observable.subscribe(
217 res => {
218 if (res === false) {
219 return this.router.navigate([ '/videos/list' ]);
220 }
221
222 this.setOpenGraphTags();
223 this.loadVideo();
224 this.checkUserRating();
225 }
226 );
227 }
228
209 private updateVideoRating(oldRating: RateType, newRating: RateType) { 229 private updateVideoRating(oldRating: RateType, newRating: RateType) {
210 let likesToIncrement = 0; 230 let likesToIncrement = 0;
211 let dislikesToIncrement = 0; 231 let dislikesToIncrement = 0;
diff --git a/client/src/app/videos/video-watch/webtorrent.service.ts b/client/src/app/videos/video-watch/webtorrent.service.ts
index 0192167ee..630a5c469 100644
--- a/client/src/app/videos/video-watch/webtorrent.service.ts
+++ b/client/src/app/videos/video-watch/webtorrent.service.ts
@@ -26,4 +26,8 @@ export class WebTorrentService {
26 remove(magnetUri: string) { 26 remove(magnetUri: string) {
27 return this.client.remove(magnetUri); 27 return this.client.remove(magnetUri);
28 } 28 }
29
30 has(magnetUri: string) {
31 return this.client.get(magnetUri) !== null;
32 }
29} 33}