Merge branch 'feature/webtorrent-disabling' into develop
This commit is contained in:
commit
bb5d90e62f
12 changed files with 101 additions and 19 deletions
|
@ -15,6 +15,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<my-peertube-checkbox
|
||||||
|
inputName="webTorrentEnabled" formControlName="webTorrentEnabled"
|
||||||
|
i18n-labelText labelText="Use WebTorrent to exchange parts of the video with others"
|
||||||
|
></my-peertube-checkbox>
|
||||||
|
|
||||||
<my-peertube-checkbox
|
<my-peertube-checkbox
|
||||||
inputName="autoPlayVideo" formControlName="autoPlayVideo"
|
inputName="autoPlayVideo" formControlName="autoPlayVideo"
|
||||||
i18n-labelText labelText="Automatically plays video"
|
i18n-labelText labelText="Automatically plays video"
|
||||||
|
|
|
@ -29,12 +29,14 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
this.buildForm({
|
this.buildForm({
|
||||||
nsfwPolicy: null,
|
nsfwPolicy: null,
|
||||||
|
webTorrentEnabled: null,
|
||||||
autoPlayVideo: null
|
autoPlayVideo: null
|
||||||
})
|
})
|
||||||
|
|
||||||
this.userInformationLoaded.subscribe(() => {
|
this.userInformationLoaded.subscribe(() => {
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
nsfwPolicy: this.user.nsfwPolicy,
|
nsfwPolicy: this.user.nsfwPolicy,
|
||||||
|
webTorrentEnabled: this.user.webTorrentEnabled,
|
||||||
autoPlayVideo: this.user.autoPlayVideo === true
|
autoPlayVideo: this.user.autoPlayVideo === true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -42,9 +44,11 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI
|
||||||
|
|
||||||
updateDetails () {
|
updateDetails () {
|
||||||
const nsfwPolicy = this.form.value['nsfwPolicy']
|
const nsfwPolicy = this.form.value['nsfwPolicy']
|
||||||
|
const webTorrentEnabled = this.form.value['webTorrentEnabled']
|
||||||
const autoPlayVideo = this.form.value['autoPlayVideo']
|
const autoPlayVideo = this.form.value['autoPlayVideo']
|
||||||
const details: UserUpdateMe = {
|
const details: UserUpdateMe = {
|
||||||
nsfwPolicy,
|
nsfwPolicy,
|
||||||
|
webTorrentEnabled,
|
||||||
autoPlayVideo
|
autoPlayVideo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ export class AuthUser extends User {
|
||||||
EMAIL: 'email',
|
EMAIL: 'email',
|
||||||
USERNAME: 'username',
|
USERNAME: 'username',
|
||||||
NSFW_POLICY: 'nsfw_policy',
|
NSFW_POLICY: 'nsfw_policy',
|
||||||
|
WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled',
|
||||||
AUTO_PLAY_VIDEO: 'auto_play_video'
|
AUTO_PLAY_VIDEO: 'auto_play_video'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ export class AuthUser extends User {
|
||||||
email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
|
email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
|
||||||
role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
|
role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
|
||||||
nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
|
nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
|
||||||
|
webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true',
|
||||||
autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
|
autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
|
||||||
},
|
},
|
||||||
Tokens.load()
|
Tokens.load()
|
||||||
|
@ -101,6 +103,7 @@ export class AuthUser extends User {
|
||||||
peertubeLocalStorage.removeItem(this.KEYS.ID)
|
peertubeLocalStorage.removeItem(this.KEYS.ID)
|
||||||
peertubeLocalStorage.removeItem(this.KEYS.ROLE)
|
peertubeLocalStorage.removeItem(this.KEYS.ROLE)
|
||||||
peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
|
peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
|
||||||
|
peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED)
|
||||||
peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
|
peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
|
||||||
peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
|
peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
|
||||||
Tokens.flush()
|
Tokens.flush()
|
||||||
|
@ -138,6 +141,7 @@ export class AuthUser extends User {
|
||||||
peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
|
peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
|
||||||
peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
|
peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
|
||||||
peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString())
|
peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString())
|
||||||
|
peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled))
|
||||||
peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
|
peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
|
||||||
this.tokens.save()
|
this.tokens.save()
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ export type UserConstructorHash = {
|
||||||
videoQuota?: number,
|
videoQuota?: number,
|
||||||
videoQuotaDaily?: number,
|
videoQuotaDaily?: number,
|
||||||
nsfwPolicy?: NSFWPolicyType,
|
nsfwPolicy?: NSFWPolicyType,
|
||||||
|
webTorrentEnabled?: boolean,
|
||||||
autoPlayVideo?: boolean,
|
autoPlayVideo?: boolean,
|
||||||
createdAt?: Date,
|
createdAt?: Date,
|
||||||
account?: AccountServerModel,
|
account?: AccountServerModel,
|
||||||
|
@ -32,6 +33,7 @@ export class User implements UserServerModel {
|
||||||
email: string
|
email: string
|
||||||
role: UserRole
|
role: UserRole
|
||||||
nsfwPolicy: NSFWPolicyType
|
nsfwPolicy: NSFWPolicyType
|
||||||
|
webTorrentEnabled: boolean
|
||||||
autoPlayVideo: boolean
|
autoPlayVideo: boolean
|
||||||
videoQuota: number
|
videoQuota: number
|
||||||
videoQuotaDaily: number
|
videoQuotaDaily: number
|
||||||
|
@ -52,6 +54,7 @@ export class User implements UserServerModel {
|
||||||
this.videoQuota = hash.videoQuota
|
this.videoQuota = hash.videoQuota
|
||||||
this.videoQuotaDaily = hash.videoQuotaDaily
|
this.videoQuotaDaily = hash.videoQuotaDaily
|
||||||
this.nsfwPolicy = hash.nsfwPolicy
|
this.nsfwPolicy = hash.nsfwPolicy
|
||||||
|
this.webTorrentEnabled = hash.webTorrentEnabled
|
||||||
this.autoPlayVideo = hash.autoPlayVideo
|
this.autoPlayVideo = hash.autoPlayVideo
|
||||||
this.createdAt = hash.createdAt
|
this.createdAt = hash.createdAt
|
||||||
this.blocked = hash.blocked
|
this.blocked = hash.blocked
|
||||||
|
|
|
@ -10,6 +10,13 @@ function getStoredVolume () {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStoredWebTorrentEnabled (): boolean {
|
||||||
|
const value = getLocalStorage('webtorrent_enabled')
|
||||||
|
if (value !== null && value !== undefined) return value === 'true'
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
function getStoredMute () {
|
function getStoredMute () {
|
||||||
const value = getLocalStorage('mute')
|
const value = getLocalStorage('mute')
|
||||||
if (value !== null && value !== undefined) return value === 'true'
|
if (value !== null && value !== undefined) return value === 'true'
|
||||||
|
@ -56,6 +63,7 @@ function getAverageBandwidthInStore () {
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getStoredVolume,
|
getStoredVolume,
|
||||||
|
getStoredWebTorrentEnabled,
|
||||||
getStoredMute,
|
getStoredMute,
|
||||||
getStoredTheater,
|
getStoredTheater,
|
||||||
saveVolumeInStore,
|
saveVolumeInStore,
|
||||||
|
|
|
@ -11,11 +11,18 @@ import {
|
||||||
getAverageBandwidthInStore,
|
getAverageBandwidthInStore,
|
||||||
getStoredMute,
|
getStoredMute,
|
||||||
getStoredVolume,
|
getStoredVolume,
|
||||||
|
getStoredWebTorrentEnabled,
|
||||||
saveAverageBandwidth,
|
saveAverageBandwidth,
|
||||||
saveMuteInStore,
|
saveMuteInStore,
|
||||||
saveVolumeInStore
|
saveVolumeInStore
|
||||||
} from './peertube-player-local-storage'
|
} from './peertube-player-local-storage'
|
||||||
|
|
||||||
|
type PlayOptions = {
|
||||||
|
forcePlay?: boolean,
|
||||||
|
seek?: number,
|
||||||
|
delay?: number
|
||||||
|
}
|
||||||
|
|
||||||
const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin')
|
const Plugin: VideoJSComponentInterface = videojs.getPlugin('plugin')
|
||||||
class PeerTubePlugin extends Plugin {
|
class PeerTubePlugin extends Plugin {
|
||||||
private readonly playerElement: HTMLVideoElement
|
private readonly playerElement: HTMLVideoElement
|
||||||
|
@ -64,6 +71,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
private autoResolution = true
|
private autoResolution = true
|
||||||
private forbidAutoResolution = false
|
private forbidAutoResolution = false
|
||||||
private isAutoResolutionObservation = false
|
private isAutoResolutionObservation = false
|
||||||
|
private playerRefusedP2P = false
|
||||||
|
|
||||||
private videoViewInterval
|
private videoViewInterval
|
||||||
private torrentInfoInterval
|
private torrentInfoInterval
|
||||||
|
@ -80,6 +88,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
|
|
||||||
// Disable auto play on iOS
|
// Disable auto play on iOS
|
||||||
this.autoplay = options.autoplay && this.isIOS() === false
|
this.autoplay = options.autoplay && this.isIOS() === false
|
||||||
|
this.playerRefusedP2P = !getStoredWebTorrentEnabled()
|
||||||
|
|
||||||
this.startTime = timeToInt(options.startTime)
|
this.startTime = timeToInt(options.startTime)
|
||||||
this.videoFiles = options.videoFiles
|
this.videoFiles = options.videoFiles
|
||||||
|
@ -178,6 +187,15 @@ class PeerTubePlugin extends Plugin {
|
||||||
const previousVideoFile = this.currentVideoFile
|
const previousVideoFile = this.currentVideoFile
|
||||||
this.currentVideoFile = videoFile
|
this.currentVideoFile = videoFile
|
||||||
|
|
||||||
|
// Don't try on iOS that does not support MediaSource
|
||||||
|
// Or don't use P2P if webtorrent is disabled
|
||||||
|
if (this.isIOS() || this.playerRefusedP2P) {
|
||||||
|
return this.fallbackToHttp(options, () => {
|
||||||
|
this.player.playbackRate(oldPlaybackRate)
|
||||||
|
return done()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.addTorrent(this.currentVideoFile.magnetUri, previousVideoFile, options, () => {
|
this.addTorrent(this.currentVideoFile.magnetUri, previousVideoFile, options, () => {
|
||||||
this.player.playbackRate(oldPlaybackRate)
|
this.player.playbackRate(oldPlaybackRate)
|
||||||
return done()
|
return done()
|
||||||
|
@ -248,11 +266,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
private addTorrent (
|
private addTorrent (
|
||||||
magnetOrTorrentUrl: string,
|
magnetOrTorrentUrl: string,
|
||||||
previousVideoFile: VideoFile,
|
previousVideoFile: VideoFile,
|
||||||
options: {
|
options: PlayOptions,
|
||||||
forcePlay?: boolean,
|
|
||||||
seek?: number,
|
|
||||||
delay?: number
|
|
||||||
},
|
|
||||||
done: Function
|
done: Function
|
||||||
) {
|
) {
|
||||||
console.log('Adding ' + magnetOrTorrentUrl + '.')
|
console.log('Adding ' + magnetOrTorrentUrl + '.')
|
||||||
|
@ -288,7 +302,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => {
|
renderVideo(torrent.files[ 0 ], this.playerElement, renderVideoOptions, (err, renderer) => {
|
||||||
this.renderer = renderer
|
this.renderer = renderer
|
||||||
|
|
||||||
if (err) return this.fallbackToHttp(done)
|
if (err) return this.fallbackToHttp(options, done)
|
||||||
|
|
||||||
return this.tryToPlay(err => {
|
return this.tryToPlay(err => {
|
||||||
if (err) return done(err)
|
if (err) return done(err)
|
||||||
|
@ -296,7 +310,7 @@ class PeerTubePlugin extends Plugin {
|
||||||
if (options.seek) this.seek(options.seek)
|
if (options.seek) this.seek(options.seek)
|
||||||
if (options.forcePlay === false && paused === true) this.player.pause()
|
if (options.forcePlay === false && paused === true) this.player.pause()
|
||||||
|
|
||||||
return done(err)
|
return done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}, options.delay || 0)
|
}, options.delay || 0)
|
||||||
|
@ -432,12 +446,6 @@ class PeerTubePlugin extends Plugin {
|
||||||
return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
|
return this.updateVideoFile(undefined, { forcePlay: true, seek: this.startTime })
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't try on iOS that does not support MediaSource
|
|
||||||
if (this.isIOS()) {
|
|
||||||
this.currentVideoFile = this.pickAverageVideoFile()
|
|
||||||
return this.fallbackToHttp(undefined, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proxy first play
|
// Proxy first play
|
||||||
const oldPlay = this.player.play.bind(this.player)
|
const oldPlay = this.player.play.bind(this.player)
|
||||||
this.player.play = () => {
|
this.player.play = () => {
|
||||||
|
@ -567,7 +575,9 @@ class PeerTubePlugin extends Plugin {
|
||||||
return fetch(url, { method: 'PUT', body, headers })
|
return fetch(url, { method: 'PUT', body, headers })
|
||||||
}
|
}
|
||||||
|
|
||||||
private fallbackToHttp (done?: Function, play = true) {
|
private fallbackToHttp (options: PlayOptions, done?: Function) {
|
||||||
|
const paused = this.player.paused()
|
||||||
|
|
||||||
this.disableAutoResolution(true)
|
this.disableAutoResolution(true)
|
||||||
|
|
||||||
this.flushVideoFile(this.currentVideoFile, true)
|
this.flushVideoFile(this.currentVideoFile, true)
|
||||||
|
@ -579,9 +589,15 @@ class PeerTubePlugin extends Plugin {
|
||||||
const httpUrl = this.currentVideoFile.fileUrl
|
const httpUrl = this.currentVideoFile.fileUrl
|
||||||
this.player.src = this.savePlayerSrcFunction
|
this.player.src = this.savePlayerSrcFunction
|
||||||
this.player.src(httpUrl)
|
this.player.src(httpUrl)
|
||||||
if (play) this.tryToPlay()
|
|
||||||
|
|
||||||
if (done) return done()
|
return this.tryToPlay(err => {
|
||||||
|
if (err && done) return done(err)
|
||||||
|
|
||||||
|
if (options.seek) this.seek(options.seek)
|
||||||
|
if (options.forcePlay === false && paused === true) this.player.pause()
|
||||||
|
|
||||||
|
if (done) return done()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleError (err: Error | string) {
|
private handleError (err: Error | string) {
|
||||||
|
|
|
@ -328,6 +328,7 @@ async function updateMe (req: express.Request, res: express.Response, next: expr
|
||||||
if (body.password !== undefined) user.password = body.password
|
if (body.password !== undefined) user.password = body.password
|
||||||
if (body.email !== undefined) user.email = body.email
|
if (body.email !== undefined) user.email = body.email
|
||||||
if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy
|
if (body.nsfwPolicy !== undefined) user.nsfwPolicy = body.nsfwPolicy
|
||||||
|
if (body.webTorrentEnabled !== undefined) user.webTorrentEnabled = body.webTorrentEnabled
|
||||||
if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
|
if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo
|
||||||
|
|
||||||
await sequelizeTypescript.transaction(async t => {
|
await sequelizeTypescript.transaction(async t => {
|
||||||
|
|
|
@ -42,6 +42,10 @@ function isUserNSFWPolicyValid (value: any) {
|
||||||
return exists(value) && nsfwPolicies.indexOf(value) !== -1
|
return exists(value) && nsfwPolicies.indexOf(value) !== -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isUserWebTorrentEnabledValid (value: any) {
|
||||||
|
return isBooleanValid(value)
|
||||||
|
}
|
||||||
|
|
||||||
function isUserAutoPlayVideoValid (value: any) {
|
function isUserAutoPlayVideoValid (value: any) {
|
||||||
return isBooleanValid(value)
|
return isBooleanValid(value)
|
||||||
}
|
}
|
||||||
|
@ -78,6 +82,7 @@ export {
|
||||||
isUserUsernameValid,
|
isUserUsernameValid,
|
||||||
isUserEmailVerifiedValid,
|
isUserEmailVerifiedValid,
|
||||||
isUserNSFWPolicyValid,
|
isUserNSFWPolicyValid,
|
||||||
|
isUserWebTorrentEnabledValid,
|
||||||
isUserAutoPlayVideoValid,
|
isUserAutoPlayVideoValid,
|
||||||
isUserDisplayNameValid,
|
isUserDisplayNameValid,
|
||||||
isUserDescriptionValid,
|
isUserDescriptionValid,
|
||||||
|
|
|
@ -16,7 +16,7 @@ let config: IConfig = require('config')
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const LAST_MIGRATION_VERSION = 275
|
const LAST_MIGRATION_VERSION = 280
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
import * as Sequelize from 'sequelize'
|
||||||
|
|
||||||
|
async function up (utils: {
|
||||||
|
transaction: Sequelize.Transaction
|
||||||
|
queryInterface: Sequelize.QueryInterface
|
||||||
|
sequelize: Sequelize.Sequelize
|
||||||
|
}): Promise<any> {
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
type: Sequelize.BOOLEAN,
|
||||||
|
allowNull: false,
|
||||||
|
defaultValue: true
|
||||||
|
}
|
||||||
|
|
||||||
|
await utils.queryInterface.addColumn('user', 'webTorrentEnabled', data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function down (utils: {
|
||||||
|
transaction: Sequelize.Transaction
|
||||||
|
queryInterface: Sequelize.QueryInterface
|
||||||
|
sequelize: Sequelize.Sequelize
|
||||||
|
}): Promise<any> {
|
||||||
|
await utils.queryInterface.removeColumn('user', 'webTorrentEnabled')
|
||||||
|
}
|
||||||
|
|
||||||
|
export { up, down }
|
|
@ -31,7 +31,8 @@ import {
|
||||||
isUserRoleValid,
|
isUserRoleValid,
|
||||||
isUserUsernameValid,
|
isUserUsernameValid,
|
||||||
isUserVideoQuotaDailyValid,
|
isUserVideoQuotaDailyValid,
|
||||||
isUserVideoQuotaValid
|
isUserVideoQuotaValid,
|
||||||
|
isUserWebTorrentEnabledValid
|
||||||
} from '../../helpers/custom-validators/users'
|
} from '../../helpers/custom-validators/users'
|
||||||
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
|
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
|
||||||
import { OAuthTokenModel } from '../oauth/oauth-token'
|
import { OAuthTokenModel } from '../oauth/oauth-token'
|
||||||
|
@ -107,6 +108,11 @@ export class UserModel extends Model<UserModel> {
|
||||||
@Column(DataType.ENUM(values(NSFW_POLICY_TYPES)))
|
@Column(DataType.ENUM(values(NSFW_POLICY_TYPES)))
|
||||||
nsfwPolicy: NSFWPolicyType
|
nsfwPolicy: NSFWPolicyType
|
||||||
|
|
||||||
|
@AllowNull(false)
|
||||||
|
@Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled'))
|
||||||
|
@Column
|
||||||
|
webTorrentEnabled: boolean
|
||||||
|
|
||||||
@AllowNull(false)
|
@AllowNull(false)
|
||||||
@Default(true)
|
@Default(true)
|
||||||
@Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
|
@Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
|
||||||
|
@ -355,6 +361,7 @@ export class UserModel extends Model<UserModel> {
|
||||||
email: this.email,
|
email: this.email,
|
||||||
emailVerified: this.emailVerified,
|
emailVerified: this.emailVerified,
|
||||||
nsfwPolicy: this.nsfwPolicy,
|
nsfwPolicy: this.nsfwPolicy,
|
||||||
|
webTorrentEnabled: this.webTorrentEnabled,
|
||||||
autoPlayVideo: this.autoPlayVideo,
|
autoPlayVideo: this.autoPlayVideo,
|
||||||
role: this.role,
|
role: this.role,
|
||||||
roleLabel: USER_ROLE_LABELS[ this.role ],
|
roleLabel: USER_ROLE_LABELS[ this.role ],
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { NSFWPolicyType } from '../videos/nsfw-policy.type'
|
||||||
export interface UserUpdateMe {
|
export interface UserUpdateMe {
|
||||||
displayName?: string
|
displayName?: string
|
||||||
description?: string
|
description?: string
|
||||||
nsfwPolicy?: NSFWPolicyType
|
nsfwPolicy?: NSFWPolicyType,
|
||||||
|
webTorrentEnabled?: boolean,
|
||||||
autoPlayVideo?: boolean
|
autoPlayVideo?: boolean
|
||||||
email?: string
|
email?: string
|
||||||
currentPassword?: string
|
currentPassword?: string
|
||||||
|
|
Loading…
Reference in a new issue