]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/actors/shared/url-to-object.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / actors / shared / url-to-object.ts
index f4f16b04407655eb6833aa717130109977d3cbcd..12a121725bba8fa5014e747f92fed16e11fa2c00 100644 (file)
@@ -1,9 +1,8 @@
-
-import { checkUrlsSameHost } from '@server/helpers/activitypub'
 import { sanitizeAndCheckActorObject } from '@server/helpers/custom-validators/activitypub/actor'
 import { logger } from '@server/helpers/logger'
 import { doJSONRequest } from '@server/helpers/requests'
 import { ActivityPubActor, ActivityPubOrderedCollection } from '@shared/models'
+import { checkUrlsSameHost } from '../../url'
 
 async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number, actorObject: ActivityPubActor }> {
   logger.info('Fetching remote actor %s.', actorUrl)
@@ -12,12 +11,12 @@ async function fetchRemoteActor (actorUrl: string): Promise<{ statusCode: number
 
   if (sanitizeAndCheckActorObject(body) === false) {
     logger.debug('Remote actor JSON is not valid.', { actorJSON: body })
-    return { actorObject: undefined, statusCode: statusCode }
+    return { actorObject: undefined, statusCode }
   }
 
   if (checkUrlsSameHost(body.id, actorUrl) !== true) {
     logger.warn('Actor url %s has not the same host than its AP id %s', actorUrl, body.id)
-    return { actorObject: undefined, statusCode: statusCode }
+    return { actorObject: undefined, statusCode }
   }
 
   return {
@@ -48,7 +47,7 @@ async function fetchActorTotalItems (url: string) {
 
     return body.totalItems || 0
   } catch (err) {
-    logger.warn('Cannot fetch remote actor count %s.', url, { err })
+    logger.info('Cannot fetch remote actor count %s.', url, { err })
     return 0
   }
 }