aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html5
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts4
-rw-r--r--client/src/app/core/auth/auth-user.model.ts4
-rw-r--r--client/src/app/shared/users/user.model.ts3
-rw-r--r--client/src/assets/player/peertube-player-local-storage.ts8
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts48
-rw-r--r--server/controllers/api/users/me.ts1
-rw-r--r--server/helpers/custom-validators/users.ts5
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0280-webtorrent-policy-user.ts28
-rw-r--r--server/models/account/user.ts9
-rw-r--r--shared/models/users/user-update-me.model.ts3
12 files changed, 101 insertions, 19 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 96629940f..8be8a66cc 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,6 +16,11 @@
16 </div> 16 </div>
17 17
18 <my-peertube-checkbox 18 <my-peertube-checkbox
19 inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
20 i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
21 ></my-peertube-checkbox>
22
23 <my-peertube-checkbox
19 inputName="autoPlayVideo" formControlName="autoPlayVideo" 24 inputName="autoPlayVideo" formControlName="autoPlayVideo"
20 i18n-labelText labelText="Automatically plays video" 25 i18n-labelText labelText="Automatically plays video"
21 ></my-peertube-checkbox> 26 ></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 7089b2057..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,12 +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 webTorrentEnabled: null,
32 autoPlayVideo: null 33 autoPlayVideo: null
33 }) 34 })
34 35
35 this.userInformationLoaded.subscribe(() => { 36 this.userInformationLoaded.subscribe(() => {
36 this.form.patchValue({ 37 this.form.patchValue({
37 nsfwPolicy: this.user.nsfwPolicy, 38 nsfwPolicy: this.user.nsfwPolicy,
39 webTorrentEnabled: this.user.webTorrentEnabled,
38 autoPlayVideo: this.user.autoPlayVideo === true 40 autoPlayVideo: this.user.autoPlayVideo === true
39 }) 41 })
40 }) 42 })
@@ -42,9 +44,11 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
42 44
43 updateDetails () { 45 updateDetails () {
44 const nsfwPolicy = this.form.value['nsfwPolicy'] 46 const nsfwPolicy = this.form.value['nsfwPolicy']
47 const webTorrentEnabled = this.form.value['webTorrentEnabled']
45 const autoPlayVideo = this.form.value['autoPlayVideo'] 48 const autoPlayVideo = this.form.value['autoPlayVideo']
46 const details: UserUpdateMe = { 49 const details: UserUpdateMe = {
47 nsfwPolicy, 50 nsfwPolicy,
51 webTorrentEnabled,
48 autoPlayVideo 52 autoPlayVideo
49 } 53 }
50 54
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 74ed1c580..acd13d9c5 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -72,6 +72,7 @@ export class AuthUser extends User {
72 EMAIL: 'email', 72 EMAIL: 'email',
73 USERNAME: 'username', 73 USERNAME: 'username',
74 NSFW_POLICY: 'nsfw_policy', 74 NSFW_POLICY: 'nsfw_policy',
75 WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled',
75 AUTO_PLAY_VIDEO: 'auto_play_video' 76 AUTO_PLAY_VIDEO: 'auto_play_video'
76 } 77 }
77 78
@@ -87,6 +88,7 @@ export class AuthUser extends User {
87 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), 88 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
88 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, 89 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
89 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, 90 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
91 webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true',
90 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' 92 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
91 }, 93 },
92 Tokens.load() 94 Tokens.load()
@@ -101,6 +103,7 @@ export class AuthUser extends User {
101 peertubeLocalStorage.removeItem(this.KEYS.ID) 103 peertubeLocalStorage.removeItem(this.KEYS.ID)
102 peertubeLocalStorage.removeItem(this.KEYS.ROLE) 104 peertubeLocalStorage.removeItem(this.KEYS.ROLE)
103 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) 105 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
106 peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED)
104 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) 107 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
105 peertubeLocalStorage.removeItem(this.KEYS.EMAIL) 108 peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
106 Tokens.flush() 109 Tokens.flush()
@@ -138,6 +141,7 @@ export class AuthUser extends User {
138 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) 141 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
139 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) 142 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
140 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) 143 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString())
144 peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled))
141 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) 145 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
142 this.tokens.save() 146 this.tokens.save()
143 } 147 }
diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts
index 877f1bf3a..7c840ffa7 100644
--- a/client/src/app/shared/users/user.model.ts
+++ b/client/src/app/shared/users/user.model.ts
@@ -18,6 +18,7 @@ export type UserConstructorHash = {
18 videoQuota?: number, 18 videoQuota?: number,
19 videoQuotaDaily?: number, 19 videoQuotaDaily?: number,
20 nsfwPolicy?: NSFWPolicyType, 20 nsfwPolicy?: NSFWPolicyType,
21 webTorrentEnabled?: boolean,
21 autoPlayVideo?: boolean, 22 autoPlayVideo?: boolean,
22 createdAt?: Date, 23 createdAt?: Date,
23 account?: AccountServerModel, 24 account?: AccountServerModel,
@@ -32,6 +33,7 @@ export class User implements UserServerModel {
32 email: string 33 email: string
33 role: UserRole 34 role: UserRole
34 nsfwPolicy: NSFWPolicyType 35 nsfwPolicy: NSFWPolicyType
36 webTorrentEnabled: boolean
35 autoPlayVideo: boolean 37 autoPlayVideo: boolean
36 videoQuota: number 38 videoQuota: number
37 videoQuotaDaily: number 39 videoQuotaDaily: number
@@ -52,6 +54,7 @@ export class User implements UserServerModel {
52 this.videoQuota = hash.videoQuota 54 this.videoQuota = hash.videoQuota
53 this.videoQuotaDaily = hash.videoQuotaDaily 55 this.videoQuotaDaily = hash.videoQuotaDaily
54 this.nsfwPolicy = hash.nsfwPolicy 56 this.nsfwPolicy = hash.nsfwPolicy
57 this.webTorrentEnabled = hash.webTorrentEnabled
55 this.autoPlayVideo = hash.autoPlayVideo 58 this.autoPlayVideo = hash.autoPlayVideo
56 this.createdAt = hash.createdAt 59 this.createdAt = hash.createdAt
57 this.blocked = hash.blocked 60 this.blocked = hash.blocked
diff --git a/client/src/assets/player/peertube-player-local-storage.ts b/client/src/assets/player/peertube-player-local-storage.ts
index dac54c5a4..3ac5fe58a 100644
--- a/client/src/assets/player/peertube-player-local-storage.ts
+++ b/client/src/assets/player/peertube-player-local-storage.ts
@@ -10,6 +10,13 @@ function getStoredVolume () {
10 return undefined 10 return undefined
11} 11}
12 12
13function getStoredWebTorrentEnabled (): boolean {
14 const value = getLocalStorage('webtorrent_enabled')
15 if (value !== null && value !== undefined) return value === 'true'
16
17 return false
18}
19
13function getStoredMute () { 20function getStoredMute () {
14 const value = getLocalStorage('mute') 21 const value = getLocalStorage('mute')
15 if (value !== null && value !== undefined) return value === 'true' 22 if (value !== null && value !== undefined) return value === 'true'
@@ -56,6 +63,7 @@ function getAverageBandwidthInStore () {
56 63
57export { 64export {
58 getStoredVolume, 65 getStoredVolume,
66 getStoredWebTorrentEnabled,
59 getStoredMute, 67 getStoredMute,
60 getStoredTheater, 68 getStoredTheater,
61 saveVolumeInStore, 69 saveVolumeInStore,
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 2330f476f..5cebab6d9 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -11,11 +11,18 @@ import {
11 getAverageBandwidthInStore, 11 getAverageBandwidthInStore,
12 getStoredMute, 12 getStoredMute,
13 getStoredVolume, 13 getStoredVolume,
14 getStoredWebTorrentEnabled,
14 saveAverageBandwidth, 15 saveAverageBandwidth,
15 saveMuteInStore, 16 saveMuteInStore,
16 saveVolumeInStore 17 saveVolumeInStore
17} from './peertube-player-local-storage' 18} from './peertube-player-local-storage'
18 19
20type PlayOptions = {
21 forcePlay?: boolean,
22 seek?: number,
23 delay?: number
24}
25
19const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin') 26const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin')
20class PeerTubePlugin extends Plugin { 27class PeerTubePlugin extends Plugin {
21 private readonly playerElement: HTMLVideoElement 28 private readonly playerElement: HTMLVideoElement
@@ -64,6 +71,7 @@ class PeerTubePlugin extends Plugin {
64 private autoResolution = true 71 private autoResolution = true
65 private forbidAutoResolution = false 72 private forbidAutoResolution = false
66 private isAutoResolutionObservation = false 73 private isAutoResolutionObservation = false
74 private playerRefusedP2P = false
67 75
68 private videoViewInterval 76 private videoViewInterval
69 private torrentInfoInterval 77 private torrentInfoInterval
@@ -80,6 +88,7 @@ class PeerTubePlugin extends Plugin {
80 88
81 // Disable auto play on iOS 89 // Disable auto play on iOS
82 this.autoplay = options.autoplay && this.isIOS() === false 90 this.autoplay = options.autoplay && this.isIOS() === false
91 this.playerRefusedP2P = !getStoredWebTorrentEnabled()
83 92
84 this.startTime = timeToInt(options.startTime) 93 this.startTime = timeToInt(options.startTime)
85 this.videoFiles = options.videoFiles 94 this.videoFiles = options.videoFiles
@@ -178,6 +187,15 @@ class PeerTubePlugin extends Plugin {
178 const previousVideoFile = this.currentVideoFile 187 const previousVideoFile = this.currentVideoFile
179 this.currentVideoFile = videoFile 188 this.currentVideoFile = videoFile
180 189
190 // Don't try on iOS that does not support MediaSource
191 // Or don't use P2P if webtorrent is disabled
192 if (this.isIOS() || this.playerRefusedP2P) {
193 return this.fallbackToHttp(options, () => {
194 this.player.playbackRate(oldPlaybackRate)
195 return done()
196 })
197 }
198
181 this.addTorrent(this.currentVideoFile.magnetUri, previousVideoFile, options, () => { 199 this.addTorrent(this.currentVideoFile.magnetUri, previousVideoFile, options, () => {
182 this.player.playbackRate(oldPlaybackRate) 200 this.player.playbackRate(oldPlaybackRate)
183 return done() 201 return done()
@@ -248,11 +266,7 @@ class PeerTubePlugin extends Plugin {
248 private addTorrent ( 266 private addTorrent (
249 magnetOrTorrentUrl: string, 267 magnetOrTorrentUrl: string,
250 previousVideoFile: VideoFile, 268 previousVideoFile: VideoFile,
251 options: { 269 options: PlayOptions,
252 forcePlay?: boolean,
253 seek?: number,
254 delay?: number
255 },
256 done: Function 270 done: Function
257 ) { 271 ) {
258 console.log('Adding ' + magnetOrTorrentUrl + '.') 272 console.log('Adding ' + magnetOrTorrentUrl + '.')
@@ -288,7 +302,7 @@ class PeerTubePlugin extends Plugin {
288 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => { 302 renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => {
289 this.renderer = renderer 303 this.renderer = renderer
290 304
291 if (err) return this.fallbackToHttp(done) 305 if (err) return this.fallbackToHttp(options, done)
292 306
293 return this.tryToPlay(err => { 307 return this.tryToPlay(err => {
294 if (err) return done(err) 308 if (err) return done(err)
@@ -296,7 +310,7 @@ class PeerTubePlugin extends Plugin {
296 if (options.seek) this.seek(options.seek) 310 if (options.seek) this.seek(options.seek)
297 if (options.forcePlay === false && paused === true) this.player.pause() 311 if (options.forcePlay === false && paused === true) this.player.pause()
298 312
299 return done(err) 313 return done()
300 }) 314 })
301 }) 315 })
302 }, options.delay || 0) 316 }, options.delay || 0)
@@ -432,12 +446,6 @@ class PeerTubePlugin extends Plugin {
432 return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime }) 446 return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
433 } 447 }
434 448
435 // Don't try on iOS that does not support MediaSource
436 if (this.isIOS()) {
437 this.currentVideoFile = this.pickAverageVideoFile()
438 return this.fallbackToHttp(undefined, false)
439 }
440
441 // Proxy first play 449 // Proxy first play
442 const oldPlay = this.player.play.bind(this.player) 450 const oldPlay = this.player.play.bind(this.player)
443 this.player.play = () => { 451 this.player.play = () => {
@@ -567,7 +575,9 @@ class PeerTubePlugin extends Plugin {
567 return fetch(url, { method: 'PUT', body, headers }) 575 return fetch(url, { method: 'PUT', body, headers })
568 } 576 }
569 577
570 private fallbackToHttp (done?: Function, play = true) { 578 private fallbackToHttp (options: PlayOptions, done?: Function) {
579 const paused = this.player.paused()
580
571 this.disableAutoResolution(true) 581 this.disableAutoResolution(true)
572 582
573 this.flushVideoFile(this.currentVideoFile, true) 583 this.flushVideoFile(this.currentVideoFile, true)
@@ -579,9 +589,15 @@ class PeerTubePlugin extends Plugin {
579 const httpUrl = this.currentVideoFile.fileUrl 589 const httpUrl = this.currentVideoFile.fileUrl
580 this.player.src = this.savePlayerSrcFunction 590 this.player.src = this.savePlayerSrcFunction
581 this.player.src(httpUrl) 591 this.player.src(httpUrl)
582 if (play) this.tryToPlay()
583 592
584 if (done) return done() 593 return this.tryToPlay(err => {
594 if (err && done) return done(err)
595
596 if (options.seek) this.seek(options.seek)
597 if (options.forcePlay === false && paused === true) this.player.pause()
598
599 if (done) return done()
600 })
585 } 601 }
586 602
587 private handleError (err: Error | string) { 603 private handleError (err: Error | string) {
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index ebe668110..82299747d 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -328,6 +328,7 @@ async function updateMe (req: express.Request, res: express.Response, next: expr
328 if (body.password !== undefined) user.password = body.password 328 if (body.password !== undefined) user.password = body.password
329 if (body.email !== undefined) user.email = body.email 329 if (body.email !== undefined) user.email = body.email
330 if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy 330 if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy
331 if (body.webTorrentEnabled !== undefined) user.webTorrentEnabled = body.webTorrentEnabled
331 if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo 332 if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
332 333
333 await sequelizeTypescript.transaction(async t => { 334 await sequelizeTypescript.transaction(async t => {
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 90fc74a48..1cb5e5b0f 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -42,6 +42,10 @@ function isUserNSFWPolicyValid (value: any) {
42 return exists(value) && nsfwPolicies.indexOf(value) !== -1 42 return exists(value) && nsfwPolicies.indexOf(value) !== -1
43} 43}
44 44
45function isUserWebTorrentEnabledValid (value: any) {
46 return isBooleanValid(value)
47}
48
45function isUserAutoPlayVideoValid (value: any) { 49function isUserAutoPlayVideoValid (value: any) {
46 return isBooleanValid(value) 50 return isBooleanValid(value)
47} 51}
@@ -78,6 +82,7 @@ export {
78 isUserUsernameValid, 82 isUserUsernameValid,
79 isUserEmailVerifiedValid, 83 isUserEmailVerifiedValid,
80 isUserNSFWPolicyValid, 84 isUserNSFWPolicyValid,
85 isUserWebTorrentEnabledValid,
81 isUserAutoPlayVideoValid, 86 isUserAutoPlayVideoValid,
82 isUserDisplayNameValid, 87 isUserDisplayNameValid,
83 isUserDescriptionValid, 88 isUserDescriptionValid,
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index cf00da2c7..03158e356 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -16,7 +16,7 @@ let config: IConfig = require('config')
16 16
17// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
18 18
19const LAST_MIGRATION_VERSION = 275 19const LAST_MIGRATION_VERSION = 280
20 20
21// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
22 22
diff --git a/server/initializers/migrations/0280-webtorrent-policy-user.ts b/server/initializers/migrations/0280-webtorrent-policy-user.ts
new file mode 100644
index 000000000..e6488356a
--- /dev/null
+++ b/server/initializers/migrations/0280-webtorrent-policy-user.ts
@@ -0,0 +1,28 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<any> {
8 {
9 const data = {
10 type: Sequelize.BOOLEAN,
11 allowNull: false,
12 defaultValue: true
13 }
14
15 await utils.queryInterface.addColumn('user', 'webTorrentEnabled', data)
16 }
17
18}
19
20async function down (utils: {
21 transaction: Sequelize.Transaction
22 queryInterface: Sequelize.QueryInterface
23 sequelize: Sequelize.Sequelize
24}): Promise<any> {
25 await utils.queryInterface.removeColumn('user', 'webTorrentEnabled')
26}
27
28export { up, down }
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 39654cfcf..4b4a562fa 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -31,7 +31,8 @@ import {
31 isUserRoleValid, 31 isUserRoleValid,
32 isUserUsernameValid, 32 isUserUsernameValid,
33 isUserVideoQuotaDailyValid, 33 isUserVideoQuotaDailyValid,
34 isUserVideoQuotaValid 34 isUserVideoQuotaValid,
35 isUserWebTorrentEnabledValid
35} from '../../helpers/custom-validators/users' 36} from '../../helpers/custom-validators/users'
36import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' 37import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
37import { OAuthTokenModel } from '../oauth/oauth-token' 38import { OAuthTokenModel } from '../oauth/oauth-token'
@@ -108,6 +109,11 @@ export class UserModel extends Model<UserModel> {
108 nsfwPolicy: NSFWPolicyType 109 nsfwPolicy: NSFWPolicyType
109 110
110 @AllowNull(false) 111 @AllowNull(false)
112 @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled'))
113 @Column
114 webTorrentEnabled: boolean
115
116 @AllowNull(false)
111 @Default(true) 117 @Default(true)
112 @Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean')) 118 @Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
113 @Column 119 @Column
@@ -355,6 +361,7 @@ export class UserModel extends Model<UserModel> {
355 email: this.email, 361 email: this.email,
356 emailVerified: this.emailVerified, 362 emailVerified: this.emailVerified,
357 nsfwPolicy: this.nsfwPolicy, 363 nsfwPolicy: this.nsfwPolicy,
364 webTorrentEnabled: this.webTorrentEnabled,
358 autoPlayVideo: this.autoPlayVideo, 365 autoPlayVideo: this.autoPlayVideo,
359 role: this.role, 366 role: this.role,
360 roleLabel: USER_ROLE_LABELS[ this.role ], 367 roleLabel: USER_ROLE_LABELS[ this.role ],
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts
index bbffe1487..10edeee2e 100644
--- a/shared/models/users/user-update-me.model.ts
+++ b/shared/models/users/user-update-me.model.ts
@@ -3,7 +3,8 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type'
3export interface UserUpdateMe { 3export interface UserUpdateMe {
4 displayName?: string 4 displayName?: string
5 description?: string 5 description?: string
6 nsfwPolicy?: NSFWPolicyType 6 nsfwPolicy?: NSFWPolicyType,
7 webTorrentEnabled?: boolean,
7 autoPlayVideo?: boolean 8 autoPlayVideo?: boolean
8 email?: string 9 email?: string
9 currentPassword?: string 10 currentPassword?: string