aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/server
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/server')
-rw-r--r--shared/extra-utils/server/config.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/shared/extra-utils/server/config.ts b/shared/extra-utils/server/config.ts
index 8736f083f..d784af9a9 100644
--- a/shared/extra-utils/server/config.ts
+++ b/shared/extra-utils/server/config.ts
@@ -1,5 +1,7 @@
1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' 1import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
2import { CustomConfig } from '../../models/server/custom-config.model' 2import { CustomConfig } from '../../models/server/custom-config.model'
3import { DeepPartial } from '@server/typings/utils'
4import { merge } from 'lodash'
3 5
4function getConfig (url: string) { 6function getConfig (url: string) {
5 const path = '/api/v1/config' 7 const path = '/api/v1/config'
@@ -44,7 +46,7 @@ function updateCustomConfig (url: string, token: string, newCustomConfig: Custom
44 }) 46 })
45} 47}
46 48
47function updateCustomSubConfig (url: string, token: string, newConfig: any) { 49function updateCustomSubConfig (url: string, token: string, newConfig: DeepPartial<CustomConfig>) {
48 const updateParams: CustomConfig = { 50 const updateParams: CustomConfig = {
49 instance: { 51 instance: {
50 name: 'PeerTube updated', 52 name: 'PeerTube updated',
@@ -130,10 +132,21 @@ function updateCustomSubConfig (url: string, token: string, newConfig: any) {
130 enabled: true, 132 enabled: true,
131 manualApproval: false 133 manualApproval: false
132 } 134 }
135 },
136 followings: {
137 instance: {
138 autoFollowBack: {
139 enabled: false
140 },
141 autoFollowIndex: {
142 indexUrl: 'https://instances.joinpeertube.org',
143 enabled: false
144 }
145 }
133 } 146 }
134 } 147 }
135 148
136 Object.assign(updateParams, newConfig) 149 merge(updateParams, newConfig)
137 150
138 return updateCustomConfig(url, token, updateParams) 151 return updateCustomConfig(url, token, updateParams)
139} 152}