From 8424c4026afd7304880a4ce8138a04ffb3d8c938 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 30 Aug 2019 16:50:12 +0200 Subject: Add auto follow back support for instances --- shared/extra-utils/server/config.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'shared/extra-utils/server') 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 @@ import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' import { CustomConfig } from '../../models/server/custom-config.model' +import { DeepPartial } from '@server/typings/utils' +import { merge } from 'lodash' function getConfig (url: string) { const path = '/api/v1/config' @@ -44,7 +46,7 @@ function updateCustomConfig (url: string, token: string, newCustomConfig: Custom }) } -function updateCustomSubConfig (url: string, token: string, newConfig: any) { +function updateCustomSubConfig (url: string, token: string, newConfig: DeepPartial) { const updateParams: CustomConfig = { instance: { name: 'PeerTube updated', @@ -130,10 +132,21 @@ function updateCustomSubConfig (url: string, token: string, newConfig: any) { enabled: true, manualApproval: false } + }, + followings: { + instance: { + autoFollowBack: { + enabled: false + }, + autoFollowIndex: { + indexUrl: 'https://instances.joinpeertube.org', + enabled: false + } + } } } - Object.assign(updateParams, newConfig) + merge(updateParams, newConfig) return updateCustomConfig(url, token, updateParams) } -- cgit v1.2.3