</div>
</div>
+ <div class="form-row mt-4"> <!-- video channels grid -->
+ <div class="form-group col-12 col-lg-4 col-xl-3">
+ <div i18n class="inner-form-title">VIDEO CHANNELS</div>
+ </div>
+
+ <div class="form-group form-group-right col-12 col-lg-8 col-xl-9">
+ <div class="form-group" formGroupName="videoChannels">
+ <label i18n for="videoChannelsMaxPerUser">Max video channels per user</label>
+
+ <div class="number-with-unit">
+ <input
+ type="number" min="1" id="videoChannelsMaxPerUser" class="form-control"
+ formControlName="maxPerUser" [ngClass]="{ 'input-error': formErrors['videoChannels.maxPerUser'] }"
+ >
+ <span i18n>{form.value['videoChannels']['maxPerUser'], plural, =1 {channel} other {channels}}</span>
+ </div>
+
+ <div *ngIf="formErrors.videoChannels.maxPerUser" class="form-error">{{ formErrors.videoChannels.maxPerUser }}</div>
+ </div>
+ </div>
+ </div>
+
<div class="form-row mt-4"> <!-- search grid -->
<div class="form-group col-12 col-lg-4 col-xl-3">
<div i18n class="inner-form-title">SEARCH</div>
SERVICES_TWITTER_USERNAME_VALIDATOR,
SIGNUP_LIMIT_VALIDATOR,
SIGNUP_MINIMUM_AGE_VALIDATOR,
- TRANSCODING_THREADS_VALIDATOR
+ TRANSCODING_THREADS_VALIDATOR,
+ MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR
} from '@app/shared/form-validators/custom-config-validators'
import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
videoQuota: USER_VIDEO_QUOTA_VALIDATOR,
videoQuotaDaily: USER_VIDEO_QUOTA_DAILY_VALIDATOR
},
+ videoChannels: {
+ maxPerUser: MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR
+ },
transcoding: {
enabled: null,
threads: TRANSCODING_THREADS_VALIDATOR,
}
}
+export const MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR: BuildFormValidator = {
+ VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
+ MESSAGES: {
+ required: $localize`Max video channels per user is required.`,
+ min: $localize`Max video channels per user must be greater or equal to 1.`,
+ pattern: $localize`Max video channels per user must be a number.`
+ }
+}
+
export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.min(1) ],
MESSAGES: {
} from './misc'
import { PluginPlaceholderComponent } from './plugins'
import { ActorRedirectGuard } from './router'
-import { UserHistoryService, UserNotificationsComponent, UserNotificationService, UserQuotaComponent } from './users'
+import {
+ UserHistoryService,
+ UserNotificationsComponent,
+ UserNotificationService,
+ UserQuotaComponent
+} from './users'
import { RedundancyService, VideoImportService, VideoOwnershipService, VideoService } from './video'
import { VideoCaptionService } from './video-caption'
import { VideoChannelService } from './video-channel'
video_quota: -1
video_quota_daily: -1
+video_channels:
+ max_per_user: 20 # Allows each user to create up to 20 video channels.
+
# If enabled, the video will be transcoded to mp4 (x264) with `faststart` flag
# In addition, if some resolutions are enabled the mp4 video file will be transcoded to these new resolutions
# Please, do not disable transcoding since many uploaded videos will not work
video_quota: -1
video_quota_daily: -1
+video_channels:
+ max_per_user: 20 # Allows each user to create up to 20 video channels.
+
# If enabled, the video will be transcoded to mp4 (x264) with `faststart` flag
# In addition, if some resolutions are enabled the mp4 video file will be transcoded to these new resolutions
# Please, do not disable transcoding since many uploaded videos will not work
videoQuota: CONFIG.USER.VIDEO_QUOTA,
videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY
},
+ videoChannels: {
+ maxPerUser: CONFIG.VIDEO_CHANNELS.MAX_PER_USER
+ },
transcoding: {
enabled: CONFIG.TRANSCODING.ENABLED,
allowAdditionalExtensions: CONFIG.TRANSCODING.ALLOW_ADDITIONAL_EXTENSIONS,
'storage.redundancy', 'storage.tmp', 'storage.streaming_playlists', 'storage.plugins',
'log.level',
'user.video_quota', 'user.video_quota_daily',
+ 'video_channels.max_per_user',
'csp.enabled', 'csp.report_only', 'csp.report_uri',
'security.frameguard.enabled',
'cache.previews.size', 'cache.captions.size', 'cache.torrents.size', 'admin.email', 'contact_form.enabled',
get VIDEO_QUOTA () { return parseBytes(config.get<number>('user.video_quota')) },
get VIDEO_QUOTA_DAILY () { return parseBytes(config.get<number>('user.video_quota_daily')) }
},
+ VIDEO_CHANNELS: {
+ get MAX_PER_USER () { return config.get<number>('video_channels.max_per_user') }
+ },
TRANSCODING: {
get ENABLED () { return config.get<boolean>('transcoding.enabled') },
get ALLOW_ADDITIONAL_EXTENSIONS () { return config.get<boolean>('transcoding.allow_additional_extensions') },
}
}
-const VIDEO_CHANNELS = {
- MAX_PER_USER: 20
-}
-
// ---------------------------------------------------------------------------
const SERVER_ACTOR_NAME = 'peertube'
VIDEO_TRANSCODING_FPS,
FFMPEG_NICE,
ABUSE_STATES,
- VIDEO_CHANNELS,
LRU_CACHE,
REQUEST_TIMEOUT,
USER_PASSWORD_RESET_LIFETIME,
videoQuota: CONFIG.USER.VIDEO_QUOTA,
videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY
},
+ videoChannels: {
+ maxPerUser: CONFIG.VIDEO_CHANNELS.MAX_PER_USER
+ },
trending: {
videos: {
intervalDays: CONFIG.TRENDING.VIDEOS.INTERVAL_DAYS,
body('user.videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid video quota'),
body('user.videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily video quota'),
+ body('videoChannels.maxPerUser').isInt().withMessage("Should have a valid maximum amount of video channels per user"),
+
body('transcoding.enabled').isBoolean().withMessage('Should have a valid transcoding enabled boolean'),
body('transcoding.allowAdditionalExtensions').isBoolean().withMessage('Should have a valid additional extensions boolean'),
body('transcoding.threads').isInt().withMessage('Should have a valid transcoding threads number'),
import express from 'express'
import { body, param, query } from 'express-validator'
-import { VIDEO_CHANNELS } from '@server/initializers/constants'
import { MChannelAccountDefault, MUser } from '@server/types/models'
import { UserRight } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { ActorModel } from '../../../models/actor/actor'
import { VideoChannelModel } from '../../../models/video/video-channel'
import { areValidationErrors, doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../shared'
+import { CONFIG } from '@server/initializers/config'
const videoChannelsAddValidator = [
body('name').custom(isVideoChannelUsernameValid).withMessage('Should have a valid channel name'),
}
const count = await VideoChannelModel.countByAccount(res.locals.oauth.token.User.Account.id)
- if (count >= VIDEO_CHANNELS.MAX_PER_USER) {
- res.fail({ message: `You cannot create more than ${VIDEO_CHANNELS.MAX_PER_USER} channels` })
+ if (count >= CONFIG.VIDEO_CHANNELS.MAX_PER_USER) {
+ res.fail({ message: `You cannot create more than ${CONFIG.VIDEO_CHANNELS.MAX_PER_USER} channels` })
return false
}
isVideoChannelDisplayNameValid,
isVideoChannelSupportValid
} from '../../helpers/custom-validators/video-channels'
-import { CONSTRAINTS_FIELDS, VIDEO_CHANNELS, WEBSERVER } from '../../initializers/constants'
+import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
import { sendDeleteActor } from '../../lib/activitypub/send'
import {
MChannelActor,
import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from './video'
import { VideoPlaylistModel } from './video-playlist'
+import { CONFIG } from '@server/initializers/config'
export enum ScopeNames {
FOR_API = 'FOR_API',
static listAllByAccount (accountId: number) {
const query = {
- limit: VIDEO_CHANNELS.MAX_PER_USER,
+ limit: CONFIG.VIDEO_CHANNELS.MAX_PER_USER,
include: [
{
attributes: [],
videoQuota: 5242881,
videoQuotaDaily: 318742
},
+ videoChannels: {
+ maxPerUser: 20
+ },
transcoding: {
enabled: true,
allowAdditionalExtensions: true,
expect(data.user.videoQuota).to.equal(5242880)
expect(data.user.videoQuotaDaily).to.equal(-1)
+ expect(data.videoChannels.maxPerUser).to.equal(20)
+
expect(data.transcoding.enabled).to.be.false
expect(data.transcoding.allowAdditionalExtensions).to.be.false
expect(data.transcoding.allowAudioFiles).to.be.false
expect(data.user.videoQuota).to.equal(5242881)
expect(data.user.videoQuotaDaily).to.equal(318742)
+ expect(data.videoChannels.maxPerUser).to.equal(24)
+
expect(data.transcoding.enabled).to.be.true
expect(data.transcoding.threads).to.equal(1)
expect(data.transcoding.concurrency).to.equal(3)
videoQuota: 5242881,
videoQuotaDaily: 318742
},
+ videoChannels: {
+ maxPerUser: 24
+ },
transcoding: {
enabled: true,
allowAdditionalExtensions: true,
videoQuota: 5242881,
videoQuotaDaily: 318742
},
+ videoChannels: {
+ maxPerUser: 20
+ },
transcoding: {
enabled: true,
allowAdditionalExtensions: true,
videoQuotaDaily: number
}
+ videoChannels: {
+ maxPerUser: number
+ }
+
transcoding: {
enabled: boolean
videoQuotaDaily: number
}
+ videoChannels: {
+ maxPerUser: number
+ }
+
trending: {
videos: {
intervalDays: number