diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/crawl.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/follow.ts | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/server/lib/activitypub/crawl.ts b/server/lib/activitypub/crawl.ts index cd117f571..28ff5225a 100644 --- a/server/lib/activitypub/crawl.ts +++ b/server/lib/activitypub/crawl.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { retryTransactionWrapper } from '@server/helpers/database-utils' | ||
1 | import * as Bluebird from 'bluebird' | 2 | import * as Bluebird from 'bluebird' |
2 | import { URL } from 'url' | 3 | import { URL } from 'url' |
3 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' | 4 | import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub' |
@@ -51,7 +52,7 @@ async function crawlCollectionPage <T> (argUrl: string, handler: HandlerFunction | |||
51 | } | 52 | } |
52 | } | 53 | } |
53 | 54 | ||
54 | if (cleaner) await cleaner(startDate) | 55 | if (cleaner) await retryTransactionWrapper(cleaner, startDate) |
55 | } | 56 | } |
56 | 57 | ||
57 | export { | 58 | export { |
diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index c1bd667e0..741b54df5 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts | |||
@@ -31,6 +31,21 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transact | |||
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | // If we only have an host, use a default account handle | ||
35 | function getRemoteNameAndHost (handleOrHost: string) { | ||
36 | let name = SERVER_ACTOR_NAME | ||
37 | let host = handleOrHost | ||
38 | |||
39 | const splitted = handleOrHost.split('@') | ||
40 | if (splitted.length === 2) { | ||
41 | name = splitted[0] | ||
42 | host = splitted[1] | ||
43 | } | ||
44 | |||
45 | return { name, host } | ||
46 | } | ||
47 | |||
34 | export { | 48 | export { |
35 | autoFollowBackIfNeeded | 49 | autoFollowBackIfNeeded, |
50 | getRemoteNameAndHost | ||
36 | } | 51 | } |