X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fserver%2Fconfig-command.ts;h=1c2315ed15685f249d52fa641360b97a8b5945bf;hb=2a491182e483b97afb1b65c908b23cb48d591807;hp=c0042060b5006f6e915b93e4bda88bc088773d9d;hpb=c729caf6cc34630877a0e5a1bda1719384cd0c8a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/server/config-command.ts b/shared/server-commands/server/config-command.ts index c0042060b..1c2315ed1 100644 --- a/shared/server-commands/server/config-command.ts +++ b/shared/server-commands/server/config-command.ts @@ -18,17 +18,25 @@ export class ConfigCommand extends AbstractCommand { } } + disableImports () { + return this.setImportsEnabled(false) + } + enableImports () { + return this.setImportsEnabled(true) + } + + private setImportsEnabled (enabled: boolean) { return this.updateExistingSubConfig({ newConfig: { import: { videos: { http: { - enabled: true + enabled }, torrent: { - enabled: true + enabled } } } @@ -36,18 +44,41 @@ export class ConfigCommand extends AbstractCommand { }) } + private setChannelSyncEnabled (enabled: boolean) { + return this.updateExistingSubConfig({ + newConfig: { + import: { + videoChannelSynchronization: { + enabled + } + } + } + }) + } + + enableChannelSync () { + return this.setChannelSyncEnabled(true) + } + + disableChannelSync () { + return this.setChannelSyncEnabled(false) + } + enableLive (options: { allowReplay?: boolean transcoding?: boolean + resolutions?: 'min' | 'max' // Default max } = {}) { + const { allowReplay, transcoding, resolutions = 'max' } = options + return this.updateExistingSubConfig({ newConfig: { live: { enabled: true, - allowReplay: options.allowReplay ?? true, + allowReplay: allowReplay ?? true, transcoding: { - enabled: options.transcoding ?? true, - resolutions: ConfigCommand.getCustomConfigResolutions(true) + enabled: transcoding ?? true, + resolutions: ConfigCommand.getCustomConfigResolutions(resolutions === 'max') } } } @@ -60,7 +91,7 @@ export class ConfigCommand extends AbstractCommand { transcoding: { enabled: false }, - videoEditor: { + videoStudio: { enabled: false } } @@ -111,6 +142,16 @@ export class ConfigCommand extends AbstractCommand { }) } + enableStudio () { + return this.updateExistingSubConfig({ + newConfig: { + videoStudio: { + enabled: true + } + } + }) + } + getConfig (options: OverrideCommandOptions = {}) { const path = '/api/v1/config' @@ -123,6 +164,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' @@ -282,6 +338,7 @@ export class ConfigCommand extends AbstractCommand { '1440p': false, '2160p': false }, + alwaysTranscodeOriginalResolution: true, webtorrent: { enabled: true }, @@ -292,6 +349,9 @@ export class ConfigCommand extends AbstractCommand { live: { enabled: true, allowReplay: false, + latencySetting: { + enabled: false + }, maxDuration: -1, maxInstanceLives: -1, maxUserLives: 50, @@ -308,10 +368,11 @@ export class ConfigCommand extends AbstractCommand { '1080p': true, '1440p': true, '2160p': true - } + }, + alwaysTranscodeOriginalResolution: true } }, - videoEditor: { + videoStudio: { enabled: false }, import: { @@ -323,12 +384,16 @@ export class ConfigCommand extends AbstractCommand { torrent: { enabled: false } + }, + videoChannelSynchronization: { + enabled: false, + maxPerUser: 10 } }, trending: { videos: { algorithms: { - enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ], + enabled: [ 'hot', 'most-viewed', 'most-liked' ], default: 'hot' } }