aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-10 12:01:21 +0100
committerChocobozzz <me@florianbigard.com>2023-03-10 15:45:52 +0100
commit3b504f6ed4e890bebb46d0481aba15b43050323a (patch)
treebbe4c1bc529fec28e0b46263ec92f7c2260ba65a /server/tests/shared
parent4899138ec5995075c3681ccbd9f6b163fb915991 (diff)
downloadPeerTube-3b504f6ed4e890bebb46d0481aba15b43050323a.tar.gz
PeerTube-3b504f6ed4e890bebb46d0481aba15b43050323a.tar.zst
PeerTube-3b504f6ed4e890bebb46d0481aba15b43050323a.zip
Add ability for plugins to alter video jsonld
Diffstat (limited to 'server/tests/shared')
-rw-r--r--server/tests/shared/requests.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/server/tests/shared/requests.ts b/server/tests/shared/requests.ts
index 57120caca..0cfeab7b2 100644
--- a/server/tests/shared/requests.ts
+++ b/server/tests/shared/requests.ts
@@ -1,7 +1,4 @@
1import { buildDigest } from '@server/helpers/peertube-crypto'
2import { doRequest } from '@server/helpers/requests' 1import { doRequest } from '@server/helpers/requests'
3import { ACTIVITY_PUB, HTTP_SIGNATURE } from '@server/initializers/constants'
4import { activityPubContextify } from '@server/lib/activitypub/context'
5 2
6export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { 3export function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
7 const options = { 4 const options = {
@@ -13,29 +10,3 @@ export function makePOSTAPRequest (url: string, body: any, httpSignature: any, h
13 10
14 return doRequest(url, options) 11 return doRequest(url, options)
15} 12}
16
17export async function makeFollowRequest (to: { url: string }, by: { url: string, privateKey }) {
18 const follow = {
19 type: 'Follow',
20 id: by.url + '/' + new Date().getTime(),
21 actor: by.url,
22 object: to.url
23 }
24
25 const body = activityPubContextify(follow, 'Follow')
26
27 const httpSignature = {
28 algorithm: HTTP_SIGNATURE.ALGORITHM,
29 authorizationHeaderName: HTTP_SIGNATURE.HEADER_NAME,
30 keyId: by.url,
31 key: by.privateKey,
32 headers: HTTP_SIGNATURE.HEADERS_TO_SIGN
33 }
34 const headers = {
35 'digest': buildDigest(body),
36 'content-type': 'application/activity+json',
37 'accept': ACTIVITY_PUB.ACCEPT_HEADER
38 }
39
40 return makePOSTAPRequest(to.url + '/inbox', body, httpSignature, headers)
41}