From 3cf68b869decf07ff7435fe1436d4f3134df1bf4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Dec 2021 17:17:01 +0100 Subject: Ability for admins to set default upload values --- server/lib/server-config-manager.ts | 9 +++++++++ server/lib/video.ts | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'server/lib') diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index 6aa459f82..8aea4cd6d 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts @@ -55,6 +55,15 @@ class ServerConfigManager { } }, + defaults: { + publish: { + downloadEnabled: CONFIG.DEFAULTS.PUBLISH.DOWNLOAD_ENABLED, + commentsEnabled: CONFIG.DEFAULTS.PUBLISH.COMMENTS_ENABLED, + privacy: CONFIG.DEFAULTS.PUBLISH.PRIVACY, + licence: CONFIG.DEFAULTS.PUBLISH.LICENCE + } + }, + webadmin: { configuration: { edition: { diff --git a/server/lib/video.ts b/server/lib/video.ts index 1cfe4f27c..e5af028ea 100644 --- a/server/lib/video.ts +++ b/server/lib/video.ts @@ -9,16 +9,17 @@ import { MThumbnail, MUserId, MVideoFile, MVideoTag, MVideoThumbnail, MVideoUUID import { ThumbnailType, VideoCreate, VideoPrivacy, VideoTranscodingPayload } from '@shared/models' import { CreateJobOptions, JobQueue } from './job-queue/job-queue' import { updateVideoMiniatureFromExisting } from './thumbnail' +import { CONFIG } from '@server/initializers/config' function buildLocalVideoFromReq (videoInfo: VideoCreate, channelId: number): FilteredModelAttributes { return { name: videoInfo.name, remote: false, category: videoInfo.category, - licence: videoInfo.licence, + licence: videoInfo.licence ?? CONFIG.DEFAULTS.PUBLISH.LICENCE, language: videoInfo.language, - commentsEnabled: videoInfo.commentsEnabled !== false, // If the value is not "false", the default is "true" - downloadEnabled: videoInfo.downloadEnabled !== false, + commentsEnabled: videoInfo.commentsEnabled ?? CONFIG.DEFAULTS.PUBLISH.COMMENTS_ENABLED, + downloadEnabled: videoInfo.downloadEnabled ?? CONFIG.DEFAULTS.PUBLISH.DOWNLOAD_ENABLED, waitTranscoding: videoInfo.waitTranscoding || false, nsfw: videoInfo.nsfw || false, description: videoInfo.description, -- cgit v1.2.3