Fix pleroma follow
This commit is contained in:
parent
c0e71e849a
commit
c28bcdd10a
|
@ -3,8 +3,7 @@ import { doRequest } from '../../helpers/requests'
|
||||||
import { logger } from '../../helpers/logger'
|
import { logger } from '../../helpers/logger'
|
||||||
import * as Bluebird from 'bluebird'
|
import * as Bluebird from 'bluebird'
|
||||||
import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub'
|
import { ActivityPubOrderedCollection } from '../../../shared/models/activitypub'
|
||||||
import { checkUrlsSameHost } from '../../helpers/activitypub'
|
import { parse } from 'url'
|
||||||
import { parse } from "url"
|
|
||||||
|
|
||||||
type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)
|
type HandlerFunction<T> = (items: T[]) => (Promise<any> | Bluebird<any>)
|
||||||
type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>)
|
type CleanerFunction = (startedDate: Date) => (Promise<any> | Bluebird<any>)
|
||||||
|
|
|
@ -28,7 +28,7 @@ async function buildSignedRequestOptions (payload: Payload) {
|
||||||
actor = await getServerActor()
|
actor = await getServerActor()
|
||||||
}
|
}
|
||||||
|
|
||||||
const keyId = actor.getWebfingerUrl()
|
const keyId = actor.url
|
||||||
return {
|
return {
|
||||||
algorithm: HTTP_SIGNATURE.ALGORITHM,
|
algorithm: HTTP_SIGNATURE.ALGORITHM,
|
||||||
authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,
|
authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,
|
||||||
|
|
|
@ -74,6 +74,8 @@ async function checkHttpSignature (req: Request, res: Response) {
|
||||||
|
|
||||||
const verified = isHTTPSignatureVerified(parsed, actor)
|
const verified = isHTTPSignatureVerified(parsed, actor)
|
||||||
if (verified !== true) {
|
if (verified !== true) {
|
||||||
|
logger.warn('Signature from %s is invalid', actorUrl, { parsed })
|
||||||
|
|
||||||
res.sendStatus(403)
|
res.sendStatus(403)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue