diff options
author | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-04-19 11:01:34 +0200 |
commit | 0883b3245bf0deb9106c4041e9afbd3521b79280 (patch) | |
tree | fcb73005e0b31a3b763ee5d22d5fc39c2da89907 /client/src/app/core | |
parent | 04ed10b21e8e1339514faae0bb690e4d97c23b0a (diff) | |
download | PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.gz PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.tar.zst PeerTube-0883b3245bf0deb9106c4041e9afbd3521b79280.zip |
Add ability to choose what policy we have for NSFW videos
There is a global instance setting and a per user setting
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 9 | ||||
-rw-r--r-- | client/src/app/core/server/server.service.ts | 2 |
2 files changed, 6 insertions, 5 deletions
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: '' |