Add admin interface to manage instances subscriptions
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
24
test/fixtures/mastodon-delete-user.json
vendored
Normal file
24
test/fixtures/mastodon-delete-user.json
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"type": "Delete",
|
||||
"object": {
|
||||
"type": "Person",
|
||||
"id": "https://framapiaf.org/users/admin",
|
||||
"atomUri": "https://framapiaf.org/users/admin"
|
||||
},
|
||||
"id": "https://framapiaf.org/users/admin#delete",
|
||||
"actor": "https://framapiaf.org/users/admin",
|
||||
"@context": [
|
||||
{
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"sensitive": "as:sensitive",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"movedTo": "as:movedTo",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"Emoji": "toot:Emoji"
|
||||
}
|
||||
]
|
||||
}
|
||||
29
test/fixtures/mobilizon-join-activity.json
vendored
29
test/fixtures/mobilizon-join-activity.json
vendored
@@ -11,12 +11,31 @@
|
||||
"actor": "http://mobilizon2.test/@admin",
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
"https://litepub.social/litepub/context.jsonld",
|
||||
{
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": "as:movedTo",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"Hashtag": "as:Hashtag"
|
||||
"Hashtag": "as:Hashtag",
|
||||
"category": "sc:category",
|
||||
"ical": "http://www.w3.org/2002/12/cal/ical#",
|
||||
"joinMode": {
|
||||
"@id": "mz:joinMode",
|
||||
"@type": "mz:joinModeType"
|
||||
},
|
||||
"joinModeType": {
|
||||
"@id": "mz:joinModeType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"maximumAttendeeCapacity": "sc:maximumAttendeeCapacity",
|
||||
"mz": "https://joinmobilizon.org/ns#",
|
||||
"repliesModerationOption": {
|
||||
"@id": "mz:repliesModerationOption",
|
||||
"@type": "mz:repliesModerationOptionType"
|
||||
},
|
||||
"repliesModerationOptionType": {
|
||||
"@id": "mz:repliesModerationOptionType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"sc": "http://schema.org#",
|
||||
"uuid": "sc:identifier"
|
||||
}
|
||||
]
|
||||
}
|
||||
29
test/fixtures/mobilizon-leave-activity.json
vendored
29
test/fixtures/mobilizon-leave-activity.json
vendored
@@ -11,12 +11,31 @@
|
||||
"actor": "http://mobilizon2.test/@admin",
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
"https://litepub.social/litepub/context.jsonld",
|
||||
{
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": "as:movedTo",
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"Hashtag": "as:Hashtag"
|
||||
"Hashtag": "as:Hashtag",
|
||||
"category": "sc:category",
|
||||
"ical": "http://www.w3.org/2002/12/cal/ical#",
|
||||
"joinMode": {
|
||||
"@id": "mz:joinMode",
|
||||
"@type": "mz:joinModeType"
|
||||
},
|
||||
"joinModeType": {
|
||||
"@id": "mz:joinModeType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"maximumAttendeeCapacity": "sc:maximumAttendeeCapacity",
|
||||
"mz": "https://joinmobilizon.org/ns#",
|
||||
"repliesModerationOption": {
|
||||
"@id": "mz:repliesModerationOption",
|
||||
"@type": "mz:repliesModerationOptionType"
|
||||
},
|
||||
"repliesModerationOptionType": {
|
||||
"@id": "mz:repliesModerationOptionType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"sc": "http://schema.org#",
|
||||
"uuid": "sc:identifier"
|
||||
}
|
||||
]
|
||||
}
|
||||
25
test/fixtures/mobilizon-post-activity.json
vendored
25
test/fixtures/mobilizon-post-activity.json
vendored
@@ -1,13 +1,30 @@
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
"https://litepub.social/litepub/context.jsonld",
|
||||
{
|
||||
"mblzn": "https://joinmobilizon.org/ns#",
|
||||
"Hashtag": "as:Hashtag",
|
||||
"category": "sc:category",
|
||||
"ical": "http://www.w3.org/2002/12/cal/ical#",
|
||||
"joinMode": {
|
||||
"@id": "mz:joinMode",
|
||||
"@type": "mz:joinModeType"
|
||||
},
|
||||
"joinModeType": {
|
||||
"@id": "mz:joinModeType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"maximumAttendeeCapacity": "sc:maximumAttendeeCapacity",
|
||||
"mz": "https://joinmobilizon.org/ns#",
|
||||
"repliesModerationOption": {
|
||||
"@id": "mz:repliesModerationOption",
|
||||
"@type": "mz:repliesModerationOptionType"
|
||||
},
|
||||
"repliesModerationOptionType": {
|
||||
"@id": "mz:repliesModerationOptionType",
|
||||
"@type": "rdfs:Class"
|
||||
},
|
||||
"sc": "http://schema.org#",
|
||||
"Place": "sc:Place",
|
||||
"PostalAddress": "sc:PostalAddress",
|
||||
"uuid": "sc:identifier"
|
||||
}
|
||||
],
|
||||
|
||||
116
test/fixtures/vcr_cassettes/activity_pub/activity_object_bogus.json
vendored
Normal file
116
test/fixtures/vcr_cassettes/activity_pub/activity_object_bogus.json
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://framapiaf.org/users/admin"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}",
|
||||
"headers": {
|
||||
"Date": "Sun, 15 Dec 2019 20:24:11 GMT",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Connection": "keep-alive",
|
||||
"Server": "Mastodon",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Vary": "Accept, Accept-Encoding, Origin",
|
||||
"Cache-Control": "max-age=180, public",
|
||||
"ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"",
|
||||
"Set-Cookie": "_mastodon_session=XoZzbDOQtPbBNtbz7WoWZ4ZHTySKGQUeb1Hl3%2BxqZV%2FvxVEOMGMjKArqNF%2F78EJaF5TS%2FKcHPhwonEfsI5cz--jZG8CkvbBBmaJMDx--WRqeW2u0rVAHoNKcMNfLYA%3D%3D; path=/; secure; HttpOnly",
|
||||
"X-Request-Id": "2a29bc1c-9dc8-4e36-b6d5-106c2f649959",
|
||||
"X-Runtime": "0.012324",
|
||||
"X-Cached": "MISS",
|
||||
"Strict-Transport-Security": "max-age=31536000"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:11 GMT",
|
||||
"Signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) date host\",signature=\"C6AGJG5xDdDBYfoAgBaL0iG0/Ru9qpvUij5vvONxJJpcjwc4LIePLaCid4LWK4aiY/z67M+LgopmD7xRn2Qht+Cyu3Kh38t5dS8EI0RWR4JesRyBauCZpzbRJG2w5SES4BPt53+5AuvPZZ81BBgPYF4A7ITBn550NLocesuFFsJJZHwfNqRCUm4cmx57/tnLBr0S4w/VDn6iQ3TBSlXdUJ7N9Za9y7p+vfkFT2PqSXu55HdWLX5NvaiVl2m7JKBCxCrB3i4Lr/Og5bsKhi6LiUoc7Lp0LX1tNftp6NOGgBIo0982NQ0v2jGsMj+eGU2stDl6bz3Z9SRnyyxirz+fag==\""
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true",
|
||||
"recv_timeout": 20000,
|
||||
"connect_timeout": 10000
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://info.pleroma.site/activity.json"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\n \"@context\": \"https://www.w3.org/ns/activitystreams\",\n \"actor\": \"https://queer.hacktivis.me/users/lanodan\",\n \"announcement_count\": 3,\n \"announcements\": [\n \"https://io.markegli.com/users/mark\",\n \"https://voluntaryism.club/users/sevvie\",\n \"https://pleroma.pla1.net/users/pla\"\n ],\n \"attachment\": [],\n \"attributedTo\": \"https://queer.hacktivis.me/users/lanodan\",\n \"content\": \"<p>this post was not actually written by Haelwenn</p>\",\n \"id\": \"https://info.pleroma.site/activity.json\",\n \"published\": \"2018-09-01T22:15:00Z\",\n \"tag\": [],\n \"to\": [\n \"https://www.w3.org/ns/activitystreams#Public\"\n ],\n \"type\": \"Note\"\n}\n",
|
||||
"headers": {
|
||||
"Server": "nginx",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:11 GMT",
|
||||
"Content-Type": "application/json",
|
||||
"Content-Length": "750",
|
||||
"Last-Modified": "Sat, 01 Sep 2018 22:56:24 GMT",
|
||||
"Connection": "keep-alive",
|
||||
"ETag": "\"5b8b1918-2ee\"",
|
||||
"Accept-Ranges": "bytes"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://queer.hacktivis.me/users/lanodan"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://queer.hacktivis.me/schemas/litepub-0.1.jsonld\",{\"@language\":\"und\"}],\"attachment\":[],\"discoverable\":false,\"endpoints\":{\"oauthAuthorizationEndpoint\":\"https://queer.hacktivis.me/oauth/authorize\",\"oauthRegistrationEndpoint\":\"https://queer.hacktivis.me/api/v1/apps\",\"oauthTokenEndpoint\":\"https://queer.hacktivis.me/oauth/token\",\"sharedInbox\":\"https://queer.hacktivis.me/inbox\",\"uploadMedia\":\"https://queer.hacktivis.me/api/ap/upload_media\"},\"followers\":\"https://queer.hacktivis.me/users/lanodan/followers\",\"following\":\"https://queer.hacktivis.me/users/lanodan/following\",\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/media/c8e81887-7d81-4cdc-91b3-c624ea79e6c9/425f089961270eff91b66d45f8faeeb12a725a5f87a6a52bfc54c43bd89f5fe9.png\"},\"id\":\"https://queer.hacktivis.me/users/lanodan\",\"image\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/media/37b6ce56-8c24-4e64-bd70-a76e84ab0c69/53a48a3a49ed5e5637a84e4f3663df17f8d764244bbc1027ba03cfc446e8b7bd.jpg\"},\"inbox\":\"https://queer.hacktivis.me/users/lanodan/inbox\",\"manuallyApprovesFollowers\":true,\"name\":\"Haelwenn /ɛlwən/ 🐺\",\"outbox\":\"https://queer.hacktivis.me/users/lanodan/outbox\",\"preferredUsername\":\"lanodan\",\"publicKey\":{\"id\":\"https://queer.hacktivis.me/users/lanodan#main-key\",\"owner\":\"https://queer.hacktivis.me/users/lanodan\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWOgdjSMc010qvxC3njI\\nXJlFWMJ5gJ8QXCW/PajYdsHPM6d+jxBNJ6zp9/tIRa2m7bWHTSkuHQ7QthOpt6vu\\n+dAWpKRLS607SPLItn/qUcyXvgN+H8shfyhMxvkVs9jXdtlBsLUVE7UNpN0dxzqe\\nI79QWbf7o4amgaIWGRYB+OYMnIxKt+GzIkivZdSVSYjfxNnBYkMCeUxm5EpPIxKS\\nP5bBHAVRRambD5NUmyKILuC60/rYuc/C+vmgpY2HCWFS2q6o34dPr9enwL6t4b3m\\nS1t/EJHk9rGaaDqSGkDEfyQI83/7SDebWKuETMKKFLZi1vMgQIFuOYCIhN6bIiZm\\npQIDAQAB\\n-----END PUBLIC KEY-----\\n\\n\"},\"summary\":\"---<br>Website: <a href=\\\"https://hacktivis.me/\\\">https://hacktivis.me/</a><br>Pronouns: she/fae, elle/iel<br>Lang: en, fr, (LSF), ...<br>```<br>🦊🦄⚧🂡ⓥ :anarchy: 👿🐧 :gentoo:<br>Pleroma dev (backend, mastofe)<br><br>banner from: <a href=\\\"https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db\\\">https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db</a><br>Federation-bots: <a class='hashtag' data-tag='nobot' href='https://queer.hacktivis.me/tag/nobot' rel='tag'>#nobot</a>\",\"tag\":[{\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/emoji/custom/symbols/anarchy.png\"},\"name\":\":anarchy:\",\"type\":\"Emoji\"},{\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/emoji/custom/gentoo.png\"},\"name\":\":gentoo:\",\"type\":\"Emoji\"}],\"type\":\"Person\",\"url\":\"https://queer.hacktivis.me/users/lanodan\"}",
|
||||
"headers": {
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:12 GMT",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Content-Length": "2693",
|
||||
"Connection": "keep-alive",
|
||||
"Keep-Alive": "timeout=20",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "Link,X-RateLimit-Reset,X-RateLimit-Limit,X-RateLimit-Remaining,X-Request-Id,Idempotency-Key",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"content-security-policy": "default-src 'none'; base-uri 'self'; frame-ancestors 'none'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; manifest-src 'self'; connect-src 'self' https://queer.hacktivis.me wss://queer.hacktivis.me; script-src 'self'; upgrade-insecure-requests;",
|
||||
"expect-ct": "enforce, max-age=2592000",
|
||||
"referrer-policy": "no-referrer",
|
||||
"strict-transport-security": "max-age=31536000; includeSubDomains",
|
||||
"x-content-type-options": "nosniff",
|
||||
"x-download-options": "noopen",
|
||||
"x-frame-options": "DENY",
|
||||
"x-permitted-cross-domain-policies": "none",
|
||||
"x-request-id": "FeClJfdJwAn7WY0ABtmh",
|
||||
"x-xss-protection": "1; mode=block"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
78
test/fixtures/vcr_cassettes/activity_pub/object_bogus_origin.json
vendored
Normal file
78
test/fixtures/vcr_cassettes/activity_pub/object_bogus_origin.json
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:06 GMT",
|
||||
"Signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) date host\",signature=\"kUYhmOSdg7kxApgTCEj1CZLwOGn31sLbPdU35xu6Y5f/I3oT65g6KYlzuvchfQTrJ0XTzdzdSpQ5ZC/Y5dQEZrc3yzGw0KOmpSFfDcbtLw0I4Ya3vRjvuw0cDsPUwxoKpW1FqkMIEXP2lTXV/Bywc2rWCytnttiJwoQdeTvPDigmCCLxo2+wNMshl169HjAjYT9T8O0ptlgZXZ+JPuuaMj6EcSnXJDAkDxdBo54D61ED+dIIDxRKJsCTDrnjvZ86E9Z/P8SIbQxPZNw+TpLeofFTi/xt0E42M76iOEk41+kKlWQBd4imwoJesYEU+7CsMRtttt7wK9hMqcQC4UCa8g==\""
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true",
|
||||
"recv_timeout": 20000,
|
||||
"connect_timeout": 10000
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://info.pleroma.site/activity.json"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\n \"@context\": \"https://www.w3.org/ns/activitystreams\",\n \"actor\": \"https://queer.hacktivis.me/users/lanodan\",\n \"announcement_count\": 3,\n \"announcements\": [\n \"https://io.markegli.com/users/mark\",\n \"https://voluntaryism.club/users/sevvie\",\n \"https://pleroma.pla1.net/users/pla\"\n ],\n \"attachment\": [],\n \"attributedTo\": \"https://queer.hacktivis.me/users/lanodan\",\n \"content\": \"<p>this post was not actually written by Haelwenn</p>\",\n \"id\": \"https://info.pleroma.site/activity.json\",\n \"published\": \"2018-09-01T22:15:00Z\",\n \"tag\": [],\n \"to\": [\n \"https://www.w3.org/ns/activitystreams#Public\"\n ],\n \"type\": \"Note\"\n}\n",
|
||||
"headers": {
|
||||
"Server": "nginx",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:07 GMT",
|
||||
"Content-Type": "application/json",
|
||||
"Content-Length": "750",
|
||||
"Last-Modified": "Sat, 01 Sep 2018 22:56:24 GMT",
|
||||
"Connection": "keep-alive",
|
||||
"ETag": "\"5b8b1918-2ee\"",
|
||||
"Accept-Ranges": "bytes"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://queer.hacktivis.me/users/lanodan"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://queer.hacktivis.me/schemas/litepub-0.1.jsonld\",{\"@language\":\"und\"}],\"attachment\":[],\"discoverable\":false,\"endpoints\":{\"oauthAuthorizationEndpoint\":\"https://queer.hacktivis.me/oauth/authorize\",\"oauthRegistrationEndpoint\":\"https://queer.hacktivis.me/api/v1/apps\",\"oauthTokenEndpoint\":\"https://queer.hacktivis.me/oauth/token\",\"sharedInbox\":\"https://queer.hacktivis.me/inbox\",\"uploadMedia\":\"https://queer.hacktivis.me/api/ap/upload_media\"},\"followers\":\"https://queer.hacktivis.me/users/lanodan/followers\",\"following\":\"https://queer.hacktivis.me/users/lanodan/following\",\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/media/c8e81887-7d81-4cdc-91b3-c624ea79e6c9/425f089961270eff91b66d45f8faeeb12a725a5f87a6a52bfc54c43bd89f5fe9.png\"},\"id\":\"https://queer.hacktivis.me/users/lanodan\",\"image\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/media/37b6ce56-8c24-4e64-bd70-a76e84ab0c69/53a48a3a49ed5e5637a84e4f3663df17f8d764244bbc1027ba03cfc446e8b7bd.jpg\"},\"inbox\":\"https://queer.hacktivis.me/users/lanodan/inbox\",\"manuallyApprovesFollowers\":true,\"name\":\"Haelwenn /ɛlwən/ 🐺\",\"outbox\":\"https://queer.hacktivis.me/users/lanodan/outbox\",\"preferredUsername\":\"lanodan\",\"publicKey\":{\"id\":\"https://queer.hacktivis.me/users/lanodan#main-key\",\"owner\":\"https://queer.hacktivis.me/users/lanodan\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWOgdjSMc010qvxC3njI\\nXJlFWMJ5gJ8QXCW/PajYdsHPM6d+jxBNJ6zp9/tIRa2m7bWHTSkuHQ7QthOpt6vu\\n+dAWpKRLS607SPLItn/qUcyXvgN+H8shfyhMxvkVs9jXdtlBsLUVE7UNpN0dxzqe\\nI79QWbf7o4amgaIWGRYB+OYMnIxKt+GzIkivZdSVSYjfxNnBYkMCeUxm5EpPIxKS\\nP5bBHAVRRambD5NUmyKILuC60/rYuc/C+vmgpY2HCWFS2q6o34dPr9enwL6t4b3m\\nS1t/EJHk9rGaaDqSGkDEfyQI83/7SDebWKuETMKKFLZi1vMgQIFuOYCIhN6bIiZm\\npQIDAQAB\\n-----END PUBLIC KEY-----\\n\\n\"},\"summary\":\"---<br>Website: <a href=\\\"https://hacktivis.me/\\\">https://hacktivis.me/</a><br>Pronouns: she/fae, elle/iel<br>Lang: en, fr, (LSF), ...<br>```<br>🦊🦄⚧🂡ⓥ :anarchy: 👿🐧 :gentoo:<br>Pleroma dev (backend, mastofe)<br><br>banner from: <a href=\\\"https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db\\\">https://soc.flyingcube.tech/objects/56f79be2-9013-4559-9826-f7dc392417db</a><br>Federation-bots: <a class='hashtag' data-tag='nobot' href='https://queer.hacktivis.me/tag/nobot' rel='tag'>#nobot</a>\",\"tag\":[{\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/emoji/custom/symbols/anarchy.png\"},\"name\":\":anarchy:\",\"type\":\"Emoji\"},{\"icon\":{\"type\":\"Image\",\"url\":\"https://queer.hacktivis.me/emoji/custom/gentoo.png\"},\"name\":\":gentoo:\",\"type\":\"Emoji\"}],\"type\":\"Person\",\"url\":\"https://queer.hacktivis.me/users/lanodan\"}",
|
||||
"headers": {
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Sun, 15 Dec 2019 20:24:07 GMT",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Content-Length": "2693",
|
||||
"Connection": "keep-alive",
|
||||
"Keep-Alive": "timeout=20",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "Link,X-RateLimit-Reset,X-RateLimit-Limit,X-RateLimit-Remaining,X-Request-Id,Idempotency-Key",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"content-security-policy": "default-src 'none'; base-uri 'self'; frame-ancestors 'none'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; manifest-src 'self'; connect-src 'self' https://queer.hacktivis.me wss://queer.hacktivis.me; script-src 'self'; upgrade-insecure-requests;",
|
||||
"expect-ct": "enforce, max-age=2592000",
|
||||
"referrer-policy": "no-referrer",
|
||||
"strict-transport-security": "max-age=31536000; includeSubDomains",
|
||||
"x-content-type-options": "nosniff",
|
||||
"x-download-options": "noopen",
|
||||
"x-frame-options": "DENY",
|
||||
"x-permitted-cross-domain-policies": "none",
|
||||
"x-request-id": "FeClJPRE1U5AcP8ABtkB",
|
||||
"x-xss-protection": "1; mode=block"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
39
test/fixtures/vcr_cassettes/activity_pub/signature/invalid_not_found.json
vendored
Normal file
39
test/fixtures/vcr_cassettes/activity_pub/signature/invalid_not_found.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://niu.moe/users/rye"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://niu.moe/users/rye\",\"type\":\"Person\",\"following\":\"https://niu.moe/users/rye/following\",\"followers\":\"https://niu.moe/users/rye/followers\",\"inbox\":\"https://niu.moe/users/rye/inbox\",\"outbox\":\"https://niu.moe/users/rye/outbox\",\"featured\":\"https://niu.moe/users/rye/collections/featured\",\"preferredUsername\":\"rye\",\"name\":\"♡ rye ♡\",\"summary\":\"\\u003cp\\u003eicon from \\u003ca href=\\\"https://twitter.com/_nitronic/status/1137776178687725568\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"ellipsis\\\"\\u003etwitter.com/_nitronic/status/1\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e137776178687725568\\u003c/span\\u003e\\u003c/a\\u003e くコ:彡\\u003c/p\\u003e\\u003cp\\u003eCome back with a warrant\\u003c/p\\u003e\",\"url\":\"https://niu.moe/@rye\",\"manuallyApprovesFollowers\":false,\"discoverable\":false,\"publicKey\":{\"id\":\"https://niu.moe/users/rye#main-key\",\"owner\":\"https://niu.moe/users/rye\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA83uRWjCFO35FwfA38mzv\\nEL0TUaXB7+2hYvPwNrn1WY6me5DRbqB5zzMrzWMGr0HSooqNqEYBafGsmVTWUqIk\\nKM9ehtIBraJI+mT5X7DPR3LrXOJF4a9EEslg8XvAk8MN9IrAhm6UljnvB67RtDcA\\nTNB01VWy9yWnxFRtz9o/EMoBPyw5giOaXE2ibVNP8lQIqGKuuBKPzPjSJygdvQ5q\\nxfow2z1TpKRqdsNDqn4n6U6zCXYTzkr0J71/tGw7fsgfv78l0Wjrc7EcuBk74OaG\\nC65UDiu3X4Q6kxCfCEhPSfuwLN+UZkzxcn6goWR0iYpWs57+4tFKu9nJYP4QJ0K9\\nTwIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[],\"endpoints\":{\"sharedInbox\":\"https://niu.moe/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/png\",\"url\":\"https://cdn.niu.moe/accounts/avatars/000/033/323/original/e4d637b2c8755a7e.png\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://cdn.niu.moe/accounts/headers/000/033/323/original/cc89e1bc66b99a65.jpeg\"}}",
|
||||
"headers": {
|
||||
"Cache-Control": "max-age=180, public",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Date": "Fri, 06 Dec 2019 10:26:01 GMT",
|
||||
"Etag": "W/\"b3c2a8220a20671e8ca5c7e3371e7f5a\"",
|
||||
"Server": "Caddy",
|
||||
"Set-Cookie": "_mastodon_session=lSwFzD6GF6%2FjEL7hWLHU61n7%2B8kC60xvZYlPZG8EBtcndPzfd2%2B976zDOf1ALGZkvqj3CdpYHbZyq%2B7cwfkX--Ut%2BKGA8YibOTCEhb--a0sE5cHGI5PicAmO2yDlZw%3D%3D; path=/; secure; HttpOnly",
|
||||
"Strict-Transport-Security": "max-age=31536000",
|
||||
"Vary": "Accept, Accept-Encoding, Origin",
|
||||
"X-Cached": "MISS",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-Request-Id": "0cc18bab-2d72-47b2-8778-8646402e1148",
|
||||
"X-Runtime": "0.009213",
|
||||
"X-Xss-Protection": "1; mode=block",
|
||||
"Transfer-Encoding": "chunked"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
39
test/fixtures/vcr_cassettes/activity_pub/signature/invalid_payload.json
vendored
Normal file
39
test/fixtures/vcr_cassettes/activity_pub/signature/invalid_payload.json
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://niu.moe/users/rye"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://niu.moe/users/rye\",\"type\":\"Person\",\"following\":\"https://niu.moe/users/rye/following\",\"followers\":\"https://niu.moe/users/rye/followers\",\"inbox\":\"https://niu.moe/users/rye/inbox\",\"outbox\":\"https://niu.moe/users/rye/outbox\",\"featured\":\"https://niu.moe/users/rye/collections/featured\",\"preferredUsername\":\"rye\",\"name\":\"♡ rye ♡\",\"summary\":\"\\u003cp\\u003eicon from \\u003ca href=\\\"https://twitter.com/_nitronic/status/1137776178687725568\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"ellipsis\\\"\\u003etwitter.com/_nitronic/status/1\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e137776178687725568\\u003c/span\\u003e\\u003c/a\\u003e くコ:彡\\u003c/p\\u003e\\u003cp\\u003eCome back with a warrant\\u003c/p\\u003e\",\"url\":\"https://niu.moe/@rye\",\"manuallyApprovesFollowers\":false,\"discoverable\":false,\"publicKey\":{\"id\":\"https://niu.moe/users/rye#main-key\",\"owner\":\"https://niu.moe/users/rye\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA83uRWjCFO35FwfA38mzv\\nEL0TUaXB7+2hYvPwNrn1WY6me5DRbqB5zzMrzWMGr0HSooqNqEYBafGsmVTWUqIk\\nKM9ehtIBraJI+mT5X7DPR3LrXOJF4a9EEslg8XvAk8MN9IrAhm6UljnvB67RtDcA\\nTNB01VWy9yWnxFRtz9o/EMoBPyw5giOaXE2ibVNP8lQIqGKuuBKPzPjSJygdvQ5q\\nxfow2z1TpKRqdsNDqn4n6U6zCXYTzkr0J71/tGw7fsgfv78l0Wjrc7EcuBk74OaG\\nC65UDiu3X4Q6kxCfCEhPSfuwLN+UZkzxcn6goWR0iYpWs57+4tFKu9nJYP4QJ0K9\\nTwIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[],\"endpoints\":{\"sharedInbox\":\"https://niu.moe/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/png\",\"url\":\"https://cdn.niu.moe/accounts/avatars/000/033/323/original/e4d637b2c8755a7e.png\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://cdn.niu.moe/accounts/headers/000/033/323/original/cc89e1bc66b99a65.jpeg\"}}",
|
||||
"headers": {
|
||||
"Cache-Control": "max-age=180, public",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Date": "Fri, 06 Dec 2019 10:26:00 GMT",
|
||||
"Etag": "W/\"06011deced02514fa9adc61bf61ed2fd\"",
|
||||
"Server": "Caddy",
|
||||
"Set-Cookie": "_mastodon_session=n67ChnKe59aqgHL9yq2ReOf2DXDK7c54n49moftpN5s3c6AJpyJ9QZUH31wz0eyDiSiHHw4A6IgzpkrhvSF0--Gm%2FvZr27eWvDBh23--BROo3uKkLhfRDQgszEDO3w%3D%3D; path=/; secure; HttpOnly",
|
||||
"Strict-Transport-Security": "max-age=31536000",
|
||||
"Vary": "Accept, Accept-Encoding, Origin",
|
||||
"X-Cached": "MISS",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-Request-Id": "acee93a9-4da7-4495-bf03-ae7113c50b43",
|
||||
"X-Runtime": "0.016198",
|
||||
"X-Xss-Protection": "1; mode=block",
|
||||
"Transfer-Encoding": "chunked"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
40
test/fixtures/vcr_cassettes/activity_pub/signature/valid.json
vendored
Normal file
40
test/fixtures/vcr_cassettes/activity_pub/signature/valid.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://framapiaf.org/users/admin"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}",
|
||||
"headers": {
|
||||
"Date": "Fri, 06 Dec 2019 10:25:59 GMT",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Connection": "keep-alive",
|
||||
"Server": "Mastodon",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Vary": "Accept, Accept-Encoding, Origin",
|
||||
"Cache-Control": "max-age=180, public",
|
||||
"ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"",
|
||||
"Set-Cookie": "_mastodon_session=2qQRsid4lIe3JZJLG3ZxxfaDP4XDPsKEtqr9Bf3tljCQUEYrQZtQ44k74K1S1VeO3d2O2ztK7eafBlOx0KGQ--FK4A%2Bp1X4tvqnhba--KDpnaRQfBtiHOWhqW7ECEg%3D%3D; path=/; secure; HttpOnly",
|
||||
"X-Request-Id": "c70d5224-5f9a-481a-a6d0-b817b0054be9",
|
||||
"X-Runtime": "0.004654",
|
||||
"X-Cached": "MISS",
|
||||
"Strict-Transport-Security": "max-age=31536000"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
40
test/fixtures/vcr_cassettes/activity_pub/signature/valid_payload.json
vendored
Normal file
40
test/fixtures/vcr_cassettes/activity_pub/signature/valid_payload.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/activity+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "https://framapiaf.org/users/admin"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"toot\":\"http://joinmastodon.org/ns#\",\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"alsoKnownAs\":{\"@id\":\"as:alsoKnownAs\",\"@type\":\"@id\"},\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\",\"IdentityProof\":\"toot:IdentityProof\",\"discoverable\":\"toot:discoverable\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"}}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Service\",\"following\":\"https://framapiaf.org/users/admin/following\",\"followers\":\"https://framapiaf.org/users/admin/followers\",\"inbox\":\"https://framapiaf.org/users/admin/inbox\",\"outbox\":\"https://framapiaf.org/users/admin/outbox\",\"featured\":\"https://framapiaf.org/users/admin/collections/featured\",\"preferredUsername\":\"admin\",\"name\":\"Administrateur\",\"summary\":\"\\u003cp\\u003eJe ne suis qu\\u0026apos;un compte inutile. Merci nous de contacter via \\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"discoverable\":null,\"publicKey\":{\"id\":\"https://framapiaf.org/users/admin#main-key\",\"owner\":\"https://framapiaf.org/users/admin\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyHaU/AZ5dWtSxZXkPa89\\nDUQ4z+JQHGGUG/xkGuq0v8P6qJfQqtHPBO5vH0IQJqluXWQS96gqTwjZnYevcpNA\\nveYv0K25DWszx5Ehz6JX2/sSvu2rNUcQ3YZvSjdo/Yy1u5Fuc5lLmvw8uFzXYekD\\nWovTMOnp4mIKpVEm/G/v4w8jvFEKw88h743vwaEIim88GEQItMxzGAV6zSqV1DWO\\nLxtoRsinslJYfAG46ex4YUATFveWvOUeWk5W1sEa5f3c0moaTmBM/PAAo8vLxhlw\\nJhsHihsCH+BcXKVMjW8OCqYYqISMxEifUBX63HcJt78ELHpOuc1c2eG59PomtTjQ\\nywIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"News\",\"value\":\"\\u003cspan class=\\\"h-card\\\"\\u003e\\u003ca href=\\\"https://framapiaf.org/@Framasoft\\\" class=\\\"u-url mention\\\"\\u003e@\\u003cspan\\u003eFramasoft\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/span\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Support\",\"value\":\"\\u003ca href=\\\"https://contact.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003econtact.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Soutenir\",\"value\":\"\\u003ca href=\\\"https://soutenir.framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003esoutenir.framasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://framasoft.org/\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframasoft.org/\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.s3.framasoft.org/framapiaf/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg\"}}",
|
||||
"headers": {
|
||||
"Date": "Fri, 06 Dec 2019 10:25:59 GMT",
|
||||
"Content-Type": "application/activity+json; charset=utf-8",
|
||||
"Transfer-Encoding": "chunked",
|
||||
"Connection": "keep-alive",
|
||||
"Server": "Mastodon",
|
||||
"X-Frame-Options": "DENY",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-XSS-Protection": "1; mode=block",
|
||||
"Vary": "Accept, Accept-Encoding, Origin",
|
||||
"Cache-Control": "max-age=180, public",
|
||||
"ETag": "W/\"773e09a2a60446fe74d997858877f7e0\"",
|
||||
"Set-Cookie": "_mastodon_session=U%2BUwfKRPF9LVzxKAjxaywz3ySEufApGuEhddpwvpJm7%2B0cDzsW0%2Fn64%2FwOLOYuE9SLOTCjU4Ufc3yaoLvdKx--x1HVRQfU7bAeHgaF--IV9oyi7ODNo19cAi%2FULzew%3D%3D; path=/; secure; HttpOnly",
|
||||
"X-Request-Id": "f36578b7-2f1a-49d1-b2c4-0cc0d652160b",
|
||||
"X-Runtime": "0.010705",
|
||||
"X-Cached": "MISS",
|
||||
"Strict-Transport-Security": "max-age=31536000"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,4 +1,36 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Accept": "application/json, application/activity+json, application/jrd+json"
|
||||
},
|
||||
"method": "get",
|
||||
"options": {
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://mobilizon1.com/.well-known/webfinger?resource=acct:relay@mobilizon1.com"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"aliases\":[\"http://mobilizon1.com/relay\"],\"links\":[{\"href\":\"http://mobilizon1.com/relay\",\"rel\":\"self\",\"type\":\"application/activity+json\"},{\"href\":\"http://mobilizon1.com/relay\",\"rel\":\"https://webfinger.net/rel/profile-page/\",\"type\":\"text/html\"}],\"subject\":\"acct:relay@mobilizon1.com\"}",
|
||||
"headers": {
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:40 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Content-Length": "284",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7OtPJ28p8-MAAAOh"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "",
|
||||
@@ -10,16 +42,22 @@
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://localhost:8080/actor"
|
||||
"url": "http://mobilizon1.com/relay"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\": \"https://www.w3.org/ns/activitystreams\", \"endpoints\": {\"sharedInbox\": \"http://localhost:8080/inbox\"}, \"followers\": \"http://localhost:8080/followers\", \"following\": \"http://localhost:8080/following\", \"inbox\": \"http://localhost:8080/inbox\", \"name\": \"ActivityRelay\", \"type\": \"Application\", \"id\": \"http://localhost:8080/actor\", \"publicKey\": {\"id\": \"http://localhost:8080/actor#main-key\", \"owner\": \"http://localhost:8080/actor\", \"publicKeyPem\": \"-----BEGIN PUBLIC KEY-----\\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvs6UuAo26Sb3BiOK7xay\\nsBzqvXI3xd55JAP0pAk2faF+Vl3r67/g9MoND96JqCVMuzSJZ9oSsqa6ilJCxG3p\\nXUUfQUvqAMGW49cCvga86DG17Ennjbc4C6WIQtoW3Wm5OdDciPY2Dx+pSXdTOajB\\nFX6RHUZcgqHENrsm3jPZI138e/2OJeqdxv4/5t2xdPXEpWdPGitX9AJhrqPY4lzg\\nzQ9Y9wS2eS1CVL9vZZRf9Z4RiZvAfVb0s1iS/IUxrf4TYERRFJxEoDLD2SZVrkq6\\nvhGldCfw2ZnfTftA1ToXguC9S6nSaz+li0ajNjpK/xjZjlKvn0I078UPPe5LUlsb\\nUcYZvBx5PC5rV8yKMLlgxnTY8PqC8LEVc453wO7Ai4M5TeB0SUyEycZHSyLfvQXV\\nThEN/07u1UaJViY3U5S/SihyoCQUfJXQ3jx2SjGgM32/aJ3IwxgveLaTsaZ0VVKM\\nbawEFw6iAcWYM06hZSB6j6dkL1xh+FYGEQTPMYMqUOJi2r1cD8yMLe8dTFOmwMLt\\nBnf7xxvnjKJcv3e9zGRWIdLkQbBQn3BEuRTCUMgljipxdjbeE5/JSP1kQLB94ncb\\nb9gvYgtemJKvT8m37+HOi9MI4BMIlDwpRWjqPZmkNvkegR/1KPjJSsyAnGdd89ne\\np442vUqPyXIq0tSCDmjmU+cCAwEAAQ==\\n-----END PUBLIC KEY-----\"}, \"summary\": \"ActivityRelay bot\", \"preferredUsername\": \"relay\", \"url\": \"http://localhost:8080/actor\"}",
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.social/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"ical\":\"http://www.w3.org/2002/12/cal/ical#\",\"joinMode\":{\"@id\":\"mz:joinMode\",\"@type\":\"mz:joinModeType\"},\"joinModeType\":{\"@id\":\"mz:joinModeType\",\"@type\":\"rdfs:Class\"},\"maximumAttendeeCapacity\":\"sc:maximumAttendeeCapacity\",\"mz\":\"https://joinmobilizon.org/ns#\",\"repliesModerationOption\":{\"@id\":\"mz:repliesModerationOption\",\"@type\":\"mz:repliesModerationOptionType\"},\"repliesModerationOptionType\":{\"@id\":\"mz:repliesModerationOptionType\",\"@type\":\"rdfs:Class\"},\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"endpoints\":{\"sharedInbox\":\"http://mobilizon1.com/inbox\"},\"followers\":\"http://mobilizon1.com/relay/followers\",\"following\":\"http://mobilizon1.com/relay/following\",\"id\":\"http://mobilizon1.com/relay\",\"inbox\":\"http://mobilizon1.com/inbox\",\"manuallyApprovesFollowers\":false,\"name\":\"Mobilizon\",\"outbox\":null,\"preferredUsername\":\"relay\",\"publicKey\":{\"id\":\"http://mobilizon1.com/relay#main-key\",\"owner\":\"http://mobilizon1.com/relay\",\"publicKeyPem\":\"-----BEGIN RSA PUBLIC KEY-----\\nMIIBCgKCAQEAqBbeHMV5UVw0AIVch7fWDp2it5rqbGZX6yXPYnnT8LHhdvfv3DFk\\npk74BN66MzNqsthvSVznu2BEil0sEKD5rQoE9Yirhzz/LN9SlnU+u6262nBA18E3\\nkQ10RgL2jpZ9e8Om6qYqarhN7draupJXYRKEaUoEFPT09ABbwQv+4K1YadU8klJi\\nHJ6D+IIHiXNizfsxVLDKpbUKStMYeEzyfqCkWw0EQEuzc3O7Aci5lwCMkCts2993\\nsTbNyzsYAVWJNcy/An1F1P+K4iZhWEtZInQz67MBtjMWtQUhyWib0e671HdBiWM6\\nkZq74U8c6RR6eMzBLuY7YAUCG6nWg90zxwIDAQAB\\n-----END RSA PUBLIC KEY-----\\n\\n\"},\"summary\":\"Change this to a proper description of your instance\",\"type\":\"Application\",\"url\":\"http://mobilizon1.com/relay\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Content-Length": "1368",
|
||||
"Date": "Thu, 01 Aug 2019 14:44:38 GMT",
|
||||
"Server": "Python/3.7 aiohttp/3.3.2"
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:41 GMT",
|
||||
"Content-Type": "application/activity+json",
|
||||
"Content-Length": "1657",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7PjOAWuySL0AAAPB"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
@@ -27,30 +65,36 @@
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.github.io/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"actor\":\"http://mobilizon.test/relay\",\"cc\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"id\":\"http://mobilizon.test/follow/69/activity\",\"object\":\"http://localhost:8080/actor\",\"to\":[\"http://localhost:8080/actor\"],\"type\":\"Follow\"}",
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.social/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"ical\":\"http://www.w3.org/2002/12/cal/ical#\",\"joinMode\":{\"@id\":\"mz:joinMode\",\"@type\":\"mz:joinModeType\"},\"joinModeType\":{\"@id\":\"mz:joinModeType\",\"@type\":\"rdfs:Class\"},\"maximumAttendeeCapacity\":\"sc:maximumAttendeeCapacity\",\"mz\":\"https://joinmobilizon.org/ns#\",\"repliesModerationOption\":{\"@id\":\"mz:repliesModerationOption\",\"@type\":\"mz:repliesModerationOptionType\"},\"repliesModerationOptionType\":{\"@id\":\"mz:repliesModerationOptionType\",\"@type\":\"rdfs:Class\"},\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"actor\":\"http://mobilizon.test/relay\",\"cc\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"id\":\"http://mobilizon.test/follow/b7791977-2a75-4715-815b-6e7125065b71\",\"object\":\"http://mobilizon1.com/relay\",\"to\":[\"http://mobilizon1.com/relay\"],\"type\":\"Follow\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/activity+json",
|
||||
"signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"UADlb5eaeqmujO5zGfK1mWB3WZFXU6lkUgSvEf5YyQMOIkMaudDwTfNPIa4IYh2VMLwyYSjOOXxkcBdCw4f9UnMBQBhomPNRNkJ0QBzoxILPmyxddAojH9IzwwAUL/nHSGWaO116bkCux0OcEM5AVIrCT6dENep39lOjnOGPelBB5mKMS78AxH4pU/5tTGFKmNgiRL4Q06ezPUJHKauRrMwzcqZYdjUn+U9MDBDrYyfAzqQlgBPU/fMCjwusndxaICb9c+40YE3WaXzKewIivfrMoOBzWyw6ZsgAG8/NoOH+8z9Z+hBvdjCUXeG2bvAPPclNkSJillwIA2PnMOVgpw==\"",
|
||||
"digest": "SHA-256=Ady0Dj2bEXe201P9bThLaj1Kw/7O1cfrjN9IifEfVBg=",
|
||||
"date": "Thu, 01 Aug 2019 14:44:38 GMT"
|
||||
"signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"WbyGHT/WdvdRpWek8uCGHrFSblLpg+Iq802R5S2cjNj035OKpxRmu1r8u9Qr5KGIKgZn6LHt9YmB+PNlwsubPtTSkJpE8AAUDMHLKgCrH7A5Q6x6GlARl5bHNo4QtOxkXvnEbn31xfNDNp70QqZb/emw95TnELYUlMLZds0qYutT8U4WdDhSWcVytQmKJWNZXxEj+KlMDUaxag3lGscJ/HY0F+yGNov7FHthid1Y4LTGFsp/tismnMTlba12NH/kXPHtduNsX8uxFslM2ODwqAaospTGEpXmr9CPgbNy7626qgYaR2RdB/fYlCayLI4JJIlH8gOdocGHPrWNtVEHaQ==\"",
|
||||
"digest": "SHA-256=ibNFcsnBeCCjWZo9We60tKfbRN3el0WCMVdOxtuC1cg=",
|
||||
"date": "Fri, 13 Dec 2019 09:41:41 GMT"
|
||||
},
|
||||
"method": "post",
|
||||
"options": {
|
||||
"pool": "default"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://localhost:8080/inbox"
|
||||
"url": "http://mobilizon1.com/inbox"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "signature check failed, signature did not match key",
|
||||
"body": "# HTTPoison.Error at POST /inbox\n\nException:\n\n ** (HTTPoison.Error) :nxdomain\n (httpoison) lib/httpoison.ex:128: HTTPoison.request!/5\n (mobilizon) lib/service/activity_pub/activity_pub.ex:610: Mobilizon.Service.ActivityPub.fetch_and_prepare_actor_from_url/1\n (mobilizon) lib/service/activity_pub/activity_pub.ex:473: Mobilizon.Service.ActivityPub.make_actor_from_url/2\n (mobilizon) lib/service/activity_pub/activity_pub.ex:122: Mobilizon.Service.ActivityPub.get_or_fetch_actor_by_url/2\n (mobilizon) lib/service/http_signatures/signature.ex:54: Mobilizon.Service.HTTPSignatures.Signature.get_public_key_for_url/1\n (mobilizon) lib/service/http_signatures/signature.ex:74: Mobilizon.Service.HTTPSignatures.Signature.fetch_public_key/1\n (http_signatures) lib/http_signatures/http_signatures.ex:40: HTTPSignatures.validate_conn/1\n (mobilizon) lib/mobilizon_web/http_signature.ex:45: MobilizonWeb.HTTPSignaturePlug.call/2\n (mobilizon) MobilizonWeb.Router.activity_pub_signature/2\n (mobilizon) lib/mobilizon_web/router.ex:1: MobilizonWeb.Router.__pipe_through7__/1\n (phoenix) lib/phoenix/router.ex:283: Phoenix.Router.__call__/2\n (mobilizon) lib/mobilizon_web/endpoint.ex:1: MobilizonWeb.Endpoint.plug_builder_call/2\n (mobilizon) lib/plug/debugger.ex:122: MobilizonWeb.Endpoint.\"call (overridable 3)\"/2\n (mobilizon) lib/mobilizon_web/endpoint.ex:1: MobilizonWeb.Endpoint.call/2\n (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_stream_h.erl:320: :cowboy_stream_h.execute/3\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_stream_h.erl:302: :cowboy_stream_h.request_process/3\n (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\n \n\n## Connection details\n\n### Params\n\n %{\"@context\" => [\"https://www.w3.org/ns/activitystreams\", \"https://litepub.social/litepub/context.jsonld\", %{\"Hashtag\" => \"as:Hashtag\", \"category\" => \"sc:category\", \"ical\" => \"http://www.w3.org/2002/12/cal/ical#\", \"joinMode\" => %{\"@id\" => \"mz:joinMode\", \"@type\" => \"mz:joinModeType\"}, \"joinModeType\" => %{\"@id\" => \"mz:joinModeType\", \"@type\" => \"rdfs:Class\"}, \"maximumAttendeeCapacity\" => \"sc:maximumAttendeeCapacity\", \"mz\" => \"https://joinmobilizon.org/ns#\", \"repliesModerationOption\" => %{\"@id\" => \"mz:repliesModerationOption\", \"@type\" => \"mz:repliesModerationOptionType\"}, \"repliesModerationOptionType\" => %{\"@id\" => \"mz:repliesModerationOptionType\", \"@type\" => \"rdfs:Class\"}, \"sc\" => \"http://schema.org#\", \"uuid\" => \"sc:identifier\"}], \"actor\" => \"http://mobilizon.test/relay\", \"cc\" => [\"https://www.w3.org/ns/activitystreams#Public\"], \"id\" => \"http://mobilizon.test/follow/b7791977-2a75-4715-815b-6e7125065b71\", \"object\" => \"http://mobilizon1.com/relay\", \"to\" => [\"http://mobilizon1.com/relay\"], \"type\" => \"Follow\"}\n\n### Request info\n\n * URI: http://mobilizon1.com:80/inbox\n * Query string: \n\n### Headers\n \n * connection: upgrade\n * content-length: 912\n * content-type: application/activity+json\n * date: Fri, 13 Dec 2019 09:41:41 GMT\n * digest: SHA-256=ibNFcsnBeCCjWZo9We60tKfbRN3el0WCMVdOxtuC1cg=\n * host: mobilizon1.com\n * signature: keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"WbyGHT/WdvdRpWek8uCGHrFSblLpg+Iq802R5S2cjNj035OKpxRmu1r8u9Qr5KGIKgZn6LHt9YmB+PNlwsubPtTSkJpE8AAUDMHLKgCrH7A5Q6x6GlARl5bHNo4QtOxkXvnEbn31xfNDNp70QqZb/emw95TnELYUlMLZds0qYutT8U4WdDhSWcVytQmKJWNZXxEj+KlMDUaxag3lGscJ/HY0F+yGNov7FHthid1Y4LTGFsp/tismnMTlba12NH/kXPHtduNsX8uxFslM2ODwqAaospTGEpXmr9CPgbNy7626qgYaR2RdB/fYlCayLI4JJIlH8gOdocGHPrWNtVEHaQ==\"\n * user-agent: hackney/1.15.2\n * x-forwarded-for: 127.0.0.1\n * x-real-ip: 127.0.0.1\n\n### Session\n\n %{}\n",
|
||||
"headers": {
|
||||
"Content-Length": "51",
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
"Date": "Thu, 01 Aug 2019 14:44:38 GMT",
|
||||
"Server": "Python/3.7 aiohttp/3.3.2"
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:41 GMT",
|
||||
"Content-Type": "text/markdown; charset=utf-8",
|
||||
"Content-Length": "3977",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7PoZpCCBYRQAAAPh"
|
||||
},
|
||||
"status_code": 401,
|
||||
"status_code": 500,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
[
|
||||
{
|
||||
"request": {
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.github.io/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"actor\":\"http://mobilizon.test/relay\",\"cc\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"id\":\"http://mobilizon.test/follow/68/activity\",\"object\":\"http://localhost:8080/actor\",\"to\":[\"http://localhost:8080/actor\"],\"type\":\"Follow\"}",
|
||||
"body": "",
|
||||
"headers": {
|
||||
"Content-Type": "application/activity+json",
|
||||
"signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"WsxzipdObXsApVtY5l2yTonTOPV888XLKK2+AMQRyiNZm4RGMEux8kgBKgJIODaKmRx9EsX8dIzBtTmJdLyj5gqfjvGVyj8hVeR0ERNMZmjngh5EZ3W+ySbkdFYZeYDWhwpL1i+7dTFJ3zE/ASZVaTMeIgqEpFnzHNbamwPzBZVvcnzyraB1rrmwcbzzrk3UPlJ3tA+Xz67Njr2wOiNNsjZ53abArKZB3KGbife6OyrVrKldJ+UKZS+vokgUXFwvMBZxfdmH2GD+yXHPhCIu7bVu77ASdW7bl7tM3uIV/c/Wemy5qJtPOupwbDvpLZ9ETE5IRCoUPdQ7l75kvevNxQ==\"",
|
||||
"digest": "SHA-256=qIEgTH6kBorFchTiX2kxd7onyZ7BHhvLgCODLs6RAVc=",
|
||||
"date": "Thu, 01 Aug 2019 14:44:37 GMT"
|
||||
"Accept": "application/json, application/activity+json, application/jrd+json"
|
||||
},
|
||||
"method": "post",
|
||||
"method": "get",
|
||||
"options": {
|
||||
"pool": "default"
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://localhost:8080/inbox"
|
||||
"url": "http://mobilizon1.com/.well-known/webfinger?resource=acct:relay@mobilizon1.com"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "signature check failed, signature did not match key",
|
||||
"body": "{\"aliases\":[\"http://mobilizon1.com/relay\"],\"links\":[{\"href\":\"http://mobilizon1.com/relay\",\"rel\":\"self\",\"type\":\"application/activity+json\"},{\"href\":\"http://mobilizon1.com/relay\",\"rel\":\"https://webfinger.net/rel/profile-page/\",\"type\":\"text/html\"}],\"subject\":\"acct:relay@mobilizon1.com\"}",
|
||||
"headers": {
|
||||
"Content-Length": "51",
|
||||
"Content-Type": "text/plain; charset=utf-8",
|
||||
"Date": "Thu, 01 Aug 2019 14:44:37 GMT",
|
||||
"Server": "Python/3.7 aiohttp/3.3.2"
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:39 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Content-Length": "284",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7LmY5k0CMQkAAANB"
|
||||
},
|
||||
"status_code": 401,
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
@@ -39,19 +42,60 @@
|
||||
"follow_redirect": "true"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://localhost:8080/actor"
|
||||
"url": "http://mobilizon1.com/relay"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "{\"@context\": \"https://www.w3.org/ns/activitystreams\", \"endpoints\": {\"sharedInbox\": \"http://localhost:8080/inbox\"}, \"followers\": \"http://localhost:8080/followers\", \"following\": \"http://localhost:8080/following\", \"inbox\": \"http://localhost:8080/inbox\", \"name\": \"ActivityRelay\", \"type\": \"Application\", \"id\": \"http://localhost:8080/actor\", \"publicKey\": {\"id\": \"http://localhost:8080/actor#main-key\", \"owner\": \"http://localhost:8080/actor\", \"publicKeyPem\": \"-----BEGIN PUBLIC KEY-----\\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvs6UuAo26Sb3BiOK7xay\\nsBzqvXI3xd55JAP0pAk2faF+Vl3r67/g9MoND96JqCVMuzSJZ9oSsqa6ilJCxG3p\\nXUUfQUvqAMGW49cCvga86DG17Ennjbc4C6WIQtoW3Wm5OdDciPY2Dx+pSXdTOajB\\nFX6RHUZcgqHENrsm3jPZI138e/2OJeqdxv4/5t2xdPXEpWdPGitX9AJhrqPY4lzg\\nzQ9Y9wS2eS1CVL9vZZRf9Z4RiZvAfVb0s1iS/IUxrf4TYERRFJxEoDLD2SZVrkq6\\nvhGldCfw2ZnfTftA1ToXguC9S6nSaz+li0ajNjpK/xjZjlKvn0I078UPPe5LUlsb\\nUcYZvBx5PC5rV8yKMLlgxnTY8PqC8LEVc453wO7Ai4M5TeB0SUyEycZHSyLfvQXV\\nThEN/07u1UaJViY3U5S/SihyoCQUfJXQ3jx2SjGgM32/aJ3IwxgveLaTsaZ0VVKM\\nbawEFw6iAcWYM06hZSB6j6dkL1xh+FYGEQTPMYMqUOJi2r1cD8yMLe8dTFOmwMLt\\nBnf7xxvnjKJcv3e9zGRWIdLkQbBQn3BEuRTCUMgljipxdjbeE5/JSP1kQLB94ncb\\nb9gvYgtemJKvT8m37+HOi9MI4BMIlDwpRWjqPZmkNvkegR/1KPjJSsyAnGdd89ne\\np442vUqPyXIq0tSCDmjmU+cCAwEAAQ==\\n-----END PUBLIC KEY-----\"}, \"summary\": \"ActivityRelay bot\", \"preferredUsername\": \"relay\", \"url\": \"http://localhost:8080/actor\"}",
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.social/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"ical\":\"http://www.w3.org/2002/12/cal/ical#\",\"joinMode\":{\"@id\":\"mz:joinMode\",\"@type\":\"mz:joinModeType\"},\"joinModeType\":{\"@id\":\"mz:joinModeType\",\"@type\":\"rdfs:Class\"},\"maximumAttendeeCapacity\":\"sc:maximumAttendeeCapacity\",\"mz\":\"https://joinmobilizon.org/ns#\",\"repliesModerationOption\":{\"@id\":\"mz:repliesModerationOption\",\"@type\":\"mz:repliesModerationOptionType\"},\"repliesModerationOptionType\":{\"@id\":\"mz:repliesModerationOptionType\",\"@type\":\"rdfs:Class\"},\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"endpoints\":{\"sharedInbox\":\"http://mobilizon1.com/inbox\"},\"followers\":\"http://mobilizon1.com/relay/followers\",\"following\":\"http://mobilizon1.com/relay/following\",\"id\":\"http://mobilizon1.com/relay\",\"inbox\":\"http://mobilizon1.com/inbox\",\"manuallyApprovesFollowers\":false,\"name\":\"Mobilizon\",\"outbox\":null,\"preferredUsername\":\"relay\",\"publicKey\":{\"id\":\"http://mobilizon1.com/relay#main-key\",\"owner\":\"http://mobilizon1.com/relay\",\"publicKeyPem\":\"-----BEGIN RSA PUBLIC KEY-----\\nMIIBCgKCAQEAqBbeHMV5UVw0AIVch7fWDp2it5rqbGZX6yXPYnnT8LHhdvfv3DFk\\npk74BN66MzNqsthvSVznu2BEil0sEKD5rQoE9Yirhzz/LN9SlnU+u6262nBA18E3\\nkQ10RgL2jpZ9e8Om6qYqarhN7draupJXYRKEaUoEFPT09ABbwQv+4K1YadU8klJi\\nHJ6D+IIHiXNizfsxVLDKpbUKStMYeEzyfqCkWw0EQEuzc3O7Aci5lwCMkCts2993\\nsTbNyzsYAVWJNcy/An1F1P+K4iZhWEtZInQz67MBtjMWtQUhyWib0e671HdBiWM6\\nkZq74U8c6RR6eMzBLuY7YAUCG6nWg90zxwIDAQAB\\n-----END RSA PUBLIC KEY-----\\n\\n\"},\"summary\":\"Change this to a proper description of your instance\",\"type\":\"Application\",\"url\":\"http://mobilizon1.com/relay\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Content-Length": "1368",
|
||||
"Date": "Thu, 01 Aug 2019 14:44:36 GMT",
|
||||
"Server": "Python/3.7 aiohttp/3.3.2"
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:40 GMT",
|
||||
"Content-Type": "application/activity+json",
|
||||
"Content-Length": "1657",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7L4h92fDp5cAAANh"
|
||||
},
|
||||
"status_code": 200,
|
||||
"type": "ok"
|
||||
}
|
||||
},
|
||||
{
|
||||
"request": {
|
||||
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://litepub.social/litepub/context.jsonld\",{\"Hashtag\":\"as:Hashtag\",\"category\":\"sc:category\",\"ical\":\"http://www.w3.org/2002/12/cal/ical#\",\"joinMode\":{\"@id\":\"mz:joinMode\",\"@type\":\"mz:joinModeType\"},\"joinModeType\":{\"@id\":\"mz:joinModeType\",\"@type\":\"rdfs:Class\"},\"maximumAttendeeCapacity\":\"sc:maximumAttendeeCapacity\",\"mz\":\"https://joinmobilizon.org/ns#\",\"repliesModerationOption\":{\"@id\":\"mz:repliesModerationOption\",\"@type\":\"mz:repliesModerationOptionType\"},\"repliesModerationOptionType\":{\"@id\":\"mz:repliesModerationOptionType\",\"@type\":\"rdfs:Class\"},\"sc\":\"http://schema.org#\",\"uuid\":\"sc:identifier\"}],\"actor\":\"http://mobilizon.test/relay\",\"cc\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"id\":\"http://mobilizon.test/follow/57a6973e-f43f-4533-bf71-7a14a4c6e5ac\",\"object\":\"http://mobilizon1.com/relay\",\"to\":[\"http://mobilizon1.com/relay\"],\"type\":\"Follow\"}",
|
||||
"headers": {
|
||||
"Content-Type": "application/activity+json",
|
||||
"signature": "keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"JQPqSiJ0ZYdU6llrYXNMuN/bfzoLyubwOB59bljFq6i8ORXLw62Pt7Jue5WkMsySFcCXgS8k8K/H81YZkKzfWadwQV9L5rQEFSuW/DYJ2xffsDj90GsSi+sDRaQ5Ke8nPEbEMGR9jalh/F2VL97XscCgm6i3tdpbs6aFmqjKC+LzeH665t0WCHUxTgK47wECrMHw3j7lteGdm6N6IKWoWsRYeJoyFr/QCbNdWQOaAYYpCbJd0fjhPQRHhWQXidBoaDkhwesWc3mO8pvEnply9ES7Nzc6ULK7B98hg+aWeep8/KzRbxFyJ0OgnDJj/l39QiJ9t7v0yHX/WUzn0CaiiQ==\"",
|
||||
"digest": "SHA-256=Qc9d9X3qh2EqIqtn/72iY17OMDXAOINDC10hARNAc4w=",
|
||||
"date": "Fri, 13 Dec 2019 09:41:40 GMT"
|
||||
},
|
||||
"method": "post",
|
||||
"options": {
|
||||
"pool": "default"
|
||||
},
|
||||
"request_body": "",
|
||||
"url": "http://mobilizon1.com/inbox"
|
||||
},
|
||||
"response": {
|
||||
"binary": false,
|
||||
"body": "# HTTPoison.Error at POST /inbox\n\nException:\n\n ** (HTTPoison.Error) :nxdomain\n (httpoison) lib/httpoison.ex:128: HTTPoison.request!/5\n (mobilizon) lib/service/activity_pub/activity_pub.ex:610: Mobilizon.Service.ActivityPub.fetch_and_prepare_actor_from_url/1\n (mobilizon) lib/service/activity_pub/activity_pub.ex:473: Mobilizon.Service.ActivityPub.make_actor_from_url/2\n (mobilizon) lib/service/activity_pub/activity_pub.ex:122: Mobilizon.Service.ActivityPub.get_or_fetch_actor_by_url/2\n (mobilizon) lib/service/http_signatures/signature.ex:54: Mobilizon.Service.HTTPSignatures.Signature.get_public_key_for_url/1\n (mobilizon) lib/service/http_signatures/signature.ex:74: Mobilizon.Service.HTTPSignatures.Signature.fetch_public_key/1\n (http_signatures) lib/http_signatures/http_signatures.ex:40: HTTPSignatures.validate_conn/1\n (mobilizon) lib/mobilizon_web/http_signature.ex:45: MobilizonWeb.HTTPSignaturePlug.call/2\n (mobilizon) MobilizonWeb.Router.activity_pub_signature/2\n (mobilizon) lib/mobilizon_web/router.ex:1: MobilizonWeb.Router.__pipe_through7__/1\n (phoenix) lib/phoenix/router.ex:283: Phoenix.Router.__call__/2\n (mobilizon) lib/mobilizon_web/endpoint.ex:1: MobilizonWeb.Endpoint.plug_builder_call/2\n (mobilizon) lib/plug/debugger.ex:122: MobilizonWeb.Endpoint.\"call (overridable 3)\"/2\n (mobilizon) lib/mobilizon_web/endpoint.ex:1: MobilizonWeb.Endpoint.call/2\n (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:42: Phoenix.Endpoint.Cowboy2Handler.init/4\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_stream_h.erl:320: :cowboy_stream_h.execute/3\n (cowboy) /home/tcit/dev/frama/mobilizon/deps/cowboy/src/cowboy_stream_h.erl:302: :cowboy_stream_h.request_process/3\n (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\n \n\n## Connection details\n\n### Params\n\n %{\"@context\" => [\"https://www.w3.org/ns/activitystreams\", \"https://litepub.social/litepub/context.jsonld\", %{\"Hashtag\" => \"as:Hashtag\", \"category\" => \"sc:category\", \"ical\" => \"http://www.w3.org/2002/12/cal/ical#\", \"joinMode\" => %{\"@id\" => \"mz:joinMode\", \"@type\" => \"mz:joinModeType\"}, \"joinModeType\" => %{\"@id\" => \"mz:joinModeType\", \"@type\" => \"rdfs:Class\"}, \"maximumAttendeeCapacity\" => \"sc:maximumAttendeeCapacity\", \"mz\" => \"https://joinmobilizon.org/ns#\", \"repliesModerationOption\" => %{\"@id\" => \"mz:repliesModerationOption\", \"@type\" => \"mz:repliesModerationOptionType\"}, \"repliesModerationOptionType\" => %{\"@id\" => \"mz:repliesModerationOptionType\", \"@type\" => \"rdfs:Class\"}, \"sc\" => \"http://schema.org#\", \"uuid\" => \"sc:identifier\"}], \"actor\" => \"http://mobilizon.test/relay\", \"cc\" => [\"https://www.w3.org/ns/activitystreams#Public\"], \"id\" => \"http://mobilizon.test/follow/57a6973e-f43f-4533-bf71-7a14a4c6e5ac\", \"object\" => \"http://mobilizon1.com/relay\", \"to\" => [\"http://mobilizon1.com/relay\"], \"type\" => \"Follow\"}\n\n### Request info\n\n * URI: http://mobilizon1.com:80/inbox\n * Query string: \n\n### Headers\n \n * connection: upgrade\n * content-length: 912\n * content-type: application/activity+json\n * date: Fri, 13 Dec 2019 09:41:40 GMT\n * digest: SHA-256=Qc9d9X3qh2EqIqtn/72iY17OMDXAOINDC10hARNAc4w=\n * host: mobilizon1.com\n * signature: keyId=\"http://mobilizon.test/relay#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) content-length date digest host\",signature=\"JQPqSiJ0ZYdU6llrYXNMuN/bfzoLyubwOB59bljFq6i8ORXLw62Pt7Jue5WkMsySFcCXgS8k8K/H81YZkKzfWadwQV9L5rQEFSuW/DYJ2xffsDj90GsSi+sDRaQ5Ke8nPEbEMGR9jalh/F2VL97XscCgm6i3tdpbs6aFmqjKC+LzeH665t0WCHUxTgK47wECrMHw3j7lteGdm6N6IKWoWsRYeJoyFr/QCbNdWQOaAYYpCbJd0fjhPQRHhWQXidBoaDkhwesWc3mO8pvEnply9ES7Nzc6ULK7B98hg+aWeep8/KzRbxFyJ0OgnDJj/l39QiJ9t7v0yHX/WUzn0CaiiQ==\"\n * user-agent: hackney/1.15.2\n * x-forwarded-for: 127.0.0.1\n * x-real-ip: 127.0.0.1\n\n### Session\n\n %{}\n",
|
||||
"headers": {
|
||||
"Server": "nginx/1.16.1",
|
||||
"Date": "Fri, 13 Dec 2019 09:41:40 GMT",
|
||||
"Content-Type": "text/markdown; charset=utf-8",
|
||||
"Content-Length": "3977",
|
||||
"Connection": "keep-alive",
|
||||
"access-control-allow-credentials": "true",
|
||||
"access-control-allow-origin": "*",
|
||||
"access-control-expose-headers": "",
|
||||
"cache-control": "max-age=0, private, must-revalidate",
|
||||
"x-request-id": "Fd_k7MU4jVIgj4wAAAOB"
|
||||
},
|
||||
"status_code": 500,
|
||||
"type": "ok"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +1,13 @@
|
||||
defmodule Mobilizon.ActorsTest do
|
||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||
|
||||
use Mobilizon.DataCase
|
||||
use Oban.Testing, repo: Mobilizon.Storage.Repo
|
||||
|
||||
import Mobilizon.Factory
|
||||
|
||||
alias Mobilizon.{Actors, Config, Users}
|
||||
alias Mobilizon.{Actors, Config, Users, Events, Tombstone}
|
||||
alias Mobilizon.Actors.{Actor, Bot, Follower, Member}
|
||||
alias Mobilizon.Events.{Event, Comment}
|
||||
alias Mobilizon.Media.File, as: FileModel
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias Mobilizon.Storage.Page
|
||||
@@ -287,6 +288,12 @@ defmodule Mobilizon.ActorsTest do
|
||||
test "delete_actor/1 deletes the actor", %{
|
||||
actor: %Actor{avatar: %{url: avatar_url}, banner: %{url: banner_url}, id: actor_id} = actor
|
||||
} do
|
||||
%Event{url: event1_url} = event1 = insert(:event, organizer_actor: actor)
|
||||
insert(:event, organizer_actor: actor)
|
||||
|
||||
%Comment{url: comment1_url} = comment1 = insert(:comment, actor: actor)
|
||||
insert(:comment, actor: actor)
|
||||
|
||||
%URI{path: "/media/" <> avatar_path} = URI.parse(avatar_url)
|
||||
%URI{path: "/media/" <> banner_path} = URI.parse(banner_url)
|
||||
|
||||
@@ -300,8 +307,34 @@ defmodule Mobilizon.ActorsTest do
|
||||
"/" <> banner_path
|
||||
)
|
||||
|
||||
assert {:ok, %Actor{}} = Actors.delete_actor(actor)
|
||||
assert_raise Ecto.NoResultsError, fn -> Actors.get_actor!(actor_id) end
|
||||
assert {:ok, %Oban.Job{}} = Actors.delete_actor(actor)
|
||||
|
||||
assert_enqueued(
|
||||
worker: Mobilizon.Service.Workers.BackgroundWorker,
|
||||
args: %{"actor_id" => actor.id, "op" => "delete_actor"}
|
||||
)
|
||||
|
||||
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
|
||||
|
||||
assert %Actor{
|
||||
name: nil,
|
||||
summary: nil,
|
||||
suspended: true,
|
||||
avatar: nil,
|
||||
banner: nil,
|
||||
user_id: nil
|
||||
} = Actors.get_actor(actor_id)
|
||||
|
||||
assert {:error, :event_not_found} = Events.get_event(event1.id)
|
||||
assert %Tombstone{} = Tombstone.find_tombstone(event1_url)
|
||||
assert %Comment{deleted_at: deleted_at} = Events.get_comment(comment1.id)
|
||||
refute is_nil(deleted_at)
|
||||
assert %Tombstone{} = Tombstone.find_tombstone(comment1_url)
|
||||
|
||||
refute File.exists?(
|
||||
Config.get!([MobilizonWeb.Uploaders.Local, :uploads]) <>
|
||||
"/" <> avatar_path
|
||||
)
|
||||
|
||||
refute File.exists?(
|
||||
Config.get!([MobilizonWeb.Uploaders.Local, :uploads]) <>
|
||||
|
||||
@@ -314,7 +314,10 @@ defmodule Mobilizon.EventsTest do
|
||||
|
||||
setup do
|
||||
actor = insert(:actor)
|
||||
event = insert(:event, organizer_actor: actor)
|
||||
|
||||
event =
|
||||
insert(:event, organizer_actor: actor, participant_stats: %{creator: 1, participant: 1})
|
||||
|
||||
participant = insert(:participant, actor: actor, event: event)
|
||||
{:ok, participant: participant, event: event, actor: actor}
|
||||
end
|
||||
@@ -364,7 +367,8 @@ defmodule Mobilizon.EventsTest do
|
||||
test "update_participant/2 with invalid data returns error changeset", %{
|
||||
participant: participant
|
||||
} do
|
||||
assert {:error, %Ecto.Changeset{}} = Events.update_participant(participant, @invalid_attrs)
|
||||
assert {:error, :participant, %Ecto.Changeset{}, %{}} =
|
||||
Events.update_participant(participant, @invalid_attrs)
|
||||
end
|
||||
|
||||
test "delete_participant/1 deletes the participant", %{participant: participant} do
|
||||
|
||||
@@ -171,7 +171,7 @@ defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do
|
||||
assert update.data["actor"] == actor.url
|
||||
assert update.data["to"] == [@activity_pub_public_audience]
|
||||
assert update.data["object"]["id"] == actor.url
|
||||
assert update.data["object"]["type"] == "Person"
|
||||
assert update.data["object"]["type"] == :Person
|
||||
assert update.data["object"]["summary"] == @updated_actor_summary
|
||||
end
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ defmodule Mobilizon.Service.ActivityPub.Converter.ActorTest do
|
||||
test "valid actor to as" do
|
||||
data = ActorConverter.model_to_as(%Actor{type: :Person, preferred_username: "test_account"})
|
||||
assert is_map(data)
|
||||
assert data["type"] == "Person"
|
||||
assert data["preferred_username"] == "test_account"
|
||||
assert data["type"] == :Person
|
||||
assert data["preferredUsername"] == "test_account"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,12 +17,13 @@ defmodule Mobilizon.Service.ActivityPub.Converter.ActorTest do
|
||||
test "valid as data to model" do
|
||||
{:ok, actor} =
|
||||
ActorConverter.as_to_model_data(%{
|
||||
"id" => "https://somedomain.tld/users/someone",
|
||||
"type" => "Person",
|
||||
"preferredUsername" => "test_account"
|
||||
})
|
||||
|
||||
assert actor["type"] == :Person
|
||||
assert actor["preferred_username"] == "test_account"
|
||||
assert actor.type == "Person"
|
||||
assert actor.preferred_username == "test_account"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,10 +9,10 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
use Mobilizon.DataCase
|
||||
|
||||
import Mobilizon.Factory
|
||||
import ExUnit.CaptureLog
|
||||
|
||||
alias Mobilizon.Actors
|
||||
alias Mobilizon.{Actors, Events, Tombstone}
|
||||
alias Mobilizon.Actors.Actor
|
||||
alias Mobilizon.Events
|
||||
alias Mobilizon.Events.{Comment, Event, Participant}
|
||||
alias Mobilizon.Service.ActivityPub
|
||||
alias Mobilizon.Service.ActivityPub.{Activity, Utils}
|
||||
@@ -131,7 +131,7 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
data
|
||||
|> Map.put("object", object)
|
||||
|
||||
assert ExUnit.CaptureLog.capture_log([level: :warn], fn ->
|
||||
assert capture_log([level: :warn], fn ->
|
||||
{:ok, _returned_activity, _entity} = Transmogrifier.handle_incoming(data)
|
||||
end) =~ "[warn] Parent object is something we don't handle"
|
||||
end
|
||||
@@ -145,7 +145,10 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
assert data["id"] ==
|
||||
"https://framapiaf.org/users/admin/statuses/99512778738411822/activity"
|
||||
|
||||
assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
|
||||
assert data["to"] == [
|
||||
"https://www.w3.org/ns/activitystreams#Public",
|
||||
"https://framapiaf.org/users/tcit"
|
||||
]
|
||||
|
||||
# assert data["cc"] == [
|
||||
# "https://framapiaf.org/users/admin/followers",
|
||||
@@ -466,26 +469,70 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
refute is_nil(Events.get_comment_from_url(comment_url).deleted_at)
|
||||
end
|
||||
|
||||
# TODO : make me ASAP
|
||||
# test "it fails for incoming deletes with spoofed origin" do
|
||||
# activity = insert(:note_activity)
|
||||
test "it fails for incoming deletes with spoofed origin" do
|
||||
comment = insert(:comment)
|
||||
|
||||
# data =
|
||||
# File.read!("test/fixtures/mastodon-delete.json")
|
||||
# |> Jason.decode!()
|
||||
announce_data =
|
||||
File.read!("test/fixtures/mastodon-announce.json")
|
||||
|> Jason.decode!()
|
||||
|> Map.put("object", comment.url)
|
||||
|
||||
# object =
|
||||
# data["object"]
|
||||
# |> Map.put("id", activity.data["object"]["id"])
|
||||
{:ok, %Activity{local: false}, _} = Transmogrifier.handle_incoming(announce_data)
|
||||
|
||||
# data =
|
||||
# data
|
||||
# |> Map.put("object", object)
|
||||
data =
|
||||
File.read!("test/fixtures/mastodon-delete.json")
|
||||
|> Jason.decode!()
|
||||
|
||||
# :error = Transmogrifier.handle_incoming(data)
|
||||
object =
|
||||
data["object"]
|
||||
|> Map.put("id", comment.url)
|
||||
|
||||
# assert Repo.get(Activity, activity.id)
|
||||
# end
|
||||
data =
|
||||
data
|
||||
|> Map.put("object", object)
|
||||
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
|
||||
assert Events.get_comment_from_url(comment.url)
|
||||
end
|
||||
|
||||
test "it works for incoming actor deletes" do
|
||||
%Actor{url: url} = actor = insert(:actor, url: "https://framapiaf.org/users/admin")
|
||||
%Event{url: event1_url} = event1 = insert(:event, organizer_actor: actor)
|
||||
insert(:event, organizer_actor: actor)
|
||||
|
||||
%Comment{url: comment1_url} = comment1 = insert(:comment, actor: actor)
|
||||
insert(:comment, actor: actor)
|
||||
|
||||
data =
|
||||
File.read!("test/fixtures/mastodon-delete-user.json")
|
||||
|> Poison.decode!()
|
||||
|
||||
{:ok, _activity, _actor} = Transmogrifier.handle_incoming(data)
|
||||
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
|
||||
|
||||
assert {:ok, %Actor{suspended: true}} = Actors.get_actor_by_url(url)
|
||||
assert {:error, :event_not_found} = Events.get_event(event1.id)
|
||||
assert %Tombstone{} = Tombstone.find_tombstone(event1_url)
|
||||
assert %Comment{deleted_at: deleted_at} = Events.get_comment(comment1.id)
|
||||
refute is_nil(deleted_at)
|
||||
assert %Tombstone{} = Tombstone.find_tombstone(comment1_url)
|
||||
end
|
||||
|
||||
test "it fails for incoming actor deletes with spoofed origin" do
|
||||
%{url: url} = insert(:actor)
|
||||
|
||||
data =
|
||||
File.read!("test/fixtures/mastodon-delete-user.json")
|
||||
|> Poison.decode!()
|
||||
|> Map.put("actor", url)
|
||||
|
||||
assert capture_log(fn ->
|
||||
assert :error == Transmogrifier.handle_incoming(data)
|
||||
end) =~ "Object origin check failed"
|
||||
|
||||
assert Actors.get_actor_by_url(url)
|
||||
end
|
||||
|
||||
test "it works for incoming unannounces with an existing notice" do
|
||||
use_cassette "activity_pub/mastodon_unannounce_activity" do
|
||||
@@ -743,13 +790,14 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
end
|
||||
|
||||
test "it accepts Flag activities" do
|
||||
%Actor{url: reporter_url} = _reporter = insert(:actor)
|
||||
%Actor{url: reporter_url} = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
%Actor{url: reported_url} = reported = insert(:actor)
|
||||
|
||||
%Comment{url: comment_url} = _comment = insert(:comment, actor: reported)
|
||||
|
||||
message = %{
|
||||
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||
"to" => [],
|
||||
"cc" => [reported_url],
|
||||
"object" => [reported_url, comment_url],
|
||||
"type" => "Flag",
|
||||
@@ -762,11 +810,11 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
assert activity.data["object"] == [reported_url, comment_url]
|
||||
assert activity.data["content"] == "blocked AND reported!!!"
|
||||
assert activity.data["actor"] == reporter_url
|
||||
assert activity.data["cc"] == [reported_url]
|
||||
assert activity.data["cc"] == []
|
||||
end
|
||||
|
||||
test "it accepts Join activities" do
|
||||
%Actor{url: _organizer_url} = organizer = insert(:actor)
|
||||
%Actor{url: organizer_url} = organizer = insert(:actor)
|
||||
%Actor{url: participant_url} = _participant = insert(:actor)
|
||||
|
||||
%Event{url: event_url} = _event = insert(:event, organizer_actor: organizer)
|
||||
@@ -779,8 +827,12 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
|
||||
assert {:ok, activity, _} = Transmogrifier.handle_incoming(join_data)
|
||||
|
||||
assert activity.data["object"] == event_url
|
||||
assert activity.data["actor"] == participant_url
|
||||
assert activity.data["type"] == "Accept"
|
||||
assert activity.data["object"]["object"] == event_url
|
||||
assert activity.data["object"]["id"] =~ "/join/event/"
|
||||
assert activity.data["object"]["type"] =~ "Join"
|
||||
assert activity.data["actor"] == organizer_url
|
||||
assert activity.data["id"] =~ "/accept/join/"
|
||||
end
|
||||
|
||||
test "it accepts Accept activities for Join activities" do
|
||||
@@ -821,12 +873,17 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
|> Map.put("object", participation.url)
|
||||
|
||||
{:ok, reject_activity, _} = Transmogrifier.handle_incoming(reject_data)
|
||||
assert reject_activity.data["object"] == join_activity.data["id"]
|
||||
assert reject_activity.data["object"] =~ "/join/"
|
||||
assert reject_activity.data["object"]["id"] == join_activity.data["id"]
|
||||
assert reject_activity.data["object"]["id"] =~ "/join/"
|
||||
assert reject_activity.data["id"] =~ "/reject/join/"
|
||||
|
||||
# We don't accept already rejected Reject activities
|
||||
assert :error == Transmogrifier.handle_incoming(reject_data)
|
||||
assert capture_log([level: :warn], fn ->
|
||||
assert :error == Transmogrifier.handle_incoming(reject_data)
|
||||
end) =~
|
||||
"Unable to process Reject activity \"http://mastodon.example.org/users/admin#rejects/follows/4\". Object \"#{
|
||||
join_activity.data["id"]
|
||||
}\" wasn't found."
|
||||
|
||||
# Organiser is not present since we use factories directly
|
||||
assert event.id
|
||||
@@ -913,15 +970,6 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
assert Enum.member?(object["tag"], expected_mention)
|
||||
end
|
||||
|
||||
# test "it adds the sensitive property" do
|
||||
# user = insert(:user)
|
||||
|
||||
# {:ok, activity} = CommonAPI.post(user, %{"status" => "#nsfw hey"})
|
||||
# {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
# assert modified["object"]["sensitive"]
|
||||
# end
|
||||
|
||||
test "it adds the json-ld context and the conversation property" do
|
||||
actor = insert(:actor)
|
||||
|
||||
@@ -975,125 +1023,28 @@ defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do
|
||||
assert is_nil(modified["object"]["announcement_count"])
|
||||
assert is_nil(modified["object"]["context_id"])
|
||||
end
|
||||
end
|
||||
|
||||
# describe "actor rewriting" do
|
||||
# test "it fixes the actor URL property to be a proper URI" do
|
||||
# data = %{
|
||||
# "url" => %{"href" => "http://example.com"}
|
||||
# }
|
||||
describe "actor origin check" do
|
||||
test "it rejects objects with a bogus origin" do
|
||||
use_cassette "activity_pub/object_bogus_origin" do
|
||||
{:error, _} = ActivityPub.fetch_object_from_url("https://info.pleroma.site/activity.json")
|
||||
end
|
||||
end
|
||||
|
||||
# rewritten = Transmogrifier.maybe_fix_user_object(data)
|
||||
# assert rewritten["url"] == "http://example.com"
|
||||
# end
|
||||
# end
|
||||
test "it rejects activities which reference objects with bogus origins" do
|
||||
use_cassette "activity_pub/activity_object_bogus" do
|
||||
data = %{
|
||||
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||
"id" => "https://framapiaf.org/users/admin/activities/1234",
|
||||
"actor" => "https://framapiaf.org/users/admin",
|
||||
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"object" => "https://info.pleroma.site/activity.json",
|
||||
"type" => "Announce"
|
||||
}
|
||||
|
||||
# describe "actor origin containment" do
|
||||
# test "it rejects objects with a bogus origin" do
|
||||
# {:error, _} = ActivityPub.fetch_object_from_id("https://info.pleroma.site/activity.json")
|
||||
# end
|
||||
|
||||
# test "it rejects activities which reference objects with bogus origins" do
|
||||
# data = %{
|
||||
# "@context" => "https://www.w3.org/ns/activitystreams",
|
||||
# "id" => "http://mastodon.example.org/users/admin/activities/1234",
|
||||
# "actor" => "http://mastodon.example.org/users/admin",
|
||||
# "to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
# "object" => "https://info.pleroma.site/activity.json",
|
||||
# "type" => "Announce"
|
||||
# }
|
||||
|
||||
# :error = Transmogrifier.handle_incoming(data)
|
||||
# end
|
||||
|
||||
# test "it rejects objects when attributedTo is wrong (variant 1)" do
|
||||
# {:error, _} = ActivityPub.fetch_object_from_id("https://info.pleroma.site/activity2.json")
|
||||
# end
|
||||
|
||||
# test "it rejects activities which reference objects that have an incorrect attribution (variant 1)" do
|
||||
# data = %{
|
||||
# "@context" => "https://www.w3.org/ns/activitystreams",
|
||||
# "id" => "http://mastodon.example.org/users/admin/activities/1234",
|
||||
# "actor" => "http://mastodon.example.org/users/admin",
|
||||
# "to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
# "object" => "https://info.pleroma.site/activity2.json",
|
||||
# "type" => "Announce"
|
||||
# }
|
||||
|
||||
# :error = Transmogrifier.handle_incoming(data)
|
||||
# end
|
||||
|
||||
# test "it rejects objects when attributedTo is wrong (variant 2)" do
|
||||
# {:error, _} = ActivityPub.fetch_object_from_id("https://info.pleroma.site/activity3.json")
|
||||
# end
|
||||
|
||||
# test "it rejects activities which reference objects that have an incorrect attribution (variant 2)" do
|
||||
# data = %{
|
||||
# "@context" => "https://www.w3.org/ns/activitystreams",
|
||||
# "id" => "http://mastodon.example.org/users/admin/activities/1234",
|
||||
# "actor" => "http://mastodon.example.org/users/admin",
|
||||
# "to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
# "object" => "https://info.pleroma.site/activity3.json",
|
||||
# "type" => "Announce"
|
||||
# }
|
||||
|
||||
# :error = Transmogrifier.handle_incoming(data)
|
||||
# end
|
||||
# end
|
||||
|
||||
# describe "general origin containment" do
|
||||
# test "contain_origin_from_id() catches obvious spoofing attempts" do
|
||||
# data = %{
|
||||
# "id" => "http://example.com/~alyssa/activities/1234.json"
|
||||
# }
|
||||
|
||||
# :error =
|
||||
# Transmogrifier.contain_origin_from_id(
|
||||
# "http://example.org/~alyssa/activities/1234.json",
|
||||
# data
|
||||
# )
|
||||
# end
|
||||
|
||||
# test "contain_origin_from_id() allows alternate IDs within the same origin domain" do
|
||||
# data = %{
|
||||
# "id" => "http://example.com/~alyssa/activities/1234.json"
|
||||
# }
|
||||
|
||||
# :ok =
|
||||
# Transmogrifier.contain_origin_from_id(
|
||||
# "http://example.com/~alyssa/activities/1234",
|
||||
# data
|
||||
# )
|
||||
# end
|
||||
|
||||
# test "contain_origin_from_id() allows matching IDs" do
|
||||
# data = %{
|
||||
# "id" => "http://example.com/~alyssa/activities/1234.json"
|
||||
# }
|
||||
|
||||
# :ok =
|
||||
# Transmogrifier.contain_origin_from_id(
|
||||
# "http://example.com/~alyssa/activities/1234.json",
|
||||
# data
|
||||
# )
|
||||
# end
|
||||
|
||||
# test "users cannot be collided through fake direction spoofing attempts" do
|
||||
# user =
|
||||
# insert(:user, %{
|
||||
# nickname: "rye@niu.moe",
|
||||
# local: false,
|
||||
# ap_id: "https://niu.moe/users/rye",
|
||||
# follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
|
||||
# })
|
||||
|
||||
# {:error, _} = User.get_or_fetch_by_ap_id("https://n1u.moe/users/rye")
|
||||
# end
|
||||
|
||||
# test "all objects with fake directions are rejected by the object fetcher" do
|
||||
# {:error, _} =
|
||||
# ActivityPub.fetch_and_contain_remote_object_from_id(
|
||||
# "https://info.pleroma.site/activity4.json"
|
||||
# )
|
||||
# end
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||
|
||||
import Mobilizon.Factory
|
||||
|
||||
alias Mobilizon.Service.ActivityPub.{Converter, Utils}
|
||||
alias Mobilizon.Service.ActivityPub.Converter
|
||||
|
||||
alias MobilizonWeb.Endpoint
|
||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||
@@ -36,7 +36,8 @@ defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||
"uuid" => reply.uuid,
|
||||
"id" => Routes.page_url(Endpoint, :comment, reply.uuid),
|
||||
"inReplyTo" => comment.url,
|
||||
"attributedTo" => reply.actor.url
|
||||
"attributedTo" => reply.actor.url,
|
||||
"mediaType" => "text/html"
|
||||
} == Converter.Comment.model_to_as(reply)
|
||||
end
|
||||
|
||||
@@ -44,7 +45,7 @@ defmodule Mobilizon.Service.ActivityPub.UtilsTest do
|
||||
comment = insert(:comment)
|
||||
reply = insert(:comment, in_reply_to_comment: comment)
|
||||
to = ["https://www.w3.org/ns/activitystreams#Public"]
|
||||
comment_data = Utils.make_comment_data(reply.actor.url, to, reply.text, comment.url)
|
||||
comment_data = Converter.Comment.model_to_as(reply)
|
||||
assert comment_data["type"] == "Note"
|
||||
assert comment_data["to"] == to
|
||||
assert comment_data["content"] == reply.text
|
||||
|
||||
@@ -33,21 +33,21 @@ defmodule Mobilizon.Service.FormatterTest do
|
||||
text = "Hey, check out https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla ."
|
||||
|
||||
expected =
|
||||
"Hey, check out <a href=\"https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla\" target=\"_blank\" rel=\"noopener noreferrer\">https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla</a> ."
|
||||
"Hey, check out <a href=\"https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://www.youtube.com/watch?v=8Zg1-TufF%20zY?x=1&y=2#blabla</a> ."
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://mastodon.social/@lambadalambda"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://mastodon.social/@lambadalambda\" target=\"_blank\" rel=\"noopener noreferrer\">https://mastodon.social/@lambadalambda</a>"
|
||||
"<a href=\"https://mastodon.social/@lambadalambda\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://mastodon.social/@lambadalambda</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://mastodon.social:4000/@lambadalambda"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://mastodon.social:4000/@lambadalambda\" target=\"_blank\" rel=\"noopener noreferrer\">https://mastodon.social:4000/@lambadalambda</a>"
|
||||
"<a href=\"https://mastodon.social:4000/@lambadalambda\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://mastodon.social:4000/@lambadalambda</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
@@ -59,56 +59,57 @@ defmodule Mobilizon.Service.FormatterTest do
|
||||
text = "http://www.cs.vu.nl/~ast/intel/"
|
||||
|
||||
expected =
|
||||
"<a href=\"http://www.cs.vu.nl/~ast/intel/\" target=\"_blank\" rel=\"noopener noreferrer\">http://www.cs.vu.nl/~ast/intel/</a>"
|
||||
"<a href=\"http://www.cs.vu.nl/~ast/intel/\" target=\"_blank\" rel=\"noopener noreferrer ugc\">http://www.cs.vu.nl/~ast/intel/</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://forum.zdoom.org/viewtopic.php?f=44&t=57087"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://forum.zdoom.org/viewtopic.php?f=44&t=57087\" target=\"_blank\" rel=\"noopener noreferrer\">https://forum.zdoom.org/viewtopic.php?f=44&t=57087</a>"
|
||||
"<a href=\"https://forum.zdoom.org/viewtopic.php?f=44&t=57087\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://forum.zdoom.org/viewtopic.php?f=44&t=57087</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul\" target=\"_blank\" rel=\"noopener noreferrer\">https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
|
||||
"<a href=\"https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://www.google.co.jp/search?q=Nasim+Aghdam"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://www.google.co.jp/search?q=Nasim+Aghdam\" target=\"_blank\" rel=\"noopener noreferrer\">https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
|
||||
"<a href=\"https://www.google.co.jp/search?q=Nasim+Aghdam\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://en.wikipedia.org/wiki/Duff's_device"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://en.wikipedia.org/wiki/Duff's_device\" target=\"_blank\" rel=\"noopener noreferrer\">https://en.wikipedia.org/wiki/Duff's_device</a>"
|
||||
"<a href=\"https://en.wikipedia.org/wiki/Duff's_device\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://en.wikipedia.org/wiki/Duff's_device</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "https://pleroma.com https://pleroma.com/sucks"
|
||||
|
||||
expected =
|
||||
"<a href=\"https://pleroma.com\" target=\"_blank\" rel=\"noopener noreferrer\">https://pleroma.com</a> <a href=\"https://pleroma.com/sucks\" target=\"_blank\" rel=\"noopener noreferrer\">https://pleroma.com/sucks</a>"
|
||||
"<a href=\"https://pleroma.com\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://pleroma.com</a> <a href=\"https://pleroma.com/sucks\" target=\"_blank\" rel=\"noopener noreferrer ugc\">https://pleroma.com/sucks</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text = "xmpp:contact@hacktivis.me"
|
||||
|
||||
expected =
|
||||
"<a href=\"xmpp:contact@hacktivis.me\" target=\"_blank\" rel=\"noopener noreferrer\">xmpp:contact@hacktivis.me</a>"
|
||||
"<a href=\"xmpp:contact@hacktivis.me\" target=\"_blank\" rel=\"noopener noreferrer ugc\">xmpp:contact@hacktivis.me</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
|
||||
text =
|
||||
"magnet:?xt=urn:btih:7ec9d298e91d6e4394d1379caf073c77ff3e3136&tr=udp%3A%2F%2Fopentor.org%3A2710&tr=udp%3A%2F%2Ftracker.blackunicorn.xyz%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com"
|
||||
|
||||
expected = "<a href=\"#{text}\" target=\"_blank\" rel=\"noopener noreferrer\">#{text}</a>"
|
||||
expected =
|
||||
"<a href=\"#{text}\" target=\"_blank\" rel=\"noopener noreferrer ugc\">#{text}</a>"
|
||||
|
||||
assert {^expected, [], []} = Formatter.linkify(text)
|
||||
end
|
||||
@@ -117,32 +118,36 @@ defmodule Mobilizon.Service.FormatterTest do
|
||||
describe "add_user_links" do
|
||||
test "gives a replacement for user links, using local nicknames in user links text" do
|
||||
text = "@gsimg According to @archa_eme_, that is @daggsy. Also hello @archaeme@archae.me"
|
||||
_gsimg = insert(:actor, preferred_username: "gsimg")
|
||||
gsimg = insert(:actor, preferred_username: "gsimg")
|
||||
|
||||
_archaeme =
|
||||
archaeme =
|
||||
insert(:actor, preferred_username: "archa_eme_", url: "https://archeme/@archa_eme_")
|
||||
|
||||
_archaeme_remote = insert(:actor, preferred_username: "archaeme", domain: "archae.me")
|
||||
archaeme_remote = insert(:actor, preferred_username: "archaeme", domain: "archae.me")
|
||||
|
||||
{text, mentions, []} = Formatter.linkify(text)
|
||||
|
||||
assert length(mentions) == 3
|
||||
|
||||
expected_text =
|
||||
"<span class='h-card mention'>@<span>gsimg</span></span> According to <span class='h-card mention'>@<span>archa_eme_</span></span>, that is @daggsy. Also hello <span class='h-card mention'>@<span>archaeme</span></span>"
|
||||
"<span class='h-card mention' data-user='#{gsimg.id}'>@<span>gsimg</span></span> According to <span class='h-card mention' data-user='#{
|
||||
archaeme.id
|
||||
}'>@<span>archa_eme_</span></span>, that is @daggsy. Also hello <span class='h-card mention' data-user='#{
|
||||
archaeme_remote.id
|
||||
}'>@<span>archaeme</span></span>"
|
||||
|
||||
assert expected_text == text
|
||||
end
|
||||
|
||||
test "gives a replacement for single-character local nicknames" do
|
||||
text = "@o hi"
|
||||
_o = insert(:actor, preferred_username: "o")
|
||||
o = insert(:actor, preferred_username: "o")
|
||||
|
||||
{text, mentions, []} = Formatter.linkify(text)
|
||||
|
||||
assert length(mentions) == 1
|
||||
|
||||
expected_text = "<span class='h-card mention'>@<span>o</span></span> hi"
|
||||
expected_text = "<span class='h-card mention' data-user='#{o.id}'>@<span>o</span></span> hi"
|
||||
|
||||
assert expected_text == text
|
||||
end
|
||||
|
||||
@@ -14,7 +14,8 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||
|
||||
describe "reports" do
|
||||
test "creates a report on a event" do
|
||||
%Actor{id: reporter_id, url: reporter_url} = insert(:actor)
|
||||
%Actor{url: relay_reporter_url} = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
%Actor{id: reporter_id} = insert(:actor)
|
||||
%Actor{id: reported_id, url: reported_url} = reported = insert(:actor)
|
||||
|
||||
%Event{id: event_id, url: event_url} = _event = insert(:event, organizer_actor: reported)
|
||||
@@ -28,11 +29,11 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||
content: comment,
|
||||
event_id: event_id,
|
||||
comments_ids: [],
|
||||
local: true
|
||||
forward: false
|
||||
})
|
||||
|
||||
assert %Activity{
|
||||
actor: ^reporter_url,
|
||||
actor: ^relay_reporter_url,
|
||||
data: %{
|
||||
"type" => "Flag",
|
||||
"cc" => [],
|
||||
@@ -43,7 +44,8 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||
end
|
||||
|
||||
test "creates a report on several comments" do
|
||||
%Actor{id: reporter_id, url: reporter_url} = insert(:actor)
|
||||
%Actor{url: relay_reporter_url} = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
%Actor{id: reporter_id} = insert(:actor)
|
||||
%Actor{id: reported_id, url: reported_url} = reported = insert(:actor)
|
||||
|
||||
%Comment{id: comment_1_id, url: comment_1_url} =
|
||||
@@ -64,20 +66,21 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||
})
|
||||
|
||||
assert %Activity{
|
||||
actor: ^reporter_url,
|
||||
actor: ^relay_reporter_url,
|
||||
data: %{
|
||||
"type" => "Flag",
|
||||
"content" => ^comment,
|
||||
"object" => [^reported_url, ^comment_1_url, ^comment_2_url],
|
||||
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
|
||||
"to" => [],
|
||||
"cc" => [],
|
||||
"actor" => ^reporter_url
|
||||
"actor" => ^relay_reporter_url
|
||||
}
|
||||
} = flag_activity
|
||||
end
|
||||
|
||||
test "creates a report that gets federated" do
|
||||
%Actor{id: reporter_id, url: reporter_url} = insert(:actor)
|
||||
%Actor{url: relay_reporter_url} = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
%Actor{id: reporter_id} = insert(:actor)
|
||||
%Actor{id: reported_id, url: reported_url} = reported = insert(:actor)
|
||||
|
||||
%Comment{id: comment_1_id, url: comment_1_url} =
|
||||
@@ -96,21 +99,21 @@ defmodule MobilizonWeb.API.ReportTest do
|
||||
content: comment,
|
||||
event_id: nil,
|
||||
comments_ids: [comment_1_id, comment_2_id],
|
||||
local: false
|
||||
forward: true
|
||||
})
|
||||
|
||||
assert %Activity{
|
||||
actor: ^reporter_url,
|
||||
actor: ^relay_reporter_url,
|
||||
data: %{
|
||||
"type" => "Flag",
|
||||
"actor" => ^reporter_url,
|
||||
"actor" => ^relay_reporter_url,
|
||||
"cc" => [^reported_url],
|
||||
"content" => ^encoded_comment,
|
||||
"object" => [^reported_url, ^comment_1_url, ^comment_2_url],
|
||||
"to" => ["https://www.w3.org/ns/activitystreams#Public"]
|
||||
"to" => []
|
||||
},
|
||||
local: true,
|
||||
recipients: ["https://www.w3.org/ns/activitystreams#Public", ^reported_url]
|
||||
recipients: [^reported_url]
|
||||
} = flag_activity
|
||||
end
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ defmodule MobilizonWeb.ActivityPubControllerTest do
|
||||
alias MobilizonWeb.PageView
|
||||
alias MobilizonWeb.Router.Helpers, as: Routes
|
||||
|
||||
setup_all do
|
||||
Mobilizon.Config.put([:instance, :federating], true)
|
||||
:ok
|
||||
end
|
||||
|
||||
setup do
|
||||
conn = build_conn() |> put_req_header("accept", "application/activity+json")
|
||||
{:ok, conn: conn}
|
||||
@@ -34,7 +39,10 @@ defmodule MobilizonWeb.ActivityPubControllerTest do
|
||||
|
||||
actor = Actors.get_actor!(actor.id)
|
||||
|
||||
assert json_response(conn, 200) == ActorView.render("actor.json", %{actor: actor})
|
||||
assert json_response(conn, 200) ==
|
||||
ActorView.render("actor.json", %{actor: actor})
|
||||
|> Jason.encode!()
|
||||
|> Jason.decode!()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ defmodule MobilizonWeb.WebFingerTest do
|
||||
alias Mobilizon.Service.WebFinger
|
||||
import Mobilizon.Factory
|
||||
|
||||
setup_all do
|
||||
Mobilizon.Config.put([:instance, :federating], true)
|
||||
:ok
|
||||
end
|
||||
|
||||
test "GET /.well-known/host-meta", %{conn: conn} do
|
||||
conn = get(conn, "/.well-known/host-meta")
|
||||
|
||||
|
||||
30
test/mobilizon_web/plugs/federating_plug_test.exs
Normal file
30
test/mobilizon_web/plugs/federating_plug_test.exs
Normal file
@@ -0,0 +1,30 @@
|
||||
# Portions of this file are derived from Pleroma:
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule MobilizonWeb.Plug.FederatingTest do
|
||||
use MobilizonWeb.ConnCase
|
||||
|
||||
test "returns and halt the conn when federating is disabled" do
|
||||
Mobilizon.Config.put([:instance, :federating], false)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> MobilizonWeb.Plugs.Federating.call(%{})
|
||||
|
||||
assert conn.status == 404
|
||||
assert conn.halted
|
||||
end
|
||||
|
||||
test "does nothing when federating is enabled" do
|
||||
Mobilizon.Config.put([:instance, :federating], true)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> MobilizonWeb.Plugs.Federating.call(%{})
|
||||
|
||||
refute conn.status
|
||||
refute conn.halted
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
# Portions of this file are derived from Pleroma:
|
||||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule MobilizonWeb.Plugs.MappedSignatureToIdentityPlugTest do
|
||||
use MobilizonWeb.ConnCase
|
||||
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
|
||||
alias MobilizonWeb.Plugs.MappedSignatureToIdentity
|
||||
|
||||
defp set_signature(conn, key_id) do
|
||||
conn
|
||||
|> put_req_header("signature", "keyId=\"#{key_id}\"")
|
||||
|> assign(:valid_signature, true)
|
||||
end
|
||||
|
||||
test "it successfully maps a valid identity with a valid signature" do
|
||||
use_cassette "activity_pub/signature/valid" do
|
||||
conn =
|
||||
build_conn(:get, "/doesntmattter")
|
||||
|> set_signature("https://framapiaf.org/users/admin")
|
||||
|> MappedSignatureToIdentity.call(%{})
|
||||
|
||||
refute is_nil(conn.assigns.actor)
|
||||
end
|
||||
end
|
||||
|
||||
test "it successfully maps a valid identity with a valid signature with payload" do
|
||||
use_cassette "activity_pub/signature/valid_payload" do
|
||||
conn =
|
||||
build_conn(:post, "/doesntmattter", %{"actor" => "https://framapiaf.org/users/admin"})
|
||||
|> set_signature("https://framapiaf.org/users/admin")
|
||||
|> MappedSignatureToIdentity.call(%{})
|
||||
|
||||
refute is_nil(conn.assigns.actor)
|
||||
end
|
||||
end
|
||||
|
||||
test "it considers a mapped identity to be invalid when it mismatches a payload" do
|
||||
use_cassette "activity_pub/signature/invalid_payload" do
|
||||
conn =
|
||||
build_conn(:post, "/doesntmattter", %{"actor" => "https://framapiaf.org/users/admin"})
|
||||
|> set_signature("https://niu.moe/users/rye")
|
||||
|> MappedSignatureToIdentity.call(%{})
|
||||
|
||||
assert %{valid_signature: false} == conn.assigns
|
||||
end
|
||||
end
|
||||
|
||||
test "it considers a mapped identity to be invalid when the identity cannot be found" do
|
||||
use_cassette "activity_pub/signature/invalid_not_found" do
|
||||
conn =
|
||||
build_conn(:post, "/doesntmattter", %{"actor" => "https://framapiaf.org/users/admin"})
|
||||
|> set_signature("http://niu.moe/users/rye")
|
||||
|> MappedSignatureToIdentity.call(%{})
|
||||
|
||||
assert %{valid_signature: false} == conn.assigns
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -121,4 +121,99 @@ defmodule MobilizonWeb.Resolvers.AdminResolverTest do
|
||||
title
|
||||
end
|
||||
end
|
||||
|
||||
describe "Resolver: Get the list of relay followers" do
|
||||
test "test list_relay_followers/3 returns relay followers", %{conn: conn} do
|
||||
%User{} = user_admin = insert(:user, role: :administrator)
|
||||
|
||||
follower_actor =
|
||||
insert(:actor,
|
||||
domain: "localhost",
|
||||
user: nil,
|
||||
url: "http://localhost:8080/actor",
|
||||
preferred_username: "instance_actor",
|
||||
name: "I am an instance actor"
|
||||
)
|
||||
|
||||
%Actor{} = relay_actor = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
insert(:follower, actor: follower_actor, target_actor: relay_actor)
|
||||
|
||||
query = """
|
||||
{
|
||||
relayFollowers {
|
||||
elements {
|
||||
actor {
|
||||
preferredUsername,
|
||||
domain,
|
||||
},
|
||||
approved
|
||||
},
|
||||
total
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
res =
|
||||
conn
|
||||
|> auth_conn(user_admin)
|
||||
|> AbsintheHelpers.graphql_query(query: query)
|
||||
|
||||
assert is_nil(res["errors"])
|
||||
|
||||
assert hd(res["data"]["relayFollowers"]["elements"]) == %{
|
||||
"actor" => %{"preferredUsername" => "instance_actor", "domain" => "localhost"},
|
||||
"approved" => false
|
||||
}
|
||||
end
|
||||
|
||||
test "test list_relay_followers/3 returns relay followings", %{conn: conn} do
|
||||
%User{} = user_admin = insert(:user, role: :administrator)
|
||||
|
||||
%Actor{
|
||||
preferred_username: following_actor_preferred_username,
|
||||
domain: following_actor_domain
|
||||
} =
|
||||
following_actor =
|
||||
insert(:actor,
|
||||
domain: "localhost",
|
||||
user: nil,
|
||||
url: "http://localhost:8080/actor",
|
||||
preferred_username: "instance_actor",
|
||||
name: "I am an instance actor"
|
||||
)
|
||||
|
||||
%Actor{} = relay_actor = Mobilizon.Service.ActivityPub.Relay.get_actor()
|
||||
insert(:follower, actor: relay_actor, target_actor: following_actor)
|
||||
|
||||
query = """
|
||||
{
|
||||
relayFollowings {
|
||||
elements {
|
||||
targetActor {
|
||||
preferredUsername,
|
||||
domain,
|
||||
},
|
||||
approved
|
||||
},
|
||||
total
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
res =
|
||||
conn
|
||||
|> auth_conn(user_admin)
|
||||
|> AbsintheHelpers.graphql_query(query: query)
|
||||
|
||||
assert is_nil(res["errors"])
|
||||
|
||||
assert hd(res["data"]["relayFollowings"]["elements"]) == %{
|
||||
"targetActor" => %{
|
||||
"preferredUsername" => following_actor_preferred_username,
|
||||
"domain" => following_actor_domain
|
||||
},
|
||||
"approved" => false
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -199,7 +199,9 @@ defmodule MobilizonWeb.Resolvers.ParticipantResolverTest do
|
||||
user: user,
|
||||
actor: actor
|
||||
} do
|
||||
event = insert(:event, %{organizer_actor: actor})
|
||||
event =
|
||||
insert(:event, %{organizer_actor: actor, participant_stats: %{creator: 1, participant: 1}})
|
||||
|
||||
insert(:participant, %{actor: actor, event: event, role: :creator})
|
||||
user2 = insert(:user)
|
||||
actor2 = insert(:actor, user: user2)
|
||||
|
||||
@@ -3,6 +3,7 @@ defmodule MobilizonWeb.Resolvers.PersonResolverTest do
|
||||
alias MobilizonWeb.AbsintheHelpers
|
||||
alias Mobilizon.Actors.Actor
|
||||
import Mobilizon.Factory
|
||||
use Oban.Testing, repo: Mobilizon.Storage.Repo
|
||||
|
||||
@non_existent_username "nonexistent"
|
||||
|
||||
@@ -478,7 +479,7 @@ defmodule MobilizonWeb.Resolvers.PersonResolverTest do
|
||||
"Cannot remove the last administrator of a group"
|
||||
end
|
||||
|
||||
test "delete_person/3 should delete a user identity", context do
|
||||
test "delete_person/3 should delete an actor identity", context do
|
||||
user = insert(:user)
|
||||
%Actor{id: person_id} = insert(:actor, user: user, preferred_username: "riri")
|
||||
insert(:actor, user: user, preferred_username: "fifi")
|
||||
@@ -498,6 +499,13 @@ defmodule MobilizonWeb.Resolvers.PersonResolverTest do
|
||||
|
||||
assert json_response(res, 200)["errors"] == nil
|
||||
|
||||
assert_enqueued(
|
||||
worker: Mobilizon.Service.Workers.BackgroundWorker,
|
||||
args: %{"actor_id" => person_id, "op" => "delete_actor"}
|
||||
)
|
||||
|
||||
assert %{success: 1, failure: 0} == Oban.drain_queue(:background)
|
||||
|
||||
query = """
|
||||
{
|
||||
person(id: "#{person_id}") {
|
||||
|
||||
@@ -25,7 +25,7 @@ defmodule MobilizonWeb.AbsintheHelpers do
|
||||
conn
|
||||
|> post(
|
||||
"/api",
|
||||
build_query(options[:query], options[:variables])
|
||||
build_query(options[:query], Keyword.get(options, :variables, %{}))
|
||||
)
|
||||
|> json_response(200)
|
||||
end
|
||||
|
||||
@@ -14,14 +14,14 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
describe "running follow" do
|
||||
test "relay is followed" do
|
||||
use_cassette "relay/fetch_relay_follow" do
|
||||
target_instance = "http://localhost:8080/actor"
|
||||
target_instance = "mobilizon1.com"
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["follow", target_instance])
|
||||
|
||||
local_actor = Relay.get_actor()
|
||||
assert local_actor.url =~ "/relay"
|
||||
|
||||
{:ok, target_actor} = Actors.get_actor_by_url(target_instance)
|
||||
{:ok, target_actor} = Actors.get_actor_by_url("http://#{target_instance}/relay")
|
||||
refute is_nil(target_actor.domain)
|
||||
|
||||
assert Actors.is_following(local_actor, target_actor)
|
||||
@@ -32,12 +32,15 @@ defmodule Mix.Tasks.Mobilizon.RelayTest do
|
||||
describe "running unfollow" do
|
||||
test "relay is unfollowed" do
|
||||
use_cassette "relay/fetch_relay_unfollow" do
|
||||
target_instance = "http://localhost:8080/actor"
|
||||
target_instance = "mobilizon1.com"
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["follow", target_instance])
|
||||
|
||||
%Actor{} = local_actor = Relay.get_actor()
|
||||
{:ok, %Actor{} = target_actor} = Actors.get_actor_by_url(target_instance)
|
||||
|
||||
{:ok, %Actor{} = target_actor} =
|
||||
Actors.get_actor_by_url("http://#{target_instance}/relay")
|
||||
|
||||
assert %Follower{} = Actors.is_following(local_actor, target_actor)
|
||||
|
||||
Mix.Tasks.Mobilizon.Relay.run(["unfollow", target_instance])
|
||||
|
||||
Reference in New Issue
Block a user