X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fserver%2Fconfig-command.ts;h=5320dead4705bfe42cbba88d944ce33e1a4174f8;hb=010382b6037cff5d0ed16fa8b158691439fac9b7;hp=797231b1d2edadf2fe785daf46a60ea590edae5d;hpb=c55e3d7227fe1453869e309025996b9d75256d5d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts index 797231b1d..5320dead4 100644 --- a/shared/server-commands/server/config-command.ts +++ b/shared/server-commands/server/config-command.ts @@ -59,6 +59,9 @@ export class ConfigCommand extends AbstractCommand { newConfig: { transcoding: { enabled: false + }, + videoStudio: { + enabled: false } } }) @@ -69,6 +72,10 @@ export class ConfigCommand extends AbstractCommand { newConfig: { transcoding: { enabled: true, + + allowAudioFiles: true, + allowAdditionalExtensions: true, + resolutions: ConfigCommand.getCustomConfigResolutions(true), webtorrent: { @@ -82,6 +89,38 @@ export class ConfigCommand extends AbstractCommand { }) } + enableMinimumTranscoding (webtorrent = true, hls = true) { + return this.updateExistingSubConfig({ + newConfig: { + transcoding: { + enabled: true, + resolutions: { + ...ConfigCommand.getCustomConfigResolutions(false), + + '240p': true + }, + + webtorrent: { + enabled: webtorrent + }, + hls: { + enabled: hls + } + } + } + }) + } + + enableStudio () { + return this.updateExistingSubConfig({ + newConfig: { + videoStudio: { + enabled: true + } + } + }) + } + getConfig (options: OverrideCommandOptions = {}) { const path = '/api/v1/config' @@ -94,6 +133,21 @@ export class ConfigCommand extends AbstractCommand { }) } + async getIndexHTMLConfig (options: OverrideCommandOptions = {}) { + const text = await this.getRequestText({ + ...options, + + path: '/', + implicitToken: false, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + + const match = text.match('') + + // We parse the string twice, first to extract the string and then to extract the JSON + return JSON.parse(JSON.parse(match[1])) as ServerConfig + } + getAbout (options: OverrideCommandOptions = {}) { const path = '/api/v1/config/about' @@ -148,7 +202,7 @@ export class ConfigCommand extends AbstractCommand { async updateExistingSubConfig (options: OverrideCommandOptions & { newConfig: DeepPartial }) { - const existing = await this.getCustomConfig(options) + const existing = await this.getCustomConfig({ ...options, expectedStatus: HttpStatusCode.OK_200 }) return this.updateCustomConfig({ ...options, newCustomConfig: merge({}, existing, options.newConfig) }) } @@ -263,6 +317,9 @@ export class ConfigCommand extends AbstractCommand { live: { enabled: true, allowReplay: false, + latencySetting: { + enabled: false + }, maxDuration: -1, maxInstanceLives: -1, maxUserLives: 50, @@ -282,6 +339,9 @@ export class ConfigCommand extends AbstractCommand { } } }, + videoStudio: { + enabled: false + }, import: { videos: { concurrency: 3, @@ -296,7 +356,7 @@ export class ConfigCommand extends AbstractCommand { trending: { videos: { algorithms: { - enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ], + enabled: [ 'hot', 'most-viewed', 'most-liked' ], default: 'hot' } }