aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-11 10:48:58 +0200
committerChocobozzz <me@florianbigard.com>2020-05-11 10:53:06 +0200
commit95cd31f1fe3311c873bee8185e6b07398a775a47 (patch)
tree0be01dcca9f29309cf74ab575a9efec34b689471 /server
parent3a1a00a4af866caa96355c6702bbf805685d0973 (diff)
downloadPeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.tar.gz
PeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.tar.zst
PeerTube-95cd31f1fe3311c873bee8185e6b07398a775a47.zip
Allow to auto follow a specific URL
Diffstat (limited to 'server')
-rw-r--r--server/lib/schedulers/auto-follow-index-instances.ts4
-rw-r--r--server/tests/api/server/auto-follows.ts2
2 files changed, 5 insertions, 1 deletions
diff --git a/server/lib/schedulers/auto-follow-index-instances.ts b/server/lib/schedulers/auto-follow-index-instances.ts
index e852c7fc6..a57436a45 100644
--- a/server/lib/schedulers/auto-follow-index-instances.ts
+++ b/server/lib/schedulers/auto-follow-index-instances.ts
@@ -42,6 +42,10 @@ export class AutoFollowIndexInstances extends AbstractScheduler {
42 this.lastCheck = new Date() 42 this.lastCheck = new Date()
43 43
44 const { body } = await doRequest<any>({ uri, qs, json: true }) 44 const { body } = await doRequest<any>({ uri, qs, json: true })
45 if (!body.data || Array.isArray(body.data) === false) {
46 logger.error('Cannot auto follow instances of index %s: bad URL format. Please check the auto follow URL.', indexUrl)
47 return
48 }
45 49
46 const hosts: string[] = body.data.map(o => o.host) 50 const hosts: string[] = body.data.map(o => o.host)
47 const chunks = chunk(hosts, 20) 51 const chunks = chunk(hosts, 20)
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts
index 5f48dc0eb..7efccc3e2 100644
--- a/server/tests/api/server/auto-follows.ts
+++ b/server/tests/api/server/auto-follows.ts
@@ -177,7 +177,7 @@ describe('Test auto follows', function () {
177 followings: { 177 followings: {
178 instance: { 178 instance: {
179 autoFollowIndex: { 179 autoFollowIndex: {
180 indexUrl: 'http://localhost:42100', 180 indexUrl: 'http://localhost:42100/api/v1/instances/hosts',
181 enabled: true 181 enabled: true
182 } 182 }
183 } 183 }