X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fserver-config-manager.ts;h=e87e2854f6d8b5cda66df964cacbe4c3187c1593;hb=8ca52bcc2c37d457e8b19a237c66b8dd1c00b6b9;hp=6aa459f82dd9b5b2f075a7473fd62a356e4fd8c3;hpb=d9f9804d8642b11001cb75aaef597e12825abe21;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/server-config-manager.ts b/server/lib/server-config-manager.ts index 6aa459f82..e87e2854f 100644 --- a/server/lib/server-config-manager.ts +++ b/server/lib/server-config-manager.ts @@ -1,13 +1,14 @@ -import { getServerCommit } from '@server/helpers/utils' +import { getServerCommit } from '@server/helpers/version' import { CONFIG, isEmailEnabled } from '@server/initializers/config' import { CONSTRAINTS_FIELDS, DEFAULT_THEME_NAME, PEERTUBE_VERSION } from '@server/initializers/constants' import { isSignupAllowed, isSignupAllowedForCurrentIP } from '@server/lib/signup' import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' +import { PluginModel } from '@server/models/server/plugin' import { HTMLServerConfig, RegisteredExternalAuthConfig, RegisteredIdAndPassAuthConfig, ServerConfig } from '@shared/models' import { Hooks } from './plugins/hooks' import { PluginManager } from './plugins/plugin-manager' import { getThemeOrDefault } from './plugins/theme-utils' -import { VideoTranscodingProfilesManager } from './transcoding/video-transcoding-profiles' +import { VideoTranscodingProfilesManager } from './transcoding/default-transcoding-profiles' /** * @@ -45,7 +46,11 @@ class ServerConfigManager { client: { videos: { miniature: { + displayAuthorAvatar: CONFIG.CLIENT.VIDEOS.MINIATURE.DISPLAY_AUTHOR_AVATAR, preferAuthorDisplayName: CONFIG.CLIENT.VIDEOS.MINIATURE.PREFER_AUTHOR_DISPLAY_NAME + }, + resumableUpload: { + maxChunkSize: CONFIG.CLIENT.VIDEOS.RESUMABLE_UPLOAD.MAX_CHUNK_SIZE } }, menu: { @@ -55,6 +60,23 @@ 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 + }, + p2p: { + webapp: { + enabled: CONFIG.DEFAULTS.P2P.WEBAPP.ENABLED + }, + embed: { + enabled: CONFIG.DEFAULTS.P2P.EMBED.ENABLED + } + } + }, + webadmin: { configuration: { edition: { @@ -118,6 +140,10 @@ class ServerConfigManager { enabled: CONFIG.LIVE.ENABLED, allowReplay: CONFIG.LIVE.ALLOW_REPLAY, + latencySetting: { + enabled: CONFIG.LIVE.LATENCY_SETTING.ENABLED + }, + maxDuration: CONFIG.LIVE.MAX_DURATION, maxInstanceLives: CONFIG.LIVE.MAX_INSTANCE_LIVES, maxUserLives: CONFIG.LIVE.MAX_USER_LIVES, @@ -133,6 +159,9 @@ class ServerConfigManager { port: CONFIG.LIVE.RTMP.PORT } }, + videoStudio: { + enabled: CONFIG.VIDEO_STUDIO.ENABLED + }, import: { videos: { http: { @@ -141,6 +170,9 @@ class ServerConfigManager { torrent: { enabled: CONFIG.IMPORT.VIDEOS.TORRENT.ENABLED } + }, + videoChannelSynchronization: { + enabled: CONFIG.IMPORT.VIDEO_CHANNEL_SYNCHRONIZATION.ENABLED } }, autoBlacklist: { @@ -229,10 +261,17 @@ class ServerConfigManager { async getServerConfig (ip?: string): Promise { const { allowed } = await Hooks.wrapPromiseFun( isSignupAllowed, + { - ip + ip, + signupMode: CONFIG.SIGNUP.REQUIRES_APPROVAL + ? 'request-registration' + : 'direct-registration' }, - 'filter:api.user.signup.allowed.result' + + CONFIG.SIGNUP.REQUIRES_APPROVAL + ? 'filter:api.user.request-signup.allowed.result' + : 'filter:api.user.signup.allowed.result' ) const allowedForCurrentIP = isSignupAllowedForCurrentIP(ip) @@ -241,6 +280,7 @@ class ServerConfigManager { allowed, allowedForCurrentIP, minimumAge: CONFIG.SIGNUP.MINIMUM_AGE, + requiresApproval: CONFIG.SIGNUP.REQUIRES_APPROVAL, requiresEmailVerification: CONFIG.SIGNUP.REQUIRES_EMAIL_VERIFICATION } @@ -252,6 +292,7 @@ class ServerConfigManager { getRegisteredThemes () { return PluginManager.Instance.getRegisteredThemes() .map(t => ({ + npmName: PluginModel.buildNpmName(t.name, t.type), name: t.name, version: t.version, description: t.description, @@ -263,6 +304,7 @@ class ServerConfigManager { getRegisteredPlugins () { return PluginManager.Instance.getRegisteredPlugins() .map(p => ({ + npmName: PluginModel.buildNpmName(p.name, p.type), name: p.name, version: p.version, description: p.description,