diff options
Diffstat (limited to 'client')
12 files changed, 73 insertions, 26 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 714a3af15..df40bba9f 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | |||
@@ -62,6 +62,22 @@ | |||
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | 64 | ||
65 | <div class="form-group"> | ||
66 | <label for="instanceDefaultNSFWPolicy">Policy on videos containing sensitive content</label> | ||
67 | <my-help helpType="custom" customHtml="With <strong>Do not list</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video."></my-help> | ||
68 | |||
69 | <div class="peertube-select-container"> | ||
70 | <select id="instanceDefaultNSFWPolicy" formControlName="instanceDefaultNSFWPolicy"> | ||
71 | <option value="do_not_list">Do not list</option> | ||
72 | <option value="blur">Blur thumbnails</option> | ||
73 | <option value="display">Display</option> | ||
74 | </select> | ||
75 | </div> | ||
76 | <div *ngIf="formErrors.instanceDefaultNSFWPolicy" class="form-error"> | ||
77 | {{ formErrors.instanceDefaultNSFWPolicy }} | ||
78 | </div> | ||
79 | </div> | ||
80 | |||
65 | <div class="inner-form-title">Cache</div> | 81 | <div class="inner-form-title">Cache</div> |
66 | 82 | ||
67 | <div class="form-group"> | 83 | <div class="form-group"> |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index d73ee71e4..2ab371cbb 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -48,6 +48,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
48 | instanceDescription: '', | 48 | instanceDescription: '', |
49 | instanceTerms: '', | 49 | instanceTerms: '', |
50 | instanceDefaultClientRoute: '', | 50 | instanceDefaultClientRoute: '', |
51 | instanceDefaultNSFWPolicy: '', | ||
51 | cachePreviewsSize: '', | 52 | cachePreviewsSize: '', |
52 | signupLimit: '', | 53 | signupLimit: '', |
53 | adminEmail: '', | 54 | adminEmail: '', |
@@ -90,6 +91,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
90 | instanceDescription: [ '' ], | 91 | instanceDescription: [ '' ], |
91 | instanceTerms: [ '' ], | 92 | instanceTerms: [ '' ], |
92 | instanceDefaultClientRoute: [ '' ], | 93 | instanceDefaultClientRoute: [ '' ], |
94 | instanceDefaultNSFWPolicy: [ '' ], | ||
93 | cachePreviewsSize: [ '', CACHE_PREVIEWS_SIZE.VALIDATORS ], | 95 | cachePreviewsSize: [ '', CACHE_PREVIEWS_SIZE.VALIDATORS ], |
94 | signupEnabled: [ ], | 96 | signupEnabled: [ ], |
95 | signupLimit: [ '', SIGNUP_LIMIT.VALIDATORS ], | 97 | signupLimit: [ '', SIGNUP_LIMIT.VALIDATORS ], |
@@ -167,6 +169,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
167 | description: this.form.value['instanceDescription'], | 169 | description: this.form.value['instanceDescription'], |
168 | terms: this.form.value['instanceTerms'], | 170 | terms: this.form.value['instanceTerms'], |
169 | defaultClientRoute: this.form.value['instanceDefaultClientRoute'], | 171 | defaultClientRoute: this.form.value['instanceDefaultClientRoute'], |
172 | defaultNSFWPolicy: this.form.value['instanceDefaultNSFWPolicy'], | ||
170 | customizations: { | 173 | customizations: { |
171 | javascript: this.form.value['customizationJavascript'], | 174 | javascript: this.form.value['customizationJavascript'], |
172 | css: this.form.value['customizationCSS'] | 175 | css: this.form.value['customizationCSS'] |
@@ -224,6 +227,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
224 | instanceDescription: this.customConfig.instance.description, | 227 | instanceDescription: this.customConfig.instance.description, |
225 | instanceTerms: this.customConfig.instance.terms, | 228 | instanceTerms: this.customConfig.instance.terms, |
226 | instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute, | 229 | instanceDefaultClientRoute: this.customConfig.instance.defaultClientRoute, |
230 | instanceDefaultNSFWPolicy: this.customConfig.instance.defaultNSFWPolicy, | ||
227 | cachePreviewsSize: this.customConfig.cache.previews.size, | 231 | cachePreviewsSize: this.customConfig.cache.previews.size, |
228 | signupEnabled: this.customConfig.signup.enabled, | 232 | signupEnabled: this.customConfig.signup.enabled, |
229 | signupLimit: this.customConfig.signup.limit, | 233 | signupLimit: this.customConfig.signup.limit, |
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.html b/client/src/app/account/account-settings/account-details/account-details.component.html index 8f1475a4d..9dcc66a75 100644 --- a/client/src/app/account/account-settings/account-details/account-details.component.html +++ b/client/src/app/account/account-settings/account-details/account-details.component.html | |||
@@ -1,11 +1,18 @@ | |||
1 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> | 1 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> |
2 | <div class="form-group"> | 2 | <div class="form-group"> |
3 | <input | 3 | <label for="nsfwPolicy">Default policy on videos containing sensitive content</label> |
4 | type="checkbox" id="displayNSFW" | 4 | <my-help helpType="custom" customHtml="With <strong>Do not list</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video."></my-help> |
5 | formControlName="displayNSFW" | 5 | |
6 | > | 6 | <div class="peertube-select-container"> |
7 | <label for="displayNSFW"></label> | 7 | <select id="nsfwPolicy" formControlName="nsfwPolicy"> |
8 | <label for="displayNSFW">Display videos that contain mature or explicit content</label> | 8 | <option value="do_not_list">Do not list</option> |
9 | <option value="blur">Blur thumbnails</option> | ||
10 | <option value="display">Display</option> | ||
11 | </select> | ||
12 | </div> | ||
13 | <div *ngIf="formErrors.nsfwPolicy" class="form-error"> | ||
14 | {{ formErrors.nsfwPolicy }} | ||
15 | </div> | ||
9 | </div> | 16 | </div> |
10 | 17 | ||
11 | <div class="form-group"> | 18 | <div class="form-group"> |
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.scss b/client/src/app/account/account-settings/account-details/account-details.component.scss index 4e8dfde1d..ed59e4689 100644 --- a/client/src/app/account/account-settings/account-details/account-details.component.scss +++ b/client/src/app/account/account-settings/account-details/account-details.component.scss | |||
@@ -12,3 +12,9 @@ input[type=submit] { | |||
12 | display: block; | 12 | display: block; |
13 | margin-top: 15px; | 13 | margin-top: 15px; |
14 | } | 14 | } |
15 | |||
16 | .peertube-select-container { | ||
17 | @include peertube-select-container(340px); | ||
18 | |||
19 | margin-bottom: 30px; | ||
20 | } \ No newline at end of file | ||
diff --git a/client/src/app/account/account-settings/account-details/account-details.component.ts b/client/src/app/account/account-settings/account-details/account-details.component.ts index 917f31651..de213717e 100644 --- a/client/src/app/account/account-settings/account-details/account-details.component.ts +++ b/client/src/app/account/account-settings/account-details/account-details.component.ts | |||
@@ -29,7 +29,7 @@ export class AccountDetailsComponent extends FormReactive implements OnInit { | |||
29 | 29 | ||
30 | buildForm () { | 30 | buildForm () { |
31 | this.form = this.formBuilder.group({ | 31 | this.form = this.formBuilder.group({ |
32 | displayNSFW: [ this.user.displayNSFW ], | 32 | nsfwPolicy: [ this.user.nsfwPolicy ], |
33 | autoPlayVideo: [ this.user.autoPlayVideo ] | 33 | autoPlayVideo: [ this.user.autoPlayVideo ] |
34 | }) | 34 | }) |
35 | 35 | ||
@@ -41,10 +41,10 @@ export class AccountDetailsComponent extends FormReactive implements OnInit { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | updateDetails () { | 43 | updateDetails () { |
44 | const displayNSFW = this.form.value['displayNSFW'] | 44 | const nsfwPolicy = this.form.value['nsfwPolicy'] |
45 | const autoPlayVideo = this.form.value['autoPlayVideo'] | 45 | const autoPlayVideo = this.form.value['autoPlayVideo'] |
46 | const details: UserUpdateMe = { | 46 | const details: UserUpdateMe = { |
47 | displayNSFW, | 47 | nsfwPolicy, |
48 | autoPlayVideo | 48 | autoPlayVideo |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 366eea110..60fe57899 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -3,6 +3,7 @@ import { UserRight } from '../../../../../shared/models/users/user-right.enum' | |||
3 | // Do not use the barrel (dependency loop) | 3 | // Do not use the barrel (dependency loop) |
4 | import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' | 4 | import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' |
5 | import { User, UserConstructorHash } from '../../shared/users/user.model' | 5 | import { User, UserConstructorHash } from '../../shared/users/user.model' |
6 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | ||
6 | 7 | ||
7 | export type TokenOptions = { | 8 | export type TokenOptions = { |
8 | accessToken: string | 9 | accessToken: string |
@@ -70,7 +71,7 @@ export class AuthUser extends User { | |||
70 | ROLE: 'role', | 71 | ROLE: 'role', |
71 | EMAIL: 'email', | 72 | EMAIL: 'email', |
72 | USERNAME: 'username', | 73 | USERNAME: 'username', |
73 | DISPLAY_NSFW: 'display_nsfw', | 74 | DEFAULT_NSFW_POLICY: 'nsfw_policy', |
74 | AUTO_PLAY_VIDEO: 'auto_play_video' | 75 | AUTO_PLAY_VIDEO: 'auto_play_video' |
75 | } | 76 | } |
76 | 77 | ||
@@ -85,7 +86,7 @@ export class AuthUser extends User { | |||
85 | username: peertubeLocalStorage.getItem(this.KEYS.USERNAME), | 86 | username: peertubeLocalStorage.getItem(this.KEYS.USERNAME), |
86 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), | 87 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), |
87 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, | 88 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, |
88 | displayNSFW: peertubeLocalStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true', | 89 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.DEFAULT_NSFW_POLICY) as NSFWPolicyType, |
89 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' | 90 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' |
90 | }, | 91 | }, |
91 | Tokens.load() | 92 | Tokens.load() |
@@ -99,7 +100,7 @@ export class AuthUser extends User { | |||
99 | peertubeLocalStorage.removeItem(this.KEYS.USERNAME) | 100 | peertubeLocalStorage.removeItem(this.KEYS.USERNAME) |
100 | peertubeLocalStorage.removeItem(this.KEYS.ID) | 101 | peertubeLocalStorage.removeItem(this.KEYS.ID) |
101 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) | 102 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) |
102 | peertubeLocalStorage.removeItem(this.KEYS.DISPLAY_NSFW) | 103 | peertubeLocalStorage.removeItem(this.KEYS.DEFAULT_NSFW_POLICY) |
103 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) | 104 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) |
104 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) | 105 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) |
105 | Tokens.flush() | 106 | Tokens.flush() |
@@ -136,7 +137,7 @@ export class AuthUser extends User { | |||
136 | peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username) | 137 | peertubeLocalStorage.setItem(AuthUser.KEYS.USERNAME, this.username) |
137 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) | 138 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) |
138 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) | 139 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) |
139 | peertubeLocalStorage.setItem(AuthUser.KEYS.DISPLAY_NSFW, JSON.stringify(this.displayNSFW)) | 140 | peertubeLocalStorage.setItem(AuthUser.KEYS.DEFAULT_NSFW_POLICY, this.nsfwPolicy.toString()) |
140 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) | 141 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) |
141 | this.tokens.save() | 142 | this.tokens.save() |
142 | } | 143 | } |
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts index 987d64d2a..a8beb242d 100644 --- a/client/src/app/core/server/server.service.ts +++ b/client/src/app/core/server/server.service.ts | |||
@@ -5,7 +5,6 @@ import 'rxjs/add/operator/do' | |||
5 | import { ReplaySubject } from 'rxjs/ReplaySubject' | 5 | import { ReplaySubject } from 'rxjs/ReplaySubject' |
6 | import { ServerConfig } from '../../../../../shared' | 6 | import { ServerConfig } from '../../../../../shared' |
7 | import { About } from '../../../../../shared/models/server/about.model' | 7 | import { About } from '../../../../../shared/models/server/about.model' |
8 | import { ServerStats } from '../../../../../shared/models/server/server-stats.model' | ||
9 | import { environment } from '../../../environments/environment' | 8 | import { environment } from '../../../environments/environment' |
10 | 9 | ||
11 | @Injectable() | 10 | @Injectable() |
@@ -26,6 +25,7 @@ export class ServerService { | |||
26 | shortDescription: 'PeerTube, a federated (ActivityPub) video streaming platform ' + | 25 | shortDescription: 'PeerTube, a federated (ActivityPub) video streaming platform ' + |
27 | 'using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.', | 26 | 'using P2P (BitTorrent) directly in the web browser with WebTorrent and Angular.', |
28 | defaultClientRoute: '', | 27 | defaultClientRoute: '', |
28 | defaultNSFWPolicy: 'do_not_list' as 'do_not_list', | ||
29 | customizations: { | 29 | customizations: { |
30 | javascript: '', | 30 | javascript: '', |
31 | css: '' | 31 | css: '' |
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 4a94b032d..2bdc48a1d 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' | 1 | import { hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared' |
2 | import { Account } from '../account/account.model' | 2 | import { Account } from '../account/account.model' |
3 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' | ||
3 | 4 | ||
4 | export type UserConstructorHash = { | 5 | export type UserConstructorHash = { |
5 | id: number, | 6 | id: number, |
@@ -7,7 +8,7 @@ export type UserConstructorHash = { | |||
7 | email: string, | 8 | email: string, |
8 | role: UserRole, | 9 | role: UserRole, |
9 | videoQuota?: number, | 10 | videoQuota?: number, |
10 | displayNSFW?: boolean, | 11 | nsfwPolicy?: NSFWPolicyType, |
11 | autoPlayVideo?: boolean, | 12 | autoPlayVideo?: boolean, |
12 | createdAt?: Date, | 13 | createdAt?: Date, |
13 | account?: Account, | 14 | account?: Account, |
@@ -18,7 +19,7 @@ export class User implements UserServerModel { | |||
18 | username: string | 19 | username: string |
19 | email: string | 20 | email: string |
20 | role: UserRole | 21 | role: UserRole |
21 | displayNSFW: boolean | 22 | nsfwPolicy: NSFWPolicyType |
22 | autoPlayVideo: boolean | 23 | autoPlayVideo: boolean |
23 | videoQuota: number | 24 | videoQuota: number |
24 | account: Account | 25 | account: Account |
@@ -40,8 +41,8 @@ export class User implements UserServerModel { | |||
40 | this.videoQuota = hash.videoQuota | 41 | this.videoQuota = hash.videoQuota |
41 | } | 42 | } |
42 | 43 | ||
43 | if (hash.displayNSFW !== undefined) { | 44 | if (hash.nsfwPolicy !== undefined) { |
44 | this.displayNSFW = hash.displayNSFW | 45 | this.nsfwPolicy = hash.nsfwPolicy |
45 | } | 46 | } |
46 | 47 | ||
47 | if (hash.autoPlayVideo !== undefined) { | 48 | if (hash.autoPlayVideo !== undefined) { |
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html index f28e9b8d9..233432142 100644 --- a/client/src/app/shared/video/video-miniature.component.html +++ b/client/src/app/shared/video/video-miniature.component.html | |||
@@ -1,11 +1,11 @@ | |||
1 | <div class="video-miniature"> | 1 | <div class="video-miniature"> |
2 | <my-video-thumbnail [video]="video" [nsfw]="isVideoNSFWForThisUser()"></my-video-thumbnail> | 2 | <my-video-thumbnail [video]="video" [nsfw]="isVideoBlur()"></my-video-thumbnail> |
3 | 3 | ||
4 | <div class="video-miniature-information"> | 4 | <div class="video-miniature-information"> |
5 | <span class="video-miniature-name"> | 5 | <span class="video-miniature-name"> |
6 | <a | 6 | <a |
7 | class="video-miniature-name" | 7 | class="video-miniature-name" |
8 | [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoNSFWForThisUser() }" | 8 | [routerLink]="['/videos/watch', video.uuid]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" |
9 | > | 9 | > |
10 | {{ video.name }} | 10 | {{ video.name }} |
11 | </a> | 11 | </a> |
diff --git a/client/src/app/shared/video/video-miniature.component.ts b/client/src/app/shared/video/video-miniature.component.ts index 4d79a74bb..d3f6dc1f6 100644 --- a/client/src/app/shared/video/video-miniature.component.ts +++ b/client/src/app/shared/video/video-miniature.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { User } from '../users' | 2 | import { User } from '../users' |
3 | import { Video } from './video.model' | 3 | import { Video } from './video.model' |
4 | import { ServerService } from '@app/core' | ||
4 | 5 | ||
5 | @Component({ | 6 | @Component({ |
6 | selector: 'my-video-miniature', | 7 | selector: 'my-video-miniature', |
@@ -11,7 +12,9 @@ export class VideoMiniatureComponent { | |||
11 | @Input() user: User | 12 | @Input() user: User |
12 | @Input() video: Video | 13 | @Input() video: Video |
13 | 14 | ||
14 | isVideoNSFWForThisUser () { | 15 | constructor (private serverService: ServerService) { } |
15 | return this.video.isVideoNSFWForUser(this.user) | 16 | |
17 | isVideoBlur () { | ||
18 | return this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig()) | ||
16 | } | 19 | } |
17 | } | 20 | } |
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index 0c02cbcb9..adc248a1e 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts | |||
@@ -4,6 +4,7 @@ import { Video as VideoServerModel } from '../../../../../shared' | |||
4 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' | 4 | import { Avatar } from '../../../../../shared/models/avatars/avatar.model' |
5 | import { VideoConstant } from '../../../../../shared/models/videos/video.model' | 5 | import { VideoConstant } from '../../../../../shared/models/videos/video.model' |
6 | import { getAbsoluteAPIUrl } from '../misc/utils' | 6 | import { getAbsoluteAPIUrl } from '../misc/utils' |
7 | import { ServerConfig } from '../../../../../shared/models' | ||
7 | 8 | ||
8 | export class Video implements VideoServerModel { | 9 | export class Video implements VideoServerModel { |
9 | by: string | 10 | by: string |
@@ -83,8 +84,14 @@ export class Video implements VideoServerModel { | |||
83 | this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host) | 84 | this.by = Account.CREATE_BY_STRING(hash.account.name, hash.account.host) |
84 | } | 85 | } |
85 | 86 | ||
86 | isVideoNSFWForUser (user: User) { | 87 | isVideoNSFWForUser (user: User, serverConfig: ServerConfig) { |
87 | // If the video is NSFW and the user is not logged in, or the user does not want to display NSFW videos... | 88 | // Video is not NSFW, skip |
88 | return (this.nsfw && (!user || user.displayNSFW === false)) | 89 | if (this.nsfw === false) return false |
90 | |||
91 | // Return user setting if logged in | ||
92 | if (user) return user.nsfwPolicy !== 'display' | ||
93 | |||
94 | // Return default instance config | ||
95 | return serverConfig.instance.defaultNSFWPolicy !== 'display' | ||
89 | } | 96 | } |
90 | } | 97 | } |
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 182703cdf..6f6f02378 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -22,6 +22,7 @@ import { VideoDownloadComponent } from './modal/video-download.component' | |||
22 | import { VideoReportComponent } from './modal/video-report.component' | 22 | import { VideoReportComponent } from './modal/video-report.component' |
23 | import { VideoShareComponent } from './modal/video-share.component' | 23 | import { VideoShareComponent } from './modal/video-share.component' |
24 | import { getVideojsOptions } from '../../../assets/player/peertube-player' | 24 | import { getVideojsOptions } from '../../../assets/player/peertube-player' |
25 | import { ServerService } from '@app/core' | ||
25 | 26 | ||
26 | @Component({ | 27 | @Component({ |
27 | selector: 'my-video-watch', | 28 | selector: 'my-video-watch', |
@@ -66,6 +67,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
66 | private confirmService: ConfirmService, | 67 | private confirmService: ConfirmService, |
67 | private metaService: MetaService, | 68 | private metaService: MetaService, |
68 | private authService: AuthService, | 69 | private authService: AuthService, |
70 | private serverService: ServerService, | ||
69 | private notificationsService: NotificationsService, | 71 | private notificationsService: NotificationsService, |
70 | private markdownService: MarkdownService, | 72 | private markdownService: MarkdownService, |
71 | private zone: NgZone, | 73 | private zone: NgZone, |
@@ -335,7 +337,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
335 | 337 | ||
336 | this.updateOtherVideosDisplayed() | 338 | this.updateOtherVideosDisplayed() |
337 | 339 | ||
338 | if (this.video.isVideoNSFWForUser(this.user)) { | 340 | if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) { |
339 | const res = await this.confirmService.confirm( | 341 | const res = await this.confirmService.confirm( |
340 | 'This video contains mature or explicit content. Are you sure you want to watch it?', | 342 | 'This video contains mature or explicit content. Are you sure you want to watch it?', |
341 | 'Mature or explicit content' | 343 | 'Mature or explicit content' |