aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html12
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts8
-rw-r--r--client/src/app/core/auth/auth-user.model.ts9
-rw-r--r--client/src/app/shared/users/user.model.ts7
4 files changed, 19 insertions, 17 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
index adbb97f00..50f798c79 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html
@@ -16,18 +16,22 @@
16 </div> 16 </div>
17 17
18 <div class="form-group"> 18 <div class="form-group">
19 <label i18n for="webTorrentPolicy">Policy regarding P2P technologies</label> 19 <label i18n for="webTorrentEnabled">Policy regarding P2P technologies</label>
20 20
21 <div class="peertube-select-container"> 21 <div class="peertube-select-container">
22 <select id="webTorrentPolicy" formControlName="webTorrentPolicy"> 22 <select id="webTorrentEnabled" formControlName="webTorrentEnabled">
23 <option i18n value="enable">Enable WebTorrent</option> 23 <option i18n value="enable">Enable WebTorrent</option>
24 <option i18n value="disable">Disable WebTorrent globally</option> 24 <option i18n value="disable">Disable WebTorrent</option>
25 <option i18n value="disable_on_mobile" disabled>Disable WebTorrent on mobile devices (not yet available)</option>
26 </select> 25 </select>
27 </div> 26 </div>
28 </div> 27 </div>
29 28
30 <my-peertube-checkbox 29 <my-peertube-checkbox
30 inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
31 i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
32 ></my-peertube-checkbox>
33
34 <my-peertube-checkbox
31 inputName="autoPlayVideo" formControlName="autoPlayVideo" 35 inputName="autoPlayVideo" formControlName="autoPlayVideo"
32 i18n-labelText labelText="Automatically plays video" 36 i18n-labelText labelText="Automatically plays video"
33 ></my-peertube-checkbox> 37 ></my-peertube-checkbox>
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
index 9e711a227..6c9a7ce75 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
+++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts
@@ -29,14 +29,14 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
29 ngOnInit () { 29 ngOnInit () {
30 this.buildForm({ 30 this.buildForm({
31 nsfwPolicy: null, 31 nsfwPolicy: null,
32 webTorrentPolicy: null, 32 webTorrentEnabled: null,
33 autoPlayVideo: null 33 autoPlayVideo: null
34 }) 34 })
35 35
36 this.userInformationLoaded.subscribe(() => { 36 this.userInformationLoaded.subscribe(() => {
37 this.form.patchValue({ 37 this.form.patchValue({
38 nsfwPolicy: this.user.nsfwPolicy, 38 nsfwPolicy: this.user.nsfwPolicy,
39 webTorrentPolicy: this.user.webTorrentPolicy, 39 webTorrentEnabled: this.user.webTorrentEnabled,
40 autoPlayVideo: this.user.autoPlayVideo === true 40 autoPlayVideo: this.user.autoPlayVideo === true
41 }) 41 })
42 }) 42 })
@@ -44,11 +44,11 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
44 44
45 updateDetails () { 45 updateDetails () {
46 const nsfwPolicy = this.form.value['nsfwPolicy'] 46 const nsfwPolicy = this.form.value['nsfwPolicy']
47 const webTorrentPolicy = this.form.value['webTorrentPolicy'] 47 const webTorrentEnabled = this.form.value['webTorrentEnabled']
48 const autoPlayVideo = this.form.value['autoPlayVideo'] 48 const autoPlayVideo = this.form.value['autoPlayVideo']
49 const details: UserUpdateMe = { 49 const details: UserUpdateMe = {
50 nsfwPolicy, 50 nsfwPolicy,
51 webTorrentPolicy, 51 webTorrentEnabled,
52 autoPlayVideo 52 autoPlayVideo
53 } 53 }
54 54
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 97acf7bfe..acd13d9c5 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -4,7 +4,6 @@ import { UserRight } from '../../../../../shared/models/users/user-right.enum'
4import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' 4import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role'
5import { User, UserConstructorHash } from '../../shared/users/user.model' 5import { User, UserConstructorHash } from '../../shared/users/user.model'
6import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 6import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
7import { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type'
8 7
9export type TokenOptions = { 8export type TokenOptions = {
10 accessToken: string 9 accessToken: string
@@ -73,7 +72,7 @@ export class AuthUser extends User {
73 EMAIL: 'email', 72 EMAIL: 'email',
74 USERNAME: 'username', 73 USERNAME: 'username',
75 NSFW_POLICY: 'nsfw_policy', 74 NSFW_POLICY: 'nsfw_policy',
76 WEBTORRENT_POLICY: 'peertube-videojs-' + 'webtorrent_policy', 75 WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled',
77 AUTO_PLAY_VIDEO: 'auto_play_video' 76 AUTO_PLAY_VIDEO: 'auto_play_video'
78 } 77 }
79 78
@@ -89,7 +88,7 @@ export class AuthUser extends User {
89 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), 88 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
90 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, 89 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
91 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, 90 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
92 webTorrentPolicy: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_POLICY) as WebTorrentPolicyType, 91 webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true',
93 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' 92 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
94 }, 93 },
95 Tokens.load() 94 Tokens.load()
@@ -104,7 +103,7 @@ export class AuthUser extends User {
104 peertubeLocalStorage.removeItem(this.KEYS.ID) 103 peertubeLocalStorage.removeItem(this.KEYS.ID)
105 peertubeLocalStorage.removeItem(this.KEYS.ROLE) 104 peertubeLocalStorage.removeItem(this.KEYS.ROLE)
106 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) 105 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
107 peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_POLICY) 106 peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED)
108 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) 107 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
109 peertubeLocalStorage.removeItem(this.KEYS.EMAIL) 108 peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
110 Tokens.flush() 109 Tokens.flush()
@@ -142,7 +141,7 @@ export class AuthUser extends User {
142 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) 141 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
143 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) 142 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
144 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) 143 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString())
145 peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_POLICY, this.webTorrentPolicy.toString()) 144 peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled))
146 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) 145 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
147 this.tokens.save() 146 this.tokens.save()
148 } 147 }
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 240c7aacf..7c840ffa7 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -9,7 +9,6 @@ import {
9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 9import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
10import { Account } from '@app/shared/account/account.model' 10import { Account } from '@app/shared/account/account.model'
11import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 11import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
12import { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type'
13 12
14export type UserConstructorHash = { 13export type UserConstructorHash = {
15 id: number, 14 id: number,
@@ -19,7 +18,7 @@ export type UserConstructorHash = {
19 videoQuota?: number, 18 videoQuota?: number,
20 videoQuotaDaily?: number, 19 videoQuotaDaily?: number,
21 nsfwPolicy?: NSFWPolicyType, 20 nsfwPolicy?: NSFWPolicyType,
22 webTorrentPolicy?: WebTorrentPolicyType, 21 webTorrentEnabled?: boolean,
23 autoPlayVideo?: boolean, 22 autoPlayVideo?: boolean,
24 createdAt?: Date, 23 createdAt?: Date,
25 account?: AccountServerModel, 24 account?: AccountServerModel,
@@ -34,7 +33,7 @@ export class User implements UserServerModel {
34 email: string 33 email: string
35 role: UserRole 34 role: UserRole
36 nsfwPolicy: NSFWPolicyType 35 nsfwPolicy: NSFWPolicyType
37 webTorrentPolicy: WebTorrentPolicyType 36 webTorrentEnabled: boolean
38 autoPlayVideo: boolean 37 autoPlayVideo: boolean
39 videoQuota: number 38 videoQuota: number
40 videoQuotaDaily: number 39 videoQuotaDaily: number
@@ -55,7 +54,7 @@ export class User implements UserServerModel {
55 this.videoQuota = hash.videoQuota 54 this.videoQuota = hash.videoQuota
56 this.videoQuotaDaily = hash.videoQuotaDaily 55 this.videoQuotaDaily = hash.videoQuotaDaily
57 this.nsfwPolicy = hash.nsfwPolicy 56 this.nsfwPolicy = hash.nsfwPolicy
58 this.webTorrentPolicy = hash.webTorrentPolicy 57 this.webTorrentEnabled = hash.webTorrentEnabled
59 this.autoPlayVideo = hash.autoPlayVideo 58 this.autoPlayVideo = hash.autoPlayVideo
60 this.createdAt = hash.createdAt 59 this.createdAt = hash.createdAt
61 this.blocked = hash.blocked 60 this.blocked = hash.blocked