diff options
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 | } |