X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Frequests%2Factivitypub.ts;h=4ae878384bba5543e59ca6bde62a42121b73db32;hb=171efc48e67498406feb6d7873b3482b41505515;hp=4762a8665efc0f6da1025b79e1ea16b36156dc1c;hpb=97567dd81f508dd6295ac4d73d849aa2ce0a6549;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/requests/activitypub.ts b/shared/extra-utils/requests/activitypub.ts index 4762a8665..4ae878384 100644 --- a/shared/extra-utils/requests/activitypub.ts +++ b/shared/extra-utils/requests/activitypub.ts @@ -1,24 +1,23 @@ +import { activityPubContextify } from '../../../server/helpers/activitypub' import { doRequest } from '../../../server/helpers/requests' import { HTTP_SIGNATURE } from '../../../server/initializers/constants' import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' -import { activityPubContextify } from '../../../server/helpers/activitypub' function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { const options = { - method: 'POST', - uri: url, + method: 'POST' as 'POST', json: body, httpSignature, headers } - return doRequest(options) + return doRequest(url, options) } async function makeFollowRequest (to: { url: string }, by: { url: string, privateKey }) { const follow = { type: 'Follow', - id: by.url + '/toto', + id: by.url + '/' + new Date().getTime(), actor: by.url, object: to.url } @@ -34,7 +33,7 @@ async function makeFollowRequest (to: { url: string }, by: { url: string, privat } const headers = buildGlobalHeaders(body) - return makePOSTAPRequest(to.url, body, httpSignature, headers) + return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers) } export {