diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-11 10:48:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-05-11 10:53:06 +0200 |
commit | 95cd31f1fe3311c873bee8185e6b07398a775a47 (patch) | |
tree | 0be01dcca9f29309cf74ab575a9efec34b689471 /server | |
parent | 3a1a00a4af866caa96355c6702bbf805685d0973 (diff) | |
download | PeerTube-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.ts | 4 | ||||
-rw-r--r-- | server/tests/api/server/auto-follows.ts | 2 |
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 | } |