aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/app/account/account-settings/account-details/account-details.component.html6
-rw-r--r--client/src/app/account/account-settings/account-details/account-details.component.ts7
-rw-r--r--client/src/app/account/account-settings/account-settings.component.html2
-rw-r--r--client/src/app/core/auth/auth-user.model.ts8
-rw-r--r--client/src/app/core/auth/auth.service.ts4
-rw-r--r--client/src/app/shared/users/user.model.ts6
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts4
7 files changed, 30 insertions, 7 deletions
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 bc18b39b4..593b87e29 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
@@ -9,6 +9,12 @@
9 <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger"> 9 <div *ngIf="formErrors['displayNSFW']" class="alert alert-danger">
10 {{ formErrors['displayNSFW'] }} 10 {{ formErrors['displayNSFW'] }}
11 </div> 11 </div>
12 <br/>
13 <input
14 type="checkbox" id="autoPlayVideo"
15 formControlName="autoPlayVideo"
16 >
17 <label for="autoPlayVideo">Automatically plays video</label>
12 18
13 <input type="submit" value="Save" [disabled]="!form.valid"> 19 <input type="submit" value="Save" [disabled]="!form.valid">
14</form> 20</form>
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 d835c53e5..b8c19d8d6 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
@@ -31,7 +31,8 @@ export class AccountDetailsComponent extends FormReactive implements OnInit {
31 31
32 buildForm () { 32 buildForm () {
33 this.form = this.formBuilder.group({ 33 this.form = this.formBuilder.group({
34 displayNSFW: [ this.user.displayNSFW ] 34 displayNSFW: [ this.user.displayNSFW ],
35 autoPlayVideo: [ this.user.autoPlayVideo ]
35 }) 36 })
36 37
37 this.form.valueChanges.subscribe(data => this.onValueChanged(data)) 38 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
@@ -43,8 +44,10 @@ export class AccountDetailsComponent extends FormReactive implements OnInit {
43 44
44 updateDetails () { 45 updateDetails () {
45 const displayNSFW = this.form.value['displayNSFW'] 46 const displayNSFW = this.form.value['displayNSFW']
47 const autoPlayVideo = this.form.value['autoPlayVideo']
46 const details: UserUpdateMe = { 48 const details: UserUpdateMe = {
47 displayNSFW 49 displayNSFW,
50 autoPlayVideo
48 } 51 }
49 52
50 this.error = null 53 this.error = null
diff --git a/client/src/app/account/account-settings/account-settings.component.html b/client/src/app/account/account-settings/account-settings.component.html
index c0a74cc47..f14eadd49 100644
--- a/client/src/app/account/account-settings/account-settings.component.html
+++ b/client/src/app/account/account-settings/account-settings.component.html
@@ -11,5 +11,5 @@
11<div class="account-title">Account settings</div> 11<div class="account-title">Account settings</div>
12<my-account-change-password></my-account-change-password> 12<my-account-change-password></my-account-change-password>
13 13
14<div class="account-title">Filtering</div> 14<div class="account-title">Videos</div>
15<my-account-details [user]="user"></my-account-details> 15<my-account-details [user]="user"></my-account-details>
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 7b6c8816f..9ad275392 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -69,7 +69,8 @@ export class AuthUser extends User {
69 ROLE: 'role', 69 ROLE: 'role',
70 EMAIL: 'email', 70 EMAIL: 'email',
71 USERNAME: 'username', 71 USERNAME: 'username',
72 DISPLAY_NSFW: 'display_nsfw' 72 DISPLAY_NSFW: 'display_nsfw',
73 AUTO_PLAY_VIDEO: 'auto_play_video'
73 } 74 }
74 75
75 tokens: Tokens 76 tokens: Tokens
@@ -83,7 +84,8 @@ export class AuthUser extends User {
83 username: localStorage.getItem(this.KEYS.USERNAME), 84 username: localStorage.getItem(this.KEYS.USERNAME),
84 email: localStorage.getItem(this.KEYS.EMAIL), 85 email: localStorage.getItem(this.KEYS.EMAIL),
85 role: parseInt(localStorage.getItem(this.KEYS.ROLE), 10) as UserRole, 86 role: parseInt(localStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
86 displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true' 87 displayNSFW: localStorage.getItem(this.KEYS.DISPLAY_NSFW) === 'true',
88 autoPlayVideo: localStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
87 }, 89 },
88 Tokens.load() 90 Tokens.load()
89 ) 91 )
@@ -97,6 +99,7 @@ export class AuthUser extends User {
97 localStorage.removeItem(this.KEYS.ID) 99 localStorage.removeItem(this.KEYS.ID)
98 localStorage.removeItem(this.KEYS.ROLE) 100 localStorage.removeItem(this.KEYS.ROLE)
99 localStorage.removeItem(this.KEYS.DISPLAY_NSFW) 101 localStorage.removeItem(this.KEYS.DISPLAY_NSFW)
102 localStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
100 localStorage.removeItem(this.KEYS.EMAIL) 103 localStorage.removeItem(this.KEYS.EMAIL)
101 Tokens.flush() 104 Tokens.flush()
102 } 105 }
@@ -133,6 +136,7 @@ export class AuthUser extends User {
133 localStorage.setItem(AuthUser.KEYS.EMAIL, this.email) 136 localStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
134 localStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) 137 localStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
135 localStorage.setItem(AuthUser.KEYS.DISPLAY_NSFW, JSON.stringify(this.displayNSFW)) 138 localStorage.setItem(AuthUser.KEYS.DISPLAY_NSFW, JSON.stringify(this.displayNSFW))
139 localStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
136 this.tokens.save() 140 this.tokens.save()
137 } 141 }
138} 142}
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index e2b8b6ba5..37264a8ad 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -33,6 +33,7 @@ interface UserLoginWithUserInformation extends UserLogin {
33 id: number 33 id: number
34 role: UserRole 34 role: UserRole
35 displayNSFW: boolean 35 displayNSFW: boolean
36 autoPlayVideo: boolean
36 email: string 37 email: string
37 videoQuota: number 38 videoQuota: number
38 account: Account 39 account: Account
@@ -191,6 +192,7 @@ export class AuthService {
191 .subscribe( 192 .subscribe(
192 res => { 193 res => {
193 this.user.displayNSFW = res.displayNSFW 194 this.user.displayNSFW = res.displayNSFW
195 this.user.autoPlayVideo = res.autoPlayVideo
194 this.user.role = res.role 196 this.user.role = res.role
195 this.user.videoChannels = res.videoChannels 197 this.user.videoChannels = res.videoChannels
196 this.user.account = res.account 198 this.user.account = res.account
@@ -212,6 +214,7 @@ export class AuthService {
212 id: res.id, 214 id: res.id,
213 role: res.role, 215 role: res.role,
214 displayNSFW: res.displayNSFW, 216 displayNSFW: res.displayNSFW,
217 autoPlayVideo: res.autoPlayVideo,
215 email: res.email, 218 email: res.email,
216 videoQuota: res.videoQuota, 219 videoQuota: res.videoQuota,
217 account: res.account, 220 account: res.account,
@@ -230,6 +233,7 @@ export class AuthService {
230 role: obj.role, 233 role: obj.role,
231 email: obj.email, 234 email: obj.email,
232 displayNSFW: obj.displayNSFW, 235 displayNSFW: obj.displayNSFW,
236 autoPlayVideo: obj.autoPlayVideo,
233 videoQuota: obj.videoQuota, 237 videoQuota: obj.videoQuota,
234 videoChannels: obj.videoChannels, 238 videoChannels: obj.videoChannels,
235 account: obj.account 239 account: obj.account
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index b4d13f37c..7a962ae3e 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -8,6 +8,7 @@ export type UserConstructorHash = {
8 role: UserRole, 8 role: UserRole,
9 videoQuota?: number, 9 videoQuota?: number,
10 displayNSFW?: boolean, 10 displayNSFW?: boolean,
11 autoPlayVideo?: boolean,
11 createdAt?: Date, 12 createdAt?: Date,
12 account?: Account, 13 account?: Account,
13 videoChannels?: VideoChannel[] 14 videoChannels?: VideoChannel[]
@@ -18,6 +19,7 @@ export class User implements UserServerModel {
18 email: string 19 email: string
19 role: UserRole 20 role: UserRole
20 displayNSFW: boolean 21 displayNSFW: boolean
22 autoPlayVideo: boolean
21 videoQuota: number 23 videoQuota: number
22 account: Account 24 account: Account
23 videoChannels: VideoChannel[] 25 videoChannels: VideoChannel[]
@@ -42,6 +44,10 @@ export class User implements UserServerModel {
42 this.displayNSFW = hash.displayNSFW 44 this.displayNSFW = hash.displayNSFW
43 } 45 }
44 46
47 if (hash.autoPlayVideo !== undefined) {
48 this.autoPlayVideo = hash.autoPlayVideo
49 }
50
45 if (hash.createdAt !== undefined) { 51 if (hash.createdAt !== undefined) {
46 this.createdAt = hash.createdAt 52 this.createdAt = hash.createdAt
47 } 53 }
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 5e4823c9c..e35b02f3f 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -290,12 +290,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
290 290
291 const videojsOptions = { 291 const videojsOptions = {
292 controls: true, 292 controls: true,
293 autoplay: true, 293 autoplay: this.user.autoPlayVideo,
294 plugins: { 294 plugins: {
295 peertube: { 295 peertube: {
296 videoFiles: this.video.files, 296 videoFiles: this.video.files,
297 playerElement: this.playerElement, 297 playerElement: this.playerElement,
298 autoplay: true, 298 autoplay: this.user.autoPlayVideo,
299 peerTubeLink: false 299 peerTubeLink: false
300 } 300 }
301 } 301 }