1 import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../'
2 import { CustomConfig } from '../../../../shared/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',
55 defaultNSFWPolicy: 'blur',
57 javascript: 'alert("coucou")',
58 css: 'body { background-color: red; }'
63 username: '@MySuperUsername',
80 email: 'superadmin1@example.com'
84 videoQuotaDaily: 318742
109 Object.assign(updateParams, newConfig)
111 return updateCustomConfig(url, token, updateParams)
114 function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) {
115 const path = '/api/v1/config/custom'
117 return makeDeleteRequest({
125 // ---------------------------------------------------------------------------
133 updateCustomSubConfig