diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-15 15:58:10 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-16 10:08:55 +0100 |
commit | a9bfa85d2cdf13670aaced740da5b493fbeddfce (patch) | |
tree | 3781c9218d4cc7786b6589365c0efbed2151703d /server/models | |
parent | c77fdc605b3ccc1ab6890f889d8200fbe9372949 (diff) | |
download | PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.gz PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.tar.zst PeerTube-a9bfa85d2cdf13670aaced740da5b493fbeddfce.zip |
Add ability for admins to set default p2p policy
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/user/user.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index b56f37e55..88c3ff528 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -55,7 +55,7 @@ import { | |||
55 | isUserVideoQuotaDailyValid, | 55 | isUserVideoQuotaDailyValid, |
56 | isUserVideoQuotaValid, | 56 | isUserVideoQuotaValid, |
57 | isUserVideosHistoryEnabledValid, | 57 | isUserVideosHistoryEnabledValid, |
58 | isUserWebTorrentEnabledValid | 58 | isUserP2PEnabledValid |
59 | } from '../../helpers/custom-validators/users' | 59 | } from '../../helpers/custom-validators/users' |
60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' | 60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' |
61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' | 61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' |
@@ -267,10 +267,9 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
267 | nsfwPolicy: NSFWPolicyType | 267 | nsfwPolicy: NSFWPolicyType |
268 | 268 | ||
269 | @AllowNull(false) | 269 | @AllowNull(false) |
270 | @Default(true) | 270 | @Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled')) |
271 | @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled')) | ||
272 | @Column | 271 | @Column |
273 | webTorrentEnabled: boolean | 272 | p2pEnabled: boolean |
274 | 273 | ||
275 | @AllowNull(false) | 274 | @AllowNull(false) |
276 | @Default(true) | 275 | @Default(true) |
@@ -892,7 +891,11 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
892 | emailVerified: this.emailVerified, | 891 | emailVerified: this.emailVerified, |
893 | 892 | ||
894 | nsfwPolicy: this.nsfwPolicy, | 893 | nsfwPolicy: this.nsfwPolicy, |
895 | webTorrentEnabled: this.webTorrentEnabled, | 894 | |
895 | // FIXME: deprecated in 4.1 | ||
896 | webTorrentEnabled: this.p2pEnabled, | ||
897 | p2pEnabled: this.p2pEnabled, | ||
898 | |||
896 | videosHistoryEnabled: this.videosHistoryEnabled, | 899 | videosHistoryEnabled: this.videosHistoryEnabled, |
897 | autoPlayVideo: this.autoPlayVideo, | 900 | autoPlayVideo: this.autoPlayVideo, |
898 | autoPlayNextVideo: this.autoPlayNextVideo, | 901 | autoPlayNextVideo: this.autoPlayNextVideo, |