1 import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
2 import { CustomConfig } from '../../models/server/custom-config.model'
4 function getConfig (url: string) {
5 const path = '/api/v1/config'
7 return makeGetRequest({
10 statusCodeExpected: 200
14 function getAbout (url: string) {
15 const path = '/api/v1/config/about'
17 return makeGetRequest({
20 statusCodeExpected: 200
24 function getCustomConfig (url: string, token: string, statusCodeExpected = 200) {
25 const path = '/api/v1/config/custom'
27 return makeGetRequest({
35 function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) {
36 const path = '/api/v1/config/custom'
38 return makePutBodyRequest({
42 fields: newCustomConfig,
47 function updateCustomSubConfig (url: string, token: string, newConfig: any) {
48 const updateParams: CustomConfig = {
50 name: 'PeerTube updated',
51 shortDescription: 'my short description',
52 description: 'my super description',
53 terms: 'my super terms',
54 defaultClientRoute: '/videos/recently-added',
56 defaultNSFWPolicy: 'blur',
58 javascript: 'alert("coucou")',
59 css: 'body { background-color: red; }'
64 username: '@MySuperUsername',
79 requiresEmailVerification: false
82 email: 'superadmin1@example.com'
89 videoQuotaDaily: 318742
93 allowAdditionalExtensions: true,
94 allowAudioFiles: true,
127 manualApproval: false
132 Object.assign(updateParams, newConfig)
134 return updateCustomConfig(url, token, updateParams)
137 function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) {
138 const path = '/api/v1/config/custom'
140 return makeDeleteRequest({
148 // ---------------------------------------------------------------------------
156 updateCustomSubConfig