diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-03 16:02:29 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-03 16:40:32 +0200 |
commit | 136d7efde798d3dc0ec0dd18aac674365f7d162e (patch) | |
tree | 3a0e2a7a5d04dedf0d8ffda99c2787cecb838891 /server/middlewares | |
parent | 49af5ac8c2653cb0ef23479c9d3256c5b724d49d (diff) | |
download | PeerTube-136d7efde798d3dc0ec0dd18aac674365f7d162e.tar.gz PeerTube-136d7efde798d3dc0ec0dd18aac674365f7d162e.tar.zst PeerTube-136d7efde798d3dc0ec0dd18aac674365f7d162e.zip |
Refactor AP actors
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/activitypub.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 6cd23f230..a1fdfafcf 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts | |||
@@ -3,7 +3,7 @@ import { ActivityDelete, ActivityPubSignature } from '../../shared' | |||
3 | import { logger } from '../helpers/logger' | 3 | import { logger } from '../helpers/logger' |
4 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' | 4 | import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' |
5 | import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' | 5 | import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' |
6 | import { getOrCreateActorAndServerAndModel } from '../lib/activitypub/actor' | 6 | import { getOrCreateAPActor } from '../lib/activitypub/actors' |
7 | import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' | 7 | import { loadActorUrlOrGetFromWebfinger } from '../helpers/webfinger' |
8 | import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor' | 8 | import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor' |
9 | import { getAPId } from '@server/helpers/activitypub' | 9 | import { getAPId } from '@server/helpers/activitypub' |
@@ -100,7 +100,7 @@ async function checkHttpSignature (req: Request, res: Response) { | |||
100 | actorUrl = await loadActorUrlOrGetFromWebfinger(actorUrl.replace(/^acct:/, '')) | 100 | actorUrl = await loadActorUrlOrGetFromWebfinger(actorUrl.replace(/^acct:/, '')) |
101 | } | 101 | } |
102 | 102 | ||
103 | const actor = await getOrCreateActorAndServerAndModel(actorUrl) | 103 | const actor = await getOrCreateAPActor(actorUrl) |
104 | 104 | ||
105 | const verified = isHTTPSignatureVerified(parsed, actor) | 105 | const verified = isHTTPSignatureVerified(parsed, actor) |
106 | if (verified !== true) { | 106 | if (verified !== true) { |
@@ -135,7 +135,7 @@ async function checkJsonLDSignature (req: Request, res: Response) { | |||
135 | 135 | ||
136 | logger.debug('Checking JsonLD signature of actor %s...', creator) | 136 | logger.debug('Checking JsonLD signature of actor %s...', creator) |
137 | 137 | ||
138 | const actor = await getOrCreateActorAndServerAndModel(creator) | 138 | const actor = await getOrCreateAPActor(creator) |
139 | const verified = await isJsonLDSignatureVerified(actor, req.body) | 139 | const verified = await isJsonLDSignatureVerified(actor, req.body) |
140 | 140 | ||
141 | if (verified !== true) { | 141 | if (verified !== true) { |