|
@@ -1,6 +1,6 @@
|
|
-import merge from 'lodash-es/merge.js'
|
|
|
|
import { About, ActorImageType, ActorImageType_Type, CustomConfig, HttpStatusCode, ServerConfig } from '@peertube/peertube-models'
|
|
import { About, ActorImageType, ActorImageType_Type, CustomConfig, HttpStatusCode, ServerConfig } from '@peertube/peertube-models'
|
|
import { DeepPartial } from '@peertube/peertube-typescript-utils'
|
|
import { DeepPartial } from '@peertube/peertube-typescript-utils'
|
|
|
|
+import merge from 'lodash-es/merge.js'
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command.js'
|
|
import { AbstractCommand, OverrideCommandOptions } from '../shared/abstract-command.js'
|
|
|
|
|
|
export class ConfigCommand extends AbstractCommand {
|
|
export class ConfigCommand extends AbstractCommand {
|
|
@@ -43,7 +43,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
enableSignup (requiresApproval: boolean, limit = -1) {
|
|
enableSignup (requiresApproval: boolean, limit = -1) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
signup: {
|
|
signup: {
|
|
enabled: true,
|
|
enabled: true,
|
|
@@ -65,7 +65,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setVideoImportsEnabled (enabled: boolean) {
|
|
private setVideoImportsEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
import: {
|
|
import: {
|
|
videos: {
|
|
videos: {
|
|
@@ -93,7 +93,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setFileUpdateEnabled (enabled: boolean) {
|
|
private setFileUpdateEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
videoFile: {
|
|
videoFile: {
|
|
update: {
|
|
update: {
|
|
@@ -107,7 +107,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
keepSourceFile () {
|
|
keepSourceFile () {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
transcoding: {
|
|
transcoding: {
|
|
originalFile: {
|
|
originalFile: {
|
|
@@ -128,7 +128,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setChannelSyncEnabled (enabled: boolean) {
|
|
private setChannelSyncEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
import: {
|
|
import: {
|
|
videoChannelSynchronization: {
|
|
videoChannelSynchronization: {
|
|
@@ -150,7 +150,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setAutoblacklistEnabled (enabled: boolean) {
|
|
private setAutoblacklistEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
autoBlacklist: {
|
|
autoBlacklist: {
|
|
videos: {
|
|
videos: {
|
|
@@ -174,7 +174,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setUserImportEnabled (enabled: boolean) {
|
|
private setUserImportEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
import: {
|
|
import: {
|
|
users: {
|
|
users: {
|
|
@@ -196,7 +196,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
private setUserExportEnabled (enabled: boolean) {
|
|
private setUserExportEnabled (enabled: boolean) {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
export: {
|
|
export: {
|
|
users: {
|
|
users: {
|
|
@@ -216,7 +216,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
} = {}) {
|
|
} = {}) {
|
|
const { allowReplay, transcoding, resolutions = 'max' } = options
|
|
const { allowReplay, transcoding, resolutions = 'max' } = options
|
|
|
|
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
live: {
|
|
live: {
|
|
enabled: true,
|
|
enabled: true,
|
|
@@ -231,7 +231,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
disableTranscoding () {
|
|
disableTranscoding () {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
transcoding: {
|
|
transcoding: {
|
|
enabled: false
|
|
enabled: false
|
|
@@ -251,7 +251,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
} = {}) {
|
|
} = {}) {
|
|
const { webVideo = true, hls = true, with0p = false, keepOriginal = false } = options
|
|
const { webVideo = true, hls = true, with0p = false, keepOriginal = false } = options
|
|
|
|
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
transcoding: {
|
|
transcoding: {
|
|
enabled: true,
|
|
enabled: true,
|
|
@@ -282,7 +282,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
} = {}) {
|
|
} = {}) {
|
|
const { webVideo = true, hls = true, keepOriginal = false } = options
|
|
const { webVideo = true, hls = true, keepOriginal = false } = options
|
|
|
|
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
transcoding: {
|
|
transcoding: {
|
|
enabled: true,
|
|
enabled: true,
|
|
@@ -311,7 +311,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
enableRemoteTranscoding () {
|
|
enableRemoteTranscoding () {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
transcoding: {
|
|
transcoding: {
|
|
remoteRunners: {
|
|
remoteRunners: {
|
|
@@ -330,7 +330,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
}
|
|
}
|
|
|
|
|
|
enableRemoteStudio () {
|
|
enableRemoteStudio () {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
videoStudio: {
|
|
videoStudio: {
|
|
remoteRunners: {
|
|
remoteRunners: {
|
|
@@ -344,7 +344,7 @@ export class ConfigCommand extends AbstractCommand {
|
|
// ---------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
enableStudio () {
|
|
enableStudio () {
|
|
- return this.updateExistingSubConfig({
|
|
|
|
|
|
+ return this.updateExistingConfig({
|
|
newConfig: {
|
|
newConfig: {
|
|
videoStudio: {
|
|
videoStudio: {
|
|
enabled: true
|
|
enabled: true
|
|
@@ -480,259 +480,11 @@ export class ConfigCommand extends AbstractCommand {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- async updateExistingSubConfig (options: OverrideCommandOptions & {
|
|
|
|
|
|
+ async updateExistingConfig (options: OverrideCommandOptions & {
|
|
newConfig: DeepPartial<CustomConfig>
|
|
newConfig: DeepPartial<CustomConfig>
|
|
}) {
|
|
}) {
|
|
const existing = await this.getCustomConfig({ ...options, expectedStatus: HttpStatusCode.OK_200 })
|
|
const existing = await this.getCustomConfig({ ...options, expectedStatus: HttpStatusCode.OK_200 })
|
|
|
|
|
|
return this.updateCustomConfig({ ...options, newCustomConfig: merge({}, existing, options.newConfig) })
|
|
return this.updateCustomConfig({ ...options, newCustomConfig: merge({}, existing, options.newConfig) })
|
|
}
|
|
}
|
|
-
|
|
|
|
- updateCustomSubConfig (options: OverrideCommandOptions & {
|
|
|
|
- newConfig: DeepPartial<CustomConfig>
|
|
|
|
- }) {
|
|
|
|
- const newCustomConfig: CustomConfig = {
|
|
|
|
- instance: {
|
|
|
|
- name: 'PeerTube updated',
|
|
|
|
- shortDescription: 'my short description',
|
|
|
|
- description: 'my super description',
|
|
|
|
- terms: 'my super terms',
|
|
|
|
- codeOfConduct: 'my super coc',
|
|
|
|
-
|
|
|
|
- creationReason: 'my super creation reason',
|
|
|
|
- moderationInformation: 'my super moderation information',
|
|
|
|
- administrator: 'Kuja',
|
|
|
|
- maintenanceLifetime: 'forever',
|
|
|
|
- businessModel: 'my super business model',
|
|
|
|
- hardwareInformation: '2vCore 3GB RAM',
|
|
|
|
-
|
|
|
|
- languages: [ 'en', 'es' ],
|
|
|
|
- categories: [ 1, 2 ],
|
|
|
|
-
|
|
|
|
- isNSFW: true,
|
|
|
|
- defaultNSFWPolicy: 'blur',
|
|
|
|
-
|
|
|
|
- defaultClientRoute: '/videos/recently-added',
|
|
|
|
-
|
|
|
|
- customizations: {
|
|
|
|
- javascript: 'alert("coucou")',
|
|
|
|
- css: 'body { background-color: red; }'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- theme: {
|
|
|
|
- default: 'default'
|
|
|
|
- },
|
|
|
|
- services: {
|
|
|
|
- twitter: {
|
|
|
|
- username: '@MySuperUsername'
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- client: {
|
|
|
|
- videos: {
|
|
|
|
- miniature: {
|
|
|
|
- preferAuthorDisplayName: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- menu: {
|
|
|
|
- login: {
|
|
|
|
- redirectOnSingleExternalAuth: false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- cache: {
|
|
|
|
- previews: {
|
|
|
|
- size: 2
|
|
|
|
- },
|
|
|
|
- captions: {
|
|
|
|
- size: 3
|
|
|
|
- },
|
|
|
|
- torrents: {
|
|
|
|
- size: 4
|
|
|
|
- },
|
|
|
|
- storyboards: {
|
|
|
|
- size: 5
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- signup: {
|
|
|
|
- enabled: false,
|
|
|
|
- limit: 5,
|
|
|
|
- requiresApproval: true,
|
|
|
|
- requiresEmailVerification: false,
|
|
|
|
- minimumAge: 16
|
|
|
|
- },
|
|
|
|
- admin: {
|
|
|
|
- email: 'superadmin1@example.com'
|
|
|
|
- },
|
|
|
|
- contactForm: {
|
|
|
|
- enabled: true
|
|
|
|
- },
|
|
|
|
- user: {
|
|
|
|
- history: {
|
|
|
|
- videos: {
|
|
|
|
- enabled: true
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- videoQuota: 5242881,
|
|
|
|
- videoQuotaDaily: 318742,
|
|
|
|
- defaultChannelName: 'Main $1 channel'
|
|
|
|
- },
|
|
|
|
- videoChannels: {
|
|
|
|
- maxPerUser: 20
|
|
|
|
- },
|
|
|
|
- transcoding: {
|
|
|
|
- enabled: true,
|
|
|
|
- originalFile: {
|
|
|
|
- keep: false
|
|
|
|
- },
|
|
|
|
- remoteRunners: {
|
|
|
|
- enabled: false
|
|
|
|
- },
|
|
|
|
- allowAdditionalExtensions: true,
|
|
|
|
- allowAudioFiles: true,
|
|
|
|
- threads: 1,
|
|
|
|
- concurrency: 3,
|
|
|
|
- profile: 'default',
|
|
|
|
- resolutions: {
|
|
|
|
- '0p': false,
|
|
|
|
- '144p': false,
|
|
|
|
- '240p': false,
|
|
|
|
- '360p': true,
|
|
|
|
- '480p': true,
|
|
|
|
- '720p': false,
|
|
|
|
- '1080p': false,
|
|
|
|
- '1440p': false,
|
|
|
|
- '2160p': false
|
|
|
|
- },
|
|
|
|
- alwaysTranscodeOriginalResolution: true,
|
|
|
|
- webVideos: {
|
|
|
|
- enabled: true
|
|
|
|
- },
|
|
|
|
- hls: {
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- live: {
|
|
|
|
- enabled: true,
|
|
|
|
- allowReplay: false,
|
|
|
|
- latencySetting: {
|
|
|
|
- enabled: false
|
|
|
|
- },
|
|
|
|
- maxDuration: -1,
|
|
|
|
- maxInstanceLives: -1,
|
|
|
|
- maxUserLives: 50,
|
|
|
|
- transcoding: {
|
|
|
|
- enabled: true,
|
|
|
|
- remoteRunners: {
|
|
|
|
- enabled: false
|
|
|
|
- },
|
|
|
|
- threads: 4,
|
|
|
|
- profile: 'default',
|
|
|
|
- resolutions: {
|
|
|
|
- '144p': true,
|
|
|
|
- '240p': true,
|
|
|
|
- '360p': true,
|
|
|
|
- '480p': true,
|
|
|
|
- '720p': true,
|
|
|
|
- '1080p': true,
|
|
|
|
- '1440p': true,
|
|
|
|
- '2160p': true
|
|
|
|
- },
|
|
|
|
- alwaysTranscodeOriginalResolution: true
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- videoStudio: {
|
|
|
|
- enabled: false,
|
|
|
|
- remoteRunners: {
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- videoFile: {
|
|
|
|
- update: {
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- import: {
|
|
|
|
- videos: {
|
|
|
|
- concurrency: 3,
|
|
|
|
- http: {
|
|
|
|
- enabled: false
|
|
|
|
- },
|
|
|
|
- torrent: {
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- videoChannelSynchronization: {
|
|
|
|
- enabled: false,
|
|
|
|
- maxPerUser: 10
|
|
|
|
- },
|
|
|
|
- users: {
|
|
|
|
- enabled: true
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- export: {
|
|
|
|
- users: {
|
|
|
|
- enabled: true,
|
|
|
|
- maxUserVideoQuota: 5242881,
|
|
|
|
- exportExpiration: 1000 * 3600
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- trending: {
|
|
|
|
- videos: {
|
|
|
|
- algorithms: {
|
|
|
|
- enabled: [ 'hot', 'most-viewed', 'most-liked' ],
|
|
|
|
- default: 'hot'
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- autoBlacklist: {
|
|
|
|
- videos: {
|
|
|
|
- ofUsers: {
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- followers: {
|
|
|
|
- instance: {
|
|
|
|
- enabled: true,
|
|
|
|
- manualApproval: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- followings: {
|
|
|
|
- instance: {
|
|
|
|
- autoFollowBack: {
|
|
|
|
- enabled: false
|
|
|
|
- },
|
|
|
|
- autoFollowIndex: {
|
|
|
|
- indexUrl: 'https://instances.joinpeertube.org/api/v1/instances/hosts',
|
|
|
|
- enabled: false
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- broadcastMessage: {
|
|
|
|
- enabled: true,
|
|
|
|
- level: 'warning',
|
|
|
|
- message: 'hello',
|
|
|
|
- dismissable: true
|
|
|
|
- },
|
|
|
|
- search: {
|
|
|
|
- remoteUri: {
|
|
|
|
- users: true,
|
|
|
|
- anonymous: true
|
|
|
|
- },
|
|
|
|
- searchIndex: {
|
|
|
|
- enabled: true,
|
|
|
|
- url: 'https://search.joinpeertube.org',
|
|
|
|
- disableLocalSearch: true,
|
|
|
|
- isDefaultSearch: true
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- storyboards: {
|
|
|
|
- enabled: true
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- merge(newCustomConfig, options.newConfig)
|
|
|
|
-
|
|
|
|
- return this.updateCustomConfig({ ...options, newCustomConfig })
|
|
|
|
- }
|
|
|
|
}
|
|
}
|