X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fserver%2Fconfig.ts;h=8998da8b60000960b7dbe9c62dcc4db72c175f39;hb=1896bca09e088b0da9d5e845407ecebae330618c;hp=785421c98d48ce068ae6054b34bd14d8095511b8;hpb=ccc00cb2aac1360921b957f3ecb3be7eb55dfa1b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts index 785421c98..8998da8b6 100644 --- a/shared/extra-utils/server/config.ts +++ b/shared/extra-utils/server/config.ts @@ -1,6 +1,6 @@ import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' import { CustomConfig } from '../../models/server/custom-config.model' -import { DeepPartial } from '@server/typings/utils' +import { DeepPartial, HttpStatusCode } from '@shared/core-utils' import { merge } from 'lodash' function getConfig (url: string) { @@ -9,7 +9,7 @@ function getConfig (url: string) { return makeGetRequest({ url, path, - statusCodeExpected: 200 + statusCodeExpected: HttpStatusCode.OK_200 }) } @@ -19,11 +19,11 @@ function getAbout (url: string) { return makeGetRequest({ url, path, - statusCodeExpected: 200 + statusCodeExpected: HttpStatusCode.OK_200 }) } -function getCustomConfig (url: string, token: string, statusCodeExpected = 200) { +function getCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) { const path = '/api/v1/config/custom' return makeGetRequest({ @@ -34,7 +34,7 @@ function getCustomConfig (url: string, token: string, statusCodeExpected = 200) }) } -function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) { +function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = HttpStatusCode.OK_200) { const path = '/api/v1/config/custom' return makePutBodyRequest({ @@ -55,17 +55,21 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti 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 ], - defaultClientRoute: '/videos/recently-added', isNSFW: true, defaultNSFWPolicy: 'blur', + + defaultClientRoute: '/videos/recently-added', + customizations: { javascript: 'alert("coucou")', css: 'body { background-color: red; }' @@ -108,18 +112,45 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti allowAdditionalExtensions: true, allowAudioFiles: true, threads: 1, + profile: 'default', resolutions: { + '0p': false, '240p': false, '360p': true, '480p': true, '720p': false, '1080p': false, + '1440p': false, '2160p': false }, + webtorrent: { + enabled: true + }, hls: { enabled: false } }, + live: { + enabled: true, + allowReplay: false, + maxDuration: -1, + maxInstanceLives: -1, + maxUserLives: 50, + transcoding: { + enabled: true, + threads: 4, + profile: 'default', + resolutions: { + '240p': true, + '360p': true, + '480p': true, + '720p': true, + '1080p': true, + '1440p': true, + '2160p': true + } + } + }, import: { videos: { http: { @@ -130,6 +161,14 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti } } }, + trending: { + videos: { + algorithms: { + enabled: [ 'hot', 'most-viewed', 'most-liked' ], + default: 'hot' + } + } + }, autoBlacklist: { videos: { ofUsers: { @@ -149,10 +188,28 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti enabled: false }, autoFollowIndex: { - indexUrl: 'https://instances.joinpeertube.org', + 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 + } } } @@ -161,7 +218,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti return updateCustomConfig(url, token, updateParams) } -function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) { +function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) { const path = '/api/v1/config/custom' return makeDeleteRequest({