diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-30 16:50:12 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-09-04 16:24:58 +0200 |
commit | 8424c4026afd7304880a4ce8138a04ffb3d8c938 (patch) | |
tree | 5b42625a59307b03333aa7d293b40b4c90da8f73 /shared/extra-utils/server/config.ts | |
parent | f69ec5f340638ef577e8f5b9b1fb844778656a1f (diff) | |
download | PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.gz PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.tar.zst PeerTube-8424c4026afd7304880a4ce8138a04ffb3d8c938.zip |
Add auto follow back support for instances
Diffstat (limited to 'shared/extra-utils/server/config.ts')
-rw-r--r-- | shared/extra-utils/server/config.ts | 17 |
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 @@ | |||
1 | import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' | 1 | import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' |
2 | import { CustomConfig } from '../../models/server/custom-config.model' | 2 | import { CustomConfig } from '../../models/server/custom-config.model' |
3 | import { DeepPartial } from '@server/typings/utils' | ||
4 | import { merge } from 'lodash' | ||
3 | 5 | ||
4 | function getConfig (url: string) { | 6 | function 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 | ||
47 | function updateCustomSubConfig (url: string, token: string, newConfig: any) { | 49 | function 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 | } |