diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-05 15:17:34 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-13 11:53:42 +0200 |
commit | 64cc5e8575fda47b281ae20abf0020e27fc8ce7c (patch) | |
tree | c3ec40b03d3fdc5d3beee9ff089384c894d9efe9 /client/src/app/core | |
parent | 0e5ff97f6fdf9a4cebe5a15f5a390380465803ad (diff) | |
download | PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.gz PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.tar.zst PeerTube-64cc5e8575fda47b281ae20abf0020e27fc8ce7c.zip |
add webtorrent opt-out settings
- add a key in localstorage to remember the opt-out
- add a user setting
Diffstat (limited to 'client/src/app/core')
-rw-r--r-- | client/src/app/core/auth/auth-user.model.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts index 74ed1c580..97acf7bfe 100644 --- a/client/src/app/core/auth/auth-user.model.ts +++ b/client/src/app/core/auth/auth-user.model.ts | |||
@@ -4,6 +4,7 @@ import { UserRight } from '../../../../../shared/models/users/user-right.enum' | |||
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 | import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' |
7 | import { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type' | ||
7 | 8 | ||
8 | export type TokenOptions = { | 9 | export type TokenOptions = { |
9 | accessToken: string | 10 | accessToken: string |
@@ -72,6 +73,7 @@ export class AuthUser extends User { | |||
72 | EMAIL: 'email', | 73 | EMAIL: 'email', |
73 | USERNAME: 'username', | 74 | USERNAME: 'username', |
74 | NSFW_POLICY: 'nsfw_policy', | 75 | NSFW_POLICY: 'nsfw_policy', |
76 | WEBTORRENT_POLICY: 'peertube-videojs-' + 'webtorrent_policy', | ||
75 | AUTO_PLAY_VIDEO: 'auto_play_video' | 77 | AUTO_PLAY_VIDEO: 'auto_play_video' |
76 | } | 78 | } |
77 | 79 | ||
@@ -87,6 +89,7 @@ export class AuthUser extends User { | |||
87 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), | 89 | email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), |
88 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, | 90 | role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, |
89 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, | 91 | nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, |
92 | webTorrentPolicy: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_POLICY) as WebTorrentPolicyType, | ||
90 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' | 93 | autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' |
91 | }, | 94 | }, |
92 | Tokens.load() | 95 | Tokens.load() |
@@ -101,6 +104,7 @@ export class AuthUser extends User { | |||
101 | peertubeLocalStorage.removeItem(this.KEYS.ID) | 104 | peertubeLocalStorage.removeItem(this.KEYS.ID) |
102 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) | 105 | peertubeLocalStorage.removeItem(this.KEYS.ROLE) |
103 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) | 106 | peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) |
107 | peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_POLICY) | ||
104 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) | 108 | peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) |
105 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) | 109 | peertubeLocalStorage.removeItem(this.KEYS.EMAIL) |
106 | Tokens.flush() | 110 | Tokens.flush() |
@@ -138,6 +142,7 @@ export class AuthUser extends User { | |||
138 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) | 142 | peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) |
139 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) | 143 | peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) |
140 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) | 144 | peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) |
145 | peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_POLICY, this.webTorrentPolicy.toString()) | ||
141 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) | 146 | peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) |
142 | this.tokens.save() | 147 | this.tokens.save() |
143 | } | 148 | } |