[WIP] Test transmogrifier

Introduce MobilizonWeb.API namespace

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Format

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

WIP

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

remove unneeded code

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Fix tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Fix warnings

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-12-14 17:41:55 +01:00
parent e3a8343112
commit c1e6612405
41 changed files with 2961 additions and 246 deletions

37
test/fixtures/mastodon-announce.json vendored Normal file
View File

@@ -0,0 +1,37 @@
{
"type": "Announce",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"signature": {
"type": "RsaSignature2017",
"signatureValue": "T95DRE0eAligvMuRMkQA01lsoz2PKi4XXF+cyZ0BqbrO12p751TEWTyyRn5a+HH0e4kc77EUhQVXwMq80WAYDzHKVUTf2XBJPBa68vl0j6RXw3+HK4ef5hR4KWFNBU34yePS7S1fEmc1mTG4Yx926wtmZwDpEMTp1CXOeVEjCYzmdyHpepPPH2ZZettiacmPRSqBLPGWZoot7kH/SioIdnrMGY0I7b+rqkIdnnEcdhu9N1BKPEO9Sr+KmxgAUiidmNZlbBXX6gCxp8BiIdH4ABsIcwoDcGNkM5EmWunGW31LVjsEQXhH5c1Wly0ugYYPCg/0eHLNBOhKkY/teSM8Lg==",
"creator": "https://social.tcit.fr/users/tcit#main-key",
"created": "2018-02-17T19:39:15Z"
},
"published": "2018-02-17T19:39:15Z",
"object": "https://social.tcit.fr/@tcit/101188891162897047",
"id": "https://social.tcit.fr/users/tcit/statuses/101188891162897047/activity",
"cc": [
"https://social.tcit.fr/users/tcit",
"https://social.tcit.fr/users/tcit/followers"
],
"atomUri": "https://social.tcit.fr/users/tcit/statuses/101188891162897047/activity",
"actor": "https://social.tcit.fr/users/tcit",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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"
}
]
}

33
test/fixtures/mastodon-delete.json vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"type": "Delete",
"signature": {
"type": "RsaSignature2017",
"signatureValue": "cw0RlfNREf+5VdsOYcCBDrv521eiLsDTAYNHKffjF0bozhCnOh+wHkFik7WamUk$
uEiN4L2H6vPlGRprAZGRhEwgy+A7rIFQNmLrpW5qV5UNVI/2F7kngEHqZQgbQYj9hW+5GMYmPkHdv3D72ZefGw$
4Xa2NBLGFpAjQllfzt7kzZLKKY2DM99FdUa64I2Wj3iD04Hs23SbrUdAeuGk/c1Cg6bwGNG4vxoiwn1jikgJLA$
NAlSGjsRGdR7LfbC7GqWWsW3cSNsLFPoU6FyALjgTrrYoHiXe0QHggw+L3yMLfzB2S/L46/VRbyb+WDKMBIXUL$
5owmzHSi6e/ZtCI3w==",
"creator": "http://mastodon.example.org/users/gargron#main-key", "created": "2018-03-03T16:24:11Z"
},
"object": {
"type": "Tombstone",
"id": "http://mastodon.example.org/users/gargron/statuses/99620895606148759",
"atomUri": "http://mastodon.example.org/users/gargron/statuses/99620895606148759"
},
"id": "http://mastodon.example.org/users/gargron/statuses/99620895606148759#delete",
"actor": "http://mastodon.example.org/users/gargron",
"@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"
}
]
}

View File

@@ -0,0 +1,29 @@
{
"type": "Follow",
"signature": {
"type": "RsaSignature2017",
"signatureValue": "Kn1/UkAQGJVaXBfWLAHcnwHg8YMAUqlEaBuYLazAG+pz5hqivsyrBmPV186Xzr+B4ZLExA9+SnOoNx/GOz4hBm0kAmukNSILAsUd84tcJ2yT9zc1RKtembK4WiwOw7li0+maeDN0HaB6t+6eTqsCWmtiZpprhXD8V1GGT8yG7X24fQ9oFGn+ng7lasbcCC0988Y1eGqNe7KryxcPuQz57YkDapvtONzk8gyLTkZMV4De93MyRHq6GVjQVIgtiYabQAxrX6Q8C+4P/jQoqdWJHEe+MY5JKyNaT/hMPt2Md1ok9fZQBGHlErk22/zy8bSN19GdG09HmIysBUHRYpBLig==",
"creator": "https://social.tcit.fr/users/tcit#main-key",
"created": "2018-02-17T13:29:31Z"
},
"object": "http://localtesting.pleroma.lol/users/lain",
"nickname": "lain",
"id": "https://social.tcit.fr/users/tcit#follows/2",
"actor": "https://social.tcit.fr/users/tcit",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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/mastodon-like.json vendored Normal file
View File

@@ -0,0 +1,29 @@
{
"type": "Like",
"signature": {
"type": "RsaSignature2017",
"signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
"creator": "http://mastodon.example.org/users/admin#main-key",
"created": "2018-02-17T18:57:49Z"
},
"object": "http://localtesting.pleroma.lol/objects/eb92579d-3417-42a8-8652-2492c2d4f454",
"nickname": "lain",
"id": "http://mastodon.example.org/users/admin#likes/2",
"actor": "http://mastodon.example.org/users/admin",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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"
}
]
}

View File

@@ -0,0 +1,70 @@
{
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"Emoji": "toot:Emoji",
"Hashtag": "as:Hashtag",
"atomUri": "ostatus:atomUri",
"conversation": "ostatus:conversation",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"movedTo": "as:movedTo",
"ostatus": "http://ostatus.org#",
"sensitive": "as:sensitive",
"toot": "http://joinmastodon.org/ns#"
}
],
"actor": "https://framapiaf.org/users/admin",
"cc": [
"https://framapiaf.org/users/admin/followers",
"http://mobilizon.com/@tcit"
],
"id": "https://framapiaf.org/users/admin/statuses/99512778738411822/activity",
"nickname": "lain",
"object": {
"atomUri": "https://framapiaf.org/users/admin/statuses/99512778738411822",
"attachment": [],
"attributedTo": "https://framapiaf.org/users/admin",
"cc": [
"https://framapiaf.org/users/admin/followers",
"http://localtesting.pleroma.lol/users/lain"
],
"content": "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span> #moo</p>",
"conversation": "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation",
"id": "https://framapiaf.org/users/admin/statuses/99512778738411822",
"inReplyTo": null,
"inReplyToAtomUri": null,
"published": "2018-02-12T14:08:20Z",
"sensitive": true,
"summary": "cw",
"tag": [
{
"href": "http://localtesting.pleroma.lol/users/lain",
"name": "@lain@localtesting.pleroma.lol",
"type": "Mention"
},
{
"href": "http://mastodon.example.org/tags/moo",
"name": "#moo",
"type": "Hashtag"
}
],
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Note",
"url": "https://framapiaf.org/@admin/99512778738411822"
},
"published": "2018-02-12T14:08:20Z",
"signature": {
"created": "2018-02-12T14:08:20Z",
"creator": "https://framapiaf.org/users/admin#main-key",
"signatureValue": "rnNfcopkc6+Ju73P806popcfwrK9wGYHaJVG1/ZvrlEbWVDzaHjkXqj9Q3/xju5l8CSn9tvSgCCtPFqZsFQwn/pFIFUcw7ZWB2xi4bDm3NZ3S4XQ8JRaaX7og5hFxAhWkGhJhAkfxVnOg2hG+w2d/7d7vRVSC1vo5ip4erUaA/PkWusZvPIpxnRWoXaxJsFmVx0gJgjpJkYDyjaXUlp+jmaoseeZ4EPQUWqHLKJ59PRG0mg8j2xAjYH9nQaN14qMRmTGPxY8gfv/CUFcatA+8VJU9KEsJkDAwLVvglydNTLGrxpAJU78a2eaht0foV43XUIZGe3DKiJPgE+UOKGCJw==",
"type": "RsaSignature2017"
},
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Create"
}

View File

@@ -15,24 +15,24 @@
"toot": "http://joinmastodon.org/ns#"
}
],
"actor": "http://framapiaf.org/users/admin",
"actor": "https://framapiaf.org/users/admin",
"cc": [
"http://framapiaf.org/users/admin/followers",
"https://framapiaf.org/users/admin/followers",
"http://mobilizon.com/@tcit"
],
"id": "http://framapiaf.org/users/admin/statuses/99512778738411822/activity",
"id": "https://framapiaf.org/users/admin/statuses/99512778738411822/activity",
"nickname": "lain",
"object": {
"atomUri": "http://framapiaf.org/users/admin/statuses/99512778738411822",
"atomUri": "https://framapiaf.org/users/admin/statuses/99512778738411822",
"attachment": [],
"attributedTo": "http://framapiaf.org/users/admin",
"attributedTo": "https://framapiaf.org/users/admin",
"cc": [
"http://framapiaf.org/users/admin/followers",
"https://framapiaf.org/users/admin/followers",
"http://localtesting.pleroma.lol/users/lain"
],
"content": "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span></p>",
"conversation": "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation",
"id": "http://framapiaf.org/users/admin/statuses/99512778738411822",
"id": "https://framapiaf.org/users/admin/statuses/99512778738411822",
"inReplyTo": null,
"inReplyToAtomUri": null,
"published": "2018-02-12T14:08:20Z",
@@ -49,12 +49,12 @@
"https://www.w3.org/ns/activitystreams#Public"
],
"type": "Note",
"url": "http://framapiaf.org/@admin/99512778738411822"
"url": "https://framapiaf.org/@admin/99512778738411822"
},
"published": "2018-02-12T14:08:20Z",
"signature": {
"created": "2018-02-12T14:08:20Z",
"creator": "http://framapiaf.org/users/admin#main-key",
"creator": "https://framapiaf.org/users/admin#main-key",
"signatureValue": "rnNfcopkc6+Ju73P806popcfwrK9wGYHaJVG1/ZvrlEbWVDzaHjkXqj9Q3/xju5l8CSn9tvSgCCtPFqZsFQwn/pFIFUcw7ZWB2xi4bDm3NZ3S4XQ8JRaaX7og5hFxAhWkGhJhAkfxVnOg2hG+w2d/7d7vRVSC1vo5ip4erUaA/PkWusZvPIpxnRWoXaxJsFmVx0gJgjpJkYDyjaXUlp+jmaoseeZ4EPQUWqHLKJ59PRG0mg8j2xAjYH9nQaN14qMRmTGPxY8gfv/CUFcatA+8VJU9KEsJkDAwLVvglydNTLGrxpAJU78a2eaht0foV43XUIZGe3DKiJPgE+UOKGCJw==",
"type": "RsaSignature2017"
},

View File

@@ -0,0 +1,47 @@
{
"type": "Undo",
"signature": {
"type": "RsaSignature2017",
"signatureValue": "VU9AmHf3Pus9cWtMG/TOdxr+MRQfPHdTVKBBgFJBXhAlMhxEtcbxsu7zmqBgfIz6u0HpTCi5jRXEMftc228OJf/aBUkr4hyWADgcdmhPQgpibouDLgQf9BmnrPqb2rMbzZyt49GJkQZma8taLh077TTq6OKcnsAAJ1evEKOcRYS4OxBSwh4nI726bOXzZWoNzpTcrnm+llcUEN980sDSAS0uyZdb8AxZdfdG6DJQX4AkUD5qTpfqP/vC1ISirrNphvVhlxjUV9Amr4SYTsLx80vdZe5NjeL5Ir4jTIIQLedpxaDu1M9Q+Jpc0fYByQ2hOwUq8JxEmvHvarKjrq0Oww==",
"creator": "http://mastodon.example.org/users/admin#main-key",
"created": "2018-05-11T16:23:45Z"
},
"object": {
"type": "Announce",
"to": [
"http://www.w3.org/ns/activitystreams#Public"
],
"published": "2018-05-11T16:23:37Z",
"object": "http://mastodon.example.org/@admin/99541947525187367",
"id": "http://mastodon.example.org/users/admin/statuses/99542391527669785/activity",
"cc": [
"http://mastodon.example.org/users/admin",
"http://mastodon.example.org/users/admin/followers"
],
"atomUri": "http://mastodon.example.org/users/admin/statuses/99542391527669785/activity",
"actor": "http://mastodon.example.org/users/admin"
},
"id": "http://mastodon.example.org/users/admin#announces/100011594053806179/undo",
"actor": "http://mastodon.example.org/users/admin",
"@context": [
"http://www.w3.org/ns/activitystreams",
"http://w3id.org/security/v1",
{
"toot": "http://joinmastodon.org/ns#",
"sensitive": "as:sensitive",
"ostatus": "http://ostatus.org#",
"movedTo": "as:movedTo",
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
"focalPoint": {
"@id": "toot:focalPoint",
"@container": "@list"
},
"featured": "toot:featured",
"conversation": "ostatus:conversation",
"atomUri": "ostatus:atomUri",
"Hashtag": "as:Hashtag",
"Emoji": "toot:Emoji"
}
]
}

34
test/fixtures/mastodon-undo-like.json vendored Normal file
View File

@@ -0,0 +1,34 @@
{
"type": "Undo",
"signature": {
"type": "RsaSignature2017",
"signatureValue": "fdxMfQSMwbC6wP6sh6neS/vM5879K67yQkHTbiT5Npr5wAac0y6+o3Ij+41tN3rL6wfuGTosSBTHOtta6R4GCOOhCaCSLMZKypnp1VltCzLDoyrZELnYQIC8gpUXVmIycZbREk22qWUe/w7DAFaKK4UscBlHDzeDVcA0K3Se5Sluqi9/Zh+ldAnEzj/rSEPDjrtvf5wGNf3fHxbKSRKFt90JvKK6hS+vxKUhlRFDf6/SMETw+EhwJSNW4d10yMUakqUWsFv4Acq5LW7l+HpYMvlYY1FZhNde1+uonnCyuQDyvzkff8zwtEJmAXC4RivO/VVLa17SmqheJZfI8oluVg==",
"creator": "http://mastodon.example.org/users/admin#main-key",
"created": "2018-05-19T16:36:58Z"
},
"object": {
"type": "Like",
"object": "http://localtesting.pleroma.lol/objects/eb92579d-3417-42a8-8652-2492c2d4f454",
"id": "http://mastodon.example.org/users/admin#likes/2",
"actor": "http://mastodon.example.org/users/admin"
},
"nickname": "lain",
"id": "http://mastodon.example.org/users/admin#likes/2/undo",
"actor": "http://mastodon.example.org/users/admin",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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"
}
]
}

View File

@@ -0,0 +1,34 @@
{
"@context":[
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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"
}
],
"signature":{
"type":"RsaSignature2017",
"signatureValue":"Kn1/UkAQGJVaXBfWLAHcnwHg8YMAUqlEaBuYLazAG+pz5hqivsyrBmPV186Xzr+B4ZLExA9+SnOoNx/GOz4hBm0kAmukNSILAsUd84tcJ2yT9zc1RKtembK4WiwOw7li0+maeDN0HaB6t+6eTqsCWmtiZpprhXD8V1GGT8yG7X24fQ9oFGn+ng7lasbcCC0988Y1eGqNe7KryxcPuQz57YkDapvtONzk8gyLTkZMV4De93MyRHq6GVjQVIgtiYabQAxrX6Q8C+4P/jQoqdWJHEe+MY5JKyNaT/hMPt2Md1ok9fZQBGHlErk22/zy8bSN19GdG09HmIysBUHRYpBLig==",
"creator":"https://social.tcit.fr/users/tcit#main-key",
"created":"2018-02-17T13:29:31Z"
},
"type":"Undo",
"object":{
"type":"Follow",
"object":"http://localtesting.pleroma.lol/users/lain",
"nickname":"lain",
"id":"https://social.tcit.fr/users/tcit#follows/2",
"actor":"https://social.tcit.fr/users/tcit"
},
"actor":"https://social.tcit.fr/users/tcit",
"id": "https://social.tcit.fr/users/tcit#follow/2/undo"
}

43
test/fixtures/mastodon-update.json vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"type": "Update",
"object": {
"url": "http://mastodon.example.org/@gargron",
"type": "Person",
"summary": "<p>Some bio</p>",
"publicKey": {
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0gs3VnQf6am3R+CeBV4H\nlfI1HZTNRIBHgvFszRZkCERbRgEWMu+P+I6/7GJC5H5jhVQ60z4MmXcyHOGmYMK/\n5XyuHQz7V2Ssu1AxLfRN5Biq1ayb0+DT/E7QxNXDJPqSTnstZ6C7zKH/uAETqg3l\nBonjCQWyds+IYbQYxf5Sp3yhvQ80lMwHML3DaNCMlXWLoOnrOX5/yK5+dedesg2\n/HIvGk+HEt36vm6hoH7bwPuEkgA++ACqwjXRe5Mta7i3eilHxFaF8XIrJFARV0t\nqOu4GID/jG6oA+swIWndGrtR2QRJIt9QIBFfK3HG5M0koZbY1eTqwNFRHFL3xaD\nUQIDAQAB\n-----END PUBLIC KEY-----\n",
"owner": "http://mastodon.example.org/users/gargron",
"id": "http://mastodon.example.org/users/gargron#main-key"
},
"preferredUsername": "gargron",
"outbox": "http://mastodon.example.org/users/gargron/outbox",
"name": "gargle",
"manuallyApprovesFollowers": false,
"inbox": "http://mastodon.example.org/users/gargron/inbox",
"id": "http://mastodon.example.org/users/gargron",
"following": "http://mastodon.example.org/users/gargron/following",
"followers": "http://mastodon.example.org/users/gargron/followers",
"endpoints": {
"sharedInbox": "http://mastodon.example.org/inbox"
},
"icon":{"type":"Image","mediaType":"image/jpeg","url":"https://cd.niu.moe/accounts/avatars/000/033/323/original/fd7f8ae0b3ffedc9.jpeg"},"image":{"type":"Image","mediaType":"image/png","url":"https://cd.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"}
},
"id": "http://mastodon.example.org/users/gargron#updates/1519563538",
"actor": "http://mastodon.example.org/users/gargron",
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"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"
}
]
}

65
test/fixtures/prismo-url-map.json vendored Normal file
View File

@@ -0,0 +1,65 @@
{
"id": "https://prismo.news/posts/83#Create",
"type": "Create",
"actor": [
{
"type": "Person",
"id": "https://prismo.news/@mxb"
}
],
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"object": {
"id": "https://prismo.news/posts/83",
"type": "Article",
"name": "Introducing: Federated follows!",
"published": "2018-11-01T07:10:05Z",
"content": "We are more than thrilled to announce that Prismo now supports federated follows! It means you ca...",
"url": {
"type": "Link",
"mimeType": "text/html",
"href": "https://prismo.news/posts/83"
},
"votes": 12,
"attributedTo": [
{
"type": "Person",
"id": "https://prismo.news/@mxb"
}
],
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"tags": [
{
"type": "Hashtag",
"href": "https://prismo.news/tags/prismo",
"name": "#prismo"
},
{
"type": "Hashtag",
"href": "https://prismo.news/tags/prismodev",
"name": "#prismodev"
},
{
"type": "Hashtag",
"href": "https://prismo.news/tags/meta",
"name": "#meta"
}
],
"@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
{
"Hashtag": "as:Hashtag"
},
{
"votes": {
"@id": "as:votes",
"@type": "@id"
}
}
]
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,156 @@
[
{
"request": {
"body": "",
"headers": {
"Accept": "application/activity+json"
},
"method": "get",
"options": {
"follow_redirect": "true",
"recv_timeout": 20000,
"connect_timeout": 10000
},
"request_body": "",
"url": "https://social.tcit.fr/users/tcit/statuses/101160654038714030"
},
"response": {
"binary": false,
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://social.tcit.fr/users/tcit/statuses/101160654038714030\",\"type\":\"Note\",\"summary\":null,\"inReplyTo\":\"https://social.tcit.fr/users/tcit/statuses/101160195754333819\",\"published\":\"2018-11-30T14:44:41Z\",\"url\":\"https://social.tcit.fr/@tcit/101160654038714030\",\"attributedTo\":\"https://social.tcit.fr/users/tcit\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://social.tcit.fr/users/tcit/followers\"],\"sensitive\":false,\"atomUri\":\"https://social.tcit.fr/users/tcit/statuses/101160654038714030\",\"inReplyToAtomUri\":\"https://social.tcit.fr/users/tcit/statuses/101160195754333819\",\"conversation\":\"tag:social.tcit.fr,2018-11-30:objectId=3642669:objectType=Conversation\",\"content\":\"\\u003cp\\u003eOkay so that\\u0026apos;s it.\\u003cbr /\\u003e\\u003ca href=\\\"https://tcit.frama.io/group-uri-scheme/draft-tcit-group-uri-01.txt\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"ellipsis\\\"\\u003etcit.frama.io/group-uri-scheme\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e/draft-tcit-group-uri-01.txt\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\",\"contentMap\":{\"fr\":\"\\u003cp\\u003eOkay so that\\u0026apos;s it.\\u003cbr /\\u003e\\u003ca href=\\\"https://tcit.frama.io/group-uri-scheme/draft-tcit-group-uri-01.txt\\\" rel=\\\"nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"ellipsis\\\"\\u003etcit.frama.io/group-uri-scheme\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e/draft-tcit-group-uri-01.txt\\u003c/span\\u003e\\u003c/a\\u003e\\u003c/p\\u003e\"},\"attachment\":[],\"tag\":[]}",
"headers": {
"Date": "Tue, 04 Dec 2018 13:59:58 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",
"Link": "<https://social.tcit.fr/users/tcit/updates/15979.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://social.tcit.fr/users/tcit/statuses/101160654038714030>; rel=\"alternate\"; type=\"application/activity+json\"",
"Vary": "Accept,Accept-Encoding",
"Cache-Control": "max-age=180, public",
"ETag": "W/\"619af54f65bbb41538e430b8247c36d7\"",
"X-Request-Id": "84a750de-2dfa-4a36-976e-bae0b0ac4821",
"X-Runtime": "0.056423",
"X-Cached": "MISS"
},
"status_code": 200,
"type": "ok"
}
},
{
"request": {
"body": "",
"headers": {
"Accept": "application/activity+json"
},
"method": "get",
"options": {
"follow_redirect": "true"
},
"request_body": "",
"url": "https://social.tcit.fr/users/tcit"
},
"response": {
"binary": false,
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://social.tcit.fr/users/tcit\",\"type\":\"Person\",\"following\":\"https://social.tcit.fr/users/tcit/following\",\"followers\":\"https://social.tcit.fr/users/tcit/followers\",\"inbox\":\"https://social.tcit.fr/users/tcit/inbox\",\"outbox\":\"https://social.tcit.fr/users/tcit/outbox\",\"featured\":\"https://social.tcit.fr/users/tcit/collections/featured\",\"preferredUsername\":\"tcit\",\"name\":\"🦄 Thomas Citharel\",\"summary\":\"\\u003cp\\u003eHoping to make people\\u0026apos;s life better with free software at \\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.\\u003c/p\\u003e\",\"url\":\"https://social.tcit.fr/@tcit\",\"manuallyApprovesFollowers\":false,\"publicKey\":{\"id\":\"https://social.tcit.fr/users/tcit#main-key\",\"owner\":\"https://social.tcit.fr/users/tcit\",\"publicKeyPem\":\"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApXwYMUdFg3XUd+bGsh8C\\nyiMRGpRGAWuCdM5pDWx5uM4pW2pM3xbHbcI21j9h8BmlAiPg6hbZD73KGly2N8Rt\\n5iIS0I+l6i8kA1JCCdlAaDTRd41RKMggZDoQvjVZQtsyE1VzMeU2kbqqTFN6ew7H\\nvbd6O0NhixoKoZ5f3jwuBDZoT0p1TAcaMdmG8oqHD97isizkDnRn8cOBA6wtI+xb\\n5xP2zxZMsLpTDZLiKU8XcPKZCw4OfQfmDmKkHtrFb77jCAQj/s/FxjVnvxRwmfhN\\nnWy0D+LUV/g63nHh/b5zXIeV92QZLvDYbgbezmzUzv9UeA1s70GGbaDqCIy85gw9\\n+wIDAQAB\\n-----END PUBLIC KEY-----\\n\"},\"tag\":[],\"attachment\":[{\"type\":\"PropertyValue\",\"name\":\"Works at\",\"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\":\"Pronouns\",\"value\":\"He/Him\"},{\"type\":\"PropertyValue\",\"name\":\"Work Account\",\"value\":\"\\u003ca href=\\\"https://framapiaf.org/@tcit\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003eframapiaf.org/@tcit\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"},{\"type\":\"PropertyValue\",\"name\":\"Site\",\"value\":\"\\u003ca href=\\\"https://tcit.fr\\\" rel=\\\"me nofollow noopener\\\" target=\\\"_blank\\\"\\u003e\\u003cspan class=\\\"invisible\\\"\\u003ehttps://\\u003c/span\\u003e\\u003cspan class=\\\"\\\"\\u003etcit.fr\\u003c/span\\u003e\\u003cspan class=\\\"invisible\\\"\\u003e\\u003c/span\\u003e\\u003c/a\\u003e\"}],\"endpoints\":{\"sharedInbox\":\"https://social.tcit.fr/inbox\"},\"icon\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/avatars/000/000/001/original/a28c50ce5f2b13fd.jpg\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://media.social.tcit.fr/mastodontcit/accounts/headers/000/000/001/original/4d1ab77c20265ee9.jpg\"}}",
"headers": {
"Date": "Tue, 04 Dec 2018 13:59:58 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",
"Link": "<https://social.tcit.fr/.well-known/webfinger?resource=acct%3Atcit%40social.tcit.fr>; rel=\"lrdd\"; type=\"application/xrd+xml\", <https://social.tcit.fr/users/tcit.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://social.tcit.fr/users/tcit>; rel=\"alternate\"; type=\"application/activity+json\"",
"Vary": "Accept,Accept-Encoding",
"Cache-Control": "max-age=180, public",
"ETag": "W/\"039b9e136f81a55656fb1f38a23640d2\"",
"X-Request-Id": "91a50164-aa87-45c9-8100-786b9c74fbe0",
"X-Runtime": "0.039489",
"X-Cached": "MISS"
},
"status_code": 200,
"type": "ok"
}
},
{
"request": {
"body": "",
"headers": {
"Accept": "application/activity+json"
},
"method": "get",
"options": {
"follow_redirect": "true",
"recv_timeout": 20000,
"connect_timeout": 10000
},
"request_body": "",
"url": "https://social.tcit.fr/users/tcit/statuses/101160195754333819"
},
"response": {
"binary": false,
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://social.tcit.fr/users/tcit/statuses/101160195754333819\",\"type\":\"Note\",\"summary\":null,\"inReplyTo\":\"https://social.tcit.fr/users/tcit/statuses/101159468934977010\",\"published\":\"2018-11-30T12:48:08Z\",\"url\":\"https://social.tcit.fr/@tcit/101160195754333819\",\"attributedTo\":\"https://social.tcit.fr/users/tcit\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://social.tcit.fr/users/tcit/followers\"],\"sensitive\":false,\"atomUri\":\"https://social.tcit.fr/users/tcit/statuses/101160195754333819\",\"inReplyToAtomUri\":\"https://social.tcit.fr/users/tcit/statuses/101159468934977010\",\"conversation\":\"tag:social.tcit.fr,2018-11-30:objectId=3642669:objectType=Conversation\",\"content\":\"\\u003cp\\u003eOkay so YOLO.\\u003c/p\\u003e\",\"contentMap\":{\"fr\":\"\\u003cp\\u003eOkay so YOLO.\\u003c/p\\u003e\"},\"attachment\":[{\"type\":\"Document\",\"mediaType\":\"image/png\",\"url\":\"https://media.social.tcit.fr/mastodontcit/media_attachments/files/000/718/393/original/b56706a78fd355b8.png\",\"name\":\"Start of a 'group' URI RFC\"}],\"tag\":[]}",
"headers": {
"Date": "Tue, 04 Dec 2018 13:59:58 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",
"Link": "<https://social.tcit.fr/users/tcit/updates/15967.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://social.tcit.fr/users/tcit/statuses/101160195754333819>; rel=\"alternate\"; type=\"application/activity+json\"",
"Vary": "Accept,Accept-Encoding",
"Cache-Control": "max-age=180, public",
"ETag": "W/\"e878d9ab8dfa31073b27b4661046b911\"",
"X-Request-Id": "b598d538-88b5-4d7a-867c-d78b85ee5677",
"X-Runtime": "0.078823",
"X-Cached": "MISS"
},
"status_code": 200,
"type": "ok"
}
},
{
"request": {
"body": "",
"headers": {
"Accept": "application/activity+json"
},
"method": "get",
"options": {
"follow_redirect": "true",
"recv_timeout": 20000,
"connect_timeout": 10000
},
"request_body": "",
"url": "https://social.tcit.fr/users/tcit/statuses/101159468934977010"
},
"response": {
"binary": false,
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://social.tcit.fr/users/tcit/statuses/101159468934977010\",\"type\":\"Note\",\"summary\":null,\"inReplyTo\":null,\"published\":\"2018-11-30T09:43:18Z\",\"url\":\"https://social.tcit.fr/@tcit/101159468934977010\",\"attributedTo\":\"https://social.tcit.fr/users/tcit\",\"to\":[\"https://www.w3.org/ns/activitystreams#Public\"],\"cc\":[\"https://social.tcit.fr/users/tcit/followers\"],\"sensitive\":false,\"atomUri\":\"https://social.tcit.fr/users/tcit/statuses/101159468934977010\",\"inReplyToAtomUri\":null,\"conversation\":\"tag:social.tcit.fr,2018-11-30:objectId=3642669:objectType=Conversation\",\"content\":\"\\u003cp\\u003eApart from PeerTube, which software that implements ActivityPub does have a group functionnality?\\u003cbr /\\u003eIt\\u0026apos;s to discuss about a Webfinger group: query prefix, similar to the acct: query prefix.\\u003c/p\\u003e\",\"contentMap\":{\"en\":\"\\u003cp\\u003eApart from PeerTube, which software that implements ActivityPub does have a group functionnality?\\u003cbr /\\u003eIt\\u0026apos;s to discuss about a Webfinger group: query prefix, similar to the acct: query prefix.\\u003c/p\\u003e\"},\"attachment\":[],\"tag\":[]}",
"headers": {
"Date": "Tue, 04 Dec 2018 13:59:58 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",
"Link": "<https://social.tcit.fr/users/tcit/updates/15941.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://social.tcit.fr/users/tcit/statuses/101159468934977010>; rel=\"alternate\"; type=\"application/activity+json\"",
"Vary": "Accept,Accept-Encoding",
"Cache-Control": "max-age=180, public",
"ETag": "W/\"a29cc605a433ed904736da57572038d3\"",
"X-Request-Id": "18488387-c5a3-40db-8c9e-5a3a067401a9",
"X-Runtime": "0.054993",
"X-Cached": "MISS"
},
"status_code": 200,
"type": "ok"
}
}
]

View File

@@ -10,13 +10,13 @@
"follow_redirect": "true"
},
"request_body": "",
"url": "http://framapiaf.org/users/admin"
"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\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"id\":\"https://framapiaf.org/users/admin\",\"type\":\"Person\",\"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\":\"\",\"summary\":\"\\u003cp\\u003e\\u003c/p\\u003e\",\"url\":\"https://framapiaf.org/@admin\",\"manuallyApprovesFollowers\":false,\"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\":[],\"endpoints\":{\"sharedInbox\":\"https://framapiaf.org/inbox\"}}",
"body": "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\",{\"manuallyApprovesFollowers\":\"as:manuallyApprovesFollowers\",\"sensitive\":\"as:sensitive\",\"movedTo\":{\"@id\":\"as:movedTo\",\"@type\":\"@id\"},\"Hashtag\":\"as:Hashtag\",\"ostatus\":\"http://ostatus.org#\",\"atomUri\":\"ostatus:atomUri\",\"inReplyToAtomUri\":\"ostatus:inReplyToAtomUri\",\"conversation\":\"ostatus:conversation\",\"toot\":\"http://joinmastodon.org/ns#\",\"Emoji\":\"toot:Emoji\",\"focalPoint\":{\"@container\":\"@list\",\"@id\":\"toot:focalPoint\"},\"featured\":{\"@id\":\"toot:featured\",\"@type\":\"@id\"},\"schema\":\"http://schema.org#\",\"PropertyValue\":\"schema:PropertyValue\",\"value\":\"schema:value\"}],\"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,\"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.org/system/accounts/avatars/000/000/002/original/85fbb27ad5e3cf71.jpg?1544008249\"},\"image\":{\"type\":\"Image\",\"mediaType\":\"image/jpeg\",\"url\":\"https://framapiaf.org/system/accounts/headers/000/000/002/original/6aba75f1ab1ab6de.jpg?1544008352\"}}",
"headers": {
"Date": "Tue, 13 Nov 2018 11:22:02 GMT",
"Date": "Wed, 05 Dec 2018 11:59:22 GMT",
"Content-Type": "application/activity+json; charset=utf-8",
"Transfer-Encoding": "chunked",
"Connection": "keep-alive",
@@ -27,9 +27,9 @@
"Link": "<https://framapiaf.org/.well-known/webfinger?resource=acct%3Aadmin%40framapiaf.org>; rel=\"lrdd\"; type=\"application/xrd+xml\", <https://framapiaf.org/users/admin.atom>; rel=\"alternate\"; type=\"application/atom+xml\", <https://framapiaf.org/users/admin>; rel=\"alternate\"; type=\"application/activity+json\"",
"Vary": "Accept,Accept-Encoding",
"Cache-Control": "max-age=180, public",
"ETag": "W/\"82f88eaea909e6c3f20f908ad16e4b54\"",
"X-Request-Id": "cef423e2-d143-422f-94b0-03450f70a32d",
"X-Runtime": "0.005097",
"ETag": "W/\"dff68e9e1738cc89f28a977f39715b36\"",
"X-Request-Id": "1f2f4f2b-567f-48b0-a3f9-fef153cfa793",
"X-Runtime": "0.013117",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"Referrer-Policy": "same-origin"
},

View File

@@ -98,6 +98,9 @@ defmodule Mobilizon.AddressesTest do
test "process_geom/2 with invalid data returns nil" do
attrs = %{"type" => :point, "data" => %{"latitude" => nil, "longitude" => nil}}
assert {:error, "Latitude and longitude must be numbers"} = Addresses.process_geom(attrs)
attrs = %{"type" => :not_valid, "data" => %{"latitude" => nil, "longitude" => nil}}
assert {:error, :invalid_type} == Addresses.process_geom(attrs)
end
end
end

View File

@@ -415,6 +415,12 @@ defmodule Mobilizon.EventsTest do
assert [session.id] == Events.list_sessions() |> Enum.map(& &1.id)
end
test "list_sessions_for_event/1 returns sessions for an event" do
event = insert(:event)
session = insert(:session, event: event)
assert Events.list_sessions_for_event(event) |> Enum.map(& &1.id) == [session.id]
end
test "get_session!/1 returns the session with given id" do
session = insert(:session)
assert Events.get_session!(session.id).id == session.id
@@ -485,6 +491,13 @@ defmodule Mobilizon.EventsTest do
assert [track.id] == Events.list_tracks() |> Enum.map(& &1.id)
end
test "list_sessions_for_track/1 returns sessions for an event" do
event = insert(:event)
track = insert(:track, event: event)
session = insert(:session, track: track, event: event)
assert Events.list_sessions_for_track(track) |> Enum.map(& &1.id) == [session.id]
end
test "get_track!/1 returns the track with given id" do
track = insert(:track)
assert Events.get_track!(track.id).id == track.id

View File

@@ -78,7 +78,30 @@ defmodule Mobilizon.Service.Activitypub.ActivitypubTest do
"https://social.tcit.fr/users/tcit/statuses/99908779444618462"
)
assert object == object_again
assert object.id == object_again.id
end
end
test "object reply by url" do
use_cassette "activity_pub/fetch_social_tcit_fr_reply" do
{:ok, object} =
ActivityPub.fetch_object_from_url(
"https://social.tcit.fr/users/tcit/statuses/101160654038714030"
)
assert object.in_reply_to_comment.url ==
"https://social.tcit.fr/users/tcit/statuses/101160195754333819"
end
end
test "object reply to a video by url" do
use_cassette "activity_pub/fetch_reply_to_framatube" do
{:ok, object} =
ActivityPub.fetch_object_from_url(
"https://framapiaf.org/@troisiemelobe/101156292125317651"
)
assert object.in_reply_to_comment == nil
end
end
end

View File

@@ -0,0 +1,894 @@
defmodule Mobilizon.Service.Activitypub.TransmogrifierTest do
use Mobilizon.DataCase
import Mobilizon.Factory
alias Mobilizon.Activity
alias Mobilizon.Actors
alias Mobilizon.Actors.Actor
alias Mobilizon.Events
alias Mobilizon.Events.Comment
alias Mobilizon.Service.ActivityPub.Utils
alias Mobilizon.Service.ActivityPub.Transmogrifier
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
setup_all do
HTTPoison.start()
end
describe "handle_incoming" do
# test "it ignores an incoming comment if we already have it" do
# comment = insert(:comment)
# activity = %{
# "type" => "Create",
# "to" => ["https://www.w3.org/ns/activitystreams#Public"],
# "actor" => comment.actor.url,
# "object" => Utils.make_comment_data(comment)
# }
# data =
# File.read!("test/fixtures/mastodon-post-activity.json")
# |> Poison.decode!()
# |> Map.put("object", activity["object"])
# {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
# assert activity == returned_activity.data
# end
# test "it fetches replied-to activities if we don't have them" do
# data =
# File.read!("test/fixtures/mastodon-post-activity.json")
# |> Poison.decode!()
# object =
# data["object"]
# |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
# data =
# data
# |> Map.put("object", object)
# {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
# assert activity =
# Activity.get_create_activity_by_object_ap_id(
# "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
# )
# assert returned_activity.data["object"]["inReplyToAtomUri"] ==
# "https://shitposter.club/notice/2827873"
# assert returned_activity.data["object"]["inReplyToStatusId"] == activity.id
# end
test "it works for incoming notices" do
data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
{:ok, %Mobilizon.Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
assert data["id"] == "https://framapiaf.org/users/admin/statuses/99512778738411822/activity"
assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
assert data["cc"] == [
"https://framapiaf.org/users/admin/followers",
"http://mobilizon.com/@tcit"
]
assert data["actor"] == "https://framapiaf.org/users/admin"
object = data["object"]
assert object["id"] == "https://framapiaf.org/users/admin/statuses/99512778738411822"
assert object["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
assert object["cc"] == [
"https://framapiaf.org/users/admin/followers",
"http://localtesting.pleroma.lol/users/lain"
]
assert object["actor"] == "https://framapiaf.org/users/admin"
assert object["attributedTo"] == "https://framapiaf.org/users/admin"
assert object["sensitive"] == true
{:ok, %Actor{}} = Actors.get_actor_by_url(object["actor"])
end
test "it works for incoming notices with hashtags" do
data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Poison.decode!()
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
assert Enum.at(data["object"]["tag"], 2) == "moo"
end
# test "it works for incoming notices with contentMap" do
# data =
# File.read!("test/fixtures/mastodon-post-activity-contentmap.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["object"]["content"] ==
# "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span></p>"
# end
# test "it works for incoming notices with to/cc not being an array (kroeg)" do
# data = File.read!("test/fixtures/kroeg-post-activity.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["object"]["content"] ==
# "<p>henlo from my Psion netBook</p><p>message sent from my Psion netBook</p>"
# end
# test "it works for incoming announces with actor being inlined (kroeg)" do
# data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "https://puckipedia.com/"
# end
# test "it works for incoming notices with tag not being an array (kroeg)" do
# data = File.read!("test/fixtures/kroeg-array-less-emoji.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["object"]["emoji"] == %{
# "icon_e_smile" => "https://puckipedia.com/forum/images/smilies/icon_e_smile.png"
# }
# data = File.read!("test/fixtures/kroeg-array-less-hashtag.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert "test" in data["object"]["tag"]
# end
test "it works for incoming notices with url not being a string (prismo)" do
data = File.read!("test/fixtures/prismo-url-map.json") |> Poison.decode!()
assert {:error, :not_supported} == Transmogrifier.handle_incoming(data)
# Pages are not supported
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["object"]["url"] == "https://prismo.news/posts/83"
end
test "it works for incoming follow requests" do
actor = insert(:actor)
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
|> Poison.decode!()
|> Map.put("object", actor.url)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
assert data["actor"] == "https://social.tcit.fr/users/tcit"
assert data["type"] == "Follow"
assert data["id"] == "https://social.tcit.fr/users/tcit#follows/2"
actor = Actors.get_actor_with_everything!(actor.id)
assert Actor.following?(Actors.get_actor_by_url!(data["actor"], true), actor)
end
# test "it works for incoming follow requests from hubzilla" do
# user = insert(:user)
# data =
# File.read!("test/fixtures/hubzilla-follow-activity.json")
# |> Poison.decode!()
# |> Map.put("object", user.ap_id)
# |> Utils.normalize_params()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "https://hubzilla.example.org/channel/kaniini"
# assert data["type"] == "Follow"
# assert data["id"] == "https://hubzilla.example.org/channel/kaniini#follows/2"
# assert User.following?(User.get_by_ap_id(data["actor"]), user)
# end
# test "it works for incoming likes" do
# %Comment{url: url} = insert(:comment)
# data =
# File.read!("test/fixtures/mastodon-like.json")
# |> Poison.decode!()
# |> Map.put("object", url)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "http://mastodon.example.org/users/admin"
# assert data["type"] == "Like"
# assert data["id"] == "http://mastodon.example.org/users/admin#likes/2"
# assert data["object"] == url
# end
# test "it returns an error for incoming unlikes wihout a like activity" do
# %Comment{url: url} = insert(:comment)
# data =
# File.read!("test/fixtures/mastodon-undo-like.json")
# |> Poison.decode!()
# |> Map.put("object", url)
# assert Transmogrifier.handle_incoming(data) == {:error, :not_supported}
# end
# test "it works for incoming unlikes with an existing like activity" do
# comment = insert(:comment)
# like_data =
# File.read!("test/fixtures/mastodon-like.json")
# |> Poison.decode!()
# |> Map.put("object", comment.url)
# {:ok, %Activity{data: like_data, local: false}} = Transmogrifier.handle_incoming(like_data)
# data =
# File.read!("test/fixtures/mastodon-undo-like.json")
# |> Poison.decode!()
# |> Map.put("object", like_data)
# |> Map.put("actor", like_data["actor"])
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "http://mastodon.example.org/users/admin"
# assert data["type"] == "Undo"
# assert data["id"] == "http://mastodon.example.org/users/admin#likes/2/undo"
# assert data["object"]["id"] == "http://mastodon.example.org/users/admin#likes/2"
# end
# test "it works for incoming announces" do
# data = File.read!("test/fixtures/mastodon-announce.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "https://social.tcit.fr/users/tcit"
# assert data["type"] == "Announce"
# assert data["id"] ==
# "https://social.tcit.fr/users/tcit/statuses/101188891162897047/activity"
# assert data["object"] ==
# "https://social.tcit.fr/users/tcit/statuses/101188891162897047"
# assert %Comment{} = Events.get_comment_from_url(data["object"])
# end
# test "it works for incoming announces with an existing activity" do
# comment = insert(:comment)
# data =
# File.read!("test/fixtures/mastodon-announce.json")
# |> Poison.decode!()
# |> Map.put("object", comment.url)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["actor"] == "https://social.tcit.fr/users/tcit"
# assert data["type"] == "Announce"
# assert data["id"] ==
# "https://social.tcit.fr/users/tcit/statuses/101188891162897047/activity"
# assert data["object"] == comment.url
# # assert Activity.get_create_activity_by_object_ap_id(data["object"]).id == activity.id
# end
test "it works for incoming update activities" do
data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
object =
update_data["object"]
|> Map.put("actor", data["actor"])
|> Map.put("id", data["actor"])
update_data =
update_data
|> Map.put("actor", data["actor"])
|> Map.put("object", object)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(update_data)
{:ok, %Actor{} = actor} = Actors.get_actor_by_url(data["actor"])
assert actor.name == "gargle"
assert actor.avatar_url ==
"https://cd.niu.moe/accounts/avatars/000/033/323/original/fd7f8ae0b3ffedc9.jpeg"
assert actor.banner_url ==
"https://cd.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
assert actor.summary == "<p>Some bio</p>"
end
# test "it works for incoming update activities which lock the account" do
# data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
# object =
# update_data["object"]
# |> Map.put("actor", data["actor"])
# |> Map.put("id", data["actor"])
# |> Map.put("manuallyApprovesFollowers", true)
# update_data =
# update_data
# |> Map.put("actor", data["actor"])
# |> Map.put("object", object)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(update_data)
# user = User.get_cached_by_ap_id(data["actor"])
# assert user.info["locked"] == true
# end
test "it works for incoming deletes" do
%Actor{url: actor_url} = actor = insert(:actor)
%Comment{url: comment_url} = insert(:comment, actor: actor)
data =
File.read!("test/fixtures/mastodon-delete.json")
|> Poison.decode!()
object =
data["object"]
|> Map.put("id", comment_url)
data =
data
|> Map.put("object", object)
|> Map.put("actor", actor_url)
assert Events.get_comment_from_url(comment_url)
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
refute Events.get_comment_from_url(comment_url)
end
# TODO : make me ASAP
# test "it fails for incoming deletes with spoofed origin" do
# activity = insert(:note_activity)
# data =
# File.read!("test/fixtures/mastodon-delete.json")
# |> Poison.decode!()
# object =
# data["object"]
# |> Map.put("id", activity.data["object"]["id"])
# data =
# data
# |> Map.put("object", object)
# :error = Transmogrifier.handle_incoming(data)
# assert Repo.get(Activity, activity.id)
# end
# test "it works for incoming unannounces with an existing notice" do
# comment = insert(:comment)
# announce_data =
# File.read!("test/fixtures/mastodon-announce.json")
# |> Poison.decode!()
# |> Map.put("object", comment.url)
# {:ok, %Activity{data: announce_data, local: false}} =
# Transmogrifier.handle_incoming(announce_data)
# data =
# File.read!("test/fixtures/mastodon-undo-announce.json")
# |> Poison.decode!()
# |> Map.put("object", announce_data)
# |> Map.put("actor", announce_data["actor"])
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["type"] == "Undo"
# assert data["object"]["type"] == "Announce"
# assert data["object"]["object"] == comment.url
# assert data["object"]["id"] ==
# "http://mastodon.example.org/users/admin/statuses/99542391527669785/activity"
# end
test "it works for incomming unfollows with an existing follow" do
actor = insert(:actor)
follow_data =
File.read!("test/fixtures/mastodon-follow-activity.json")
|> Poison.decode!()
|> Map.put("object", actor.url)
{:ok, %Activity{data: _, local: false}} = Transmogrifier.handle_incoming(follow_data)
data =
File.read!("test/fixtures/mastodon-unfollow-activity.json")
|> Poison.decode!()
|> Map.put("object", follow_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
assert data["type"] == "Undo"
assert data["object"]["type"] == "Follow"
assert data["object"]["object"] == actor.url
assert data["actor"] == "https://social.tcit.fr/users/tcit"
{:ok, followed} = Actors.get_actor_by_url(data["actor"])
refute Actor.following?(followed, actor)
end
# test "it works for incoming blocks" do
# user = insert(:user)
# data =
# File.read!("test/fixtures/mastodon-block-activity.json")
# |> Poison.decode!()
# |> Map.put("object", user.ap_id)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["type"] == "Block"
# assert data["object"] == user.ap_id
# assert data["actor"] == "http://mastodon.example.org/users/admin"
# blocker = User.get_by_ap_id(data["actor"])
# assert User.blocks?(blocker, user)
# end
# test "incoming blocks successfully tear down any follow relationship" do
# blocker = insert(:user)
# blocked = insert(:user)
# data =
# File.read!("test/fixtures/mastodon-block-activity.json")
# |> Poison.decode!()
# |> Map.put("object", blocked.ap_id)
# |> Map.put("actor", blocker.ap_id)
# {:ok, blocker} = User.follow(blocker, blocked)
# {:ok, blocked} = User.follow(blocked, blocker)
# assert User.following?(blocker, blocked)
# assert User.following?(blocked, blocker)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["type"] == "Block"
# assert data["object"] == blocked.ap_id
# assert data["actor"] == blocker.ap_id
# blocker = User.get_by_ap_id(data["actor"])
# blocked = User.get_by_ap_id(data["object"])
# assert User.blocks?(blocker, blocked)
# refute User.following?(blocker, blocked)
# refute User.following?(blocked, blocker)
# end
# test "it works for incoming unblocks with an existing block" do
# user = insert(:user)
# block_data =
# File.read!("test/fixtures/mastodon-block-activity.json")
# |> Poison.decode!()
# |> Map.put("object", user.ap_id)
# {:ok, %Activity{data: _, local: false}} = Transmogrifier.handle_incoming(block_data)
# data =
# File.read!("test/fixtures/mastodon-unblock-activity.json")
# |> Poison.decode!()
# |> Map.put("object", block_data)
# {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
# assert data["type"] == "Undo"
# assert data["object"]["type"] == "Block"
# assert data["object"]["object"] == user.ap_id
# assert data["actor"] == "http://mastodon.example.org/users/admin"
# blocker = User.get_by_ap_id(data["actor"])
# refute User.blocks?(blocker, user)
# end
# test "it works for incoming accepts which were pre-accepted" do
# follower = insert(:user)
# followed = insert(:user)
# {:ok, follower} = User.follow(follower, followed)
# assert User.following?(follower, followed) == true
# {:ok, follow_activity} = ActivityPub.follow(follower, followed)
# accept_data =
# File.read!("test/fixtures/mastodon-accept-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# object =
# accept_data["object"]
# |> Map.put("actor", follower.ap_id)
# |> Map.put("id", follow_activity.data["id"])
# accept_data = Map.put(accept_data, "object", object)
# {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
# refute activity.local
# assert activity.data["object"] == follow_activity.data["id"]
# follower = Repo.get(User, follower.id)
# assert User.following?(follower, followed) == true
# end
# test "it works for incoming accepts which were orphaned" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# {:ok, follow_activity} = ActivityPub.follow(follower, followed)
# accept_data =
# File.read!("test/fixtures/mastodon-accept-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# accept_data =
# Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
# {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
# assert activity.data["object"] == follow_activity.data["id"]
# follower = Repo.get(User, follower.id)
# assert User.following?(follower, followed) == true
# end
# test "it works for incoming accepts which are referenced by IRI only" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# {:ok, follow_activity} = ActivityPub.follow(follower, followed)
# accept_data =
# File.read!("test/fixtures/mastodon-accept-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# |> Map.put("object", follow_activity.data["id"])
# {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
# assert activity.data["object"] == follow_activity.data["id"]
# follower = Repo.get(User, follower.id)
# assert User.following?(follower, followed) == true
# end
# test "it fails for incoming accepts which cannot be correlated" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# accept_data =
# File.read!("test/fixtures/mastodon-accept-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# accept_data =
# Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
# :error = Transmogrifier.handle_incoming(accept_data)
# follower = Repo.get(User, follower.id)
# refute User.following?(follower, followed) == true
# end
# test "it fails for incoming rejects which cannot be correlated" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# accept_data =
# File.read!("test/fixtures/mastodon-reject-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# accept_data =
# Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
# :error = Transmogrifier.handle_incoming(accept_data)
# follower = Repo.get(User, follower.id)
# refute User.following?(follower, followed) == true
# end
# test "it works for incoming rejects which are orphaned" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# {:ok, follower} = User.follow(follower, followed)
# {:ok, _follow_activity} = ActivityPub.follow(follower, followed)
# assert User.following?(follower, followed) == true
# reject_data =
# File.read!("test/fixtures/mastodon-reject-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# reject_data =
# Map.put(reject_data, "object", Map.put(reject_data["object"], "actor", follower.ap_id))
# {:ok, activity} = Transmogrifier.handle_incoming(reject_data)
# refute activity.local
# follower = Repo.get(User, follower.id)
# assert User.following?(follower, followed) == false
# end
# test "it works for incoming rejects which are referenced by IRI only" do
# follower = insert(:user)
# followed = insert(:user, %{info: %{"locked" => true}})
# {:ok, follower} = User.follow(follower, followed)
# {:ok, follow_activity} = ActivityPub.follow(follower, followed)
# assert User.following?(follower, followed) == true
# reject_data =
# File.read!("test/fixtures/mastodon-reject-activity.json")
# |> Poison.decode!()
# |> Map.put("actor", followed.ap_id)
# |> Map.put("object", follow_activity.data["id"])
# {:ok, %Activity{data: _}} = Transmogrifier.handle_incoming(reject_data)
# follower = Repo.get(User, follower.id)
# assert User.following?(follower, followed) == false
# end
# test "it rejects activities without a valid ID" do
# user = insert(:user)
# data =
# File.read!("test/fixtures/mastodon-follow-activity.json")
# |> Poison.decode!()
# |> Map.put("object", user.ap_id)
# |> Map.put("id", "")
# :error = Transmogrifier.handle_incoming(data)
# end
end
describe "prepare outgoing" do
test "it turns mentions into tags" do
actor = insert(:actor)
other_actor = insert(:actor)
{:ok, activity} =
MobilizonWeb.API.Comments.create_comment(
actor.preferred_username,
"hey, @#{other_actor.preferred_username}, how are ya? #2hu"
)
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
object = modified["object"]
expected_mention = %{
"href" => other_actor.url,
"name" => "@#{other_actor.preferred_username}",
"type" => "Mention"
}
expected_tag = %{
"href" => MobilizonWeb.Endpoint.url() <> "/tags/2hu",
"type" => "Hashtag",
"name" => "#2hu"
}
assert Enum.member?(object["tag"], expected_tag)
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)
{:ok, activity} = MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "hey")
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
assert modified["@context"] ==
Mobilizon.Service.ActivityPub.Utils.make_json_ld_header()["@context"]
end
test "it sets the 'attributedTo' property to the actor of the object if it doesn't have one" do
actor = insert(:actor)
{:ok, activity} = MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "hey")
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
assert modified["object"]["actor"] == modified["object"]["attributedTo"]
end
test "it strips internal hashtag data" do
actor = insert(:actor)
{:ok, activity} = MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "#2hu")
expected_tag = %{
"href" => MobilizonWeb.Endpoint.url() <> "/tags/2hu",
"type" => "Hashtag",
"name" => "#2hu"
}
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
assert modified["object"]["tag"] == [expected_tag]
end
test "it strips internal fields" do
actor = insert(:actor)
{:ok, activity} = MobilizonWeb.API.Comments.create_comment(actor.preferred_username, "#2hu")
{:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
# TODO : When and if custom emoji are implemented, this should be 2
assert length(modified["object"]["tag"]) == 1
assert is_nil(modified["object"]["emoji"])
assert is_nil(modified["object"]["likes"])
assert is_nil(modified["object"]["like_count"])
assert is_nil(modified["object"]["announcements"])
assert is_nil(modified["object"]["announcement_count"])
assert is_nil(modified["object"]["context_id"])
end
# describe "actor rewriting" do
# test "it fixes the actor URL property to be a proper URI" do
# data = %{
# "url" => %{"href" => "http://example.com"}
# }
# rewritten = Transmogrifier.maybe_fix_user_object(data)
# assert rewritten["url"] == "http://example.com"
# end
# end
# 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
end
end

View File

@@ -0,0 +1,40 @@
defmodule Mobilizon.Service.Activitypub.UtilsTest do
use Mobilizon.DataCase
import Mobilizon.Factory
alias Mobilizon.Service.ActivityPub.Utils
use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney
setup_all do
HTTPoison.start()
end
describe "make" do
test "comment data from struct" do
comment = insert(:comment)
reply = insert(:comment, in_reply_to_comment: comment)
assert %{
"type" => "Note",
"to" => ["https://www.w3.org/ns/activitystreams#Public"],
"content" => reply.text,
"actor" => reply.actor.url,
"uuid" => reply.uuid,
"id" => "#{MobilizonWeb.Endpoint.url()}/comments/#{reply.uuid}",
"inReplyTo" => comment.url,
"attributedTo" => reply.actor.url
} == Utils.make_comment_data(reply)
end
test "comment data from map" 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)
assert comment_data["type"] == "Note"
assert comment_data["to"] == to
assert comment_data["content"] == reply.text
assert comment_data["actor"] == reply.actor.url
assert comment_data["inReplyTo"] == comment.url
end
end
end

View File

@@ -0,0 +1,41 @@
defmodule MobilizonWeb.Resolvers.CommentResolverTest do
use MobilizonWeb.ConnCase
alias Mobilizon.{Events, Actors}
alias Mobilizon.Actors.{Actor, User}
alias MobilizonWeb.AbsintheHelpers
import Mobilizon.Factory
@comment %{text: "some body"}
setup %{conn: conn} do
{:ok, %User{default_actor: %Actor{} = actor} = user} =
Actors.register(%{email: "test@test.tld", password: "testest", username: "test"})
{:ok, conn: conn, actor: actor, user: user}
end
describe "Comment Resolver" do
test "create_comment/3 creates a comment", %{conn: conn, actor: actor, user: user} do
category = insert(:category)
mutation = """
mutation {
createComment(
text: "I love this event",
actor_username: "#{actor.preferred_username}"
) {
text,
uuid
}
}
"""
res =
conn
|> auth_conn(user)
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert json_response(res, 200)["data"]["createComment"]["text"] == "I love this event"
end
end
end

View File

@@ -116,10 +116,10 @@ defmodule MobilizonWeb.Resolvers.EventResolverTest do
createEvent(
title: "come to my event",
description: "it will be fine",
beginsOn: "#{DateTime.utc_now() |> DateTime.to_iso8601()}",
organizer_actor_id: #{actor.id},
category_id: #{category.id},
addressType: #{"OTHER"}
begins_on: "#{DateTime.utc_now() |> DateTime.to_iso8601()}",
organizer_actor_username: "#{actor.preferred_username}",
category: "#{category.title}",
address_type: #{"OTHER"}
) {
title,
uuid

View File

@@ -22,7 +22,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
mutation {
createGroup(
preferred_username: "#{@new_group_params.groupname}",
creator_username: "#{actor.preferred_username}"
admin_actor_username: "#{actor.preferred_username}"
) {
preferred_username,
type
@@ -44,7 +44,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
mutation {
createGroup(
preferred_username: "#{@new_group_params.groupname}",
creator_username: "#{actor.preferred_username}",
admin_actor_username: "#{actor.preferred_username}",
) {
preferred_username,
type
@@ -57,7 +57,7 @@ defmodule MobilizonWeb.Resolvers.GroupResolverTest do
|> auth_conn(user)
|> post("/api", AbsintheHelpers.mutation_skeleton(mutation))
assert hd(json_response(res, 200)["errors"])["message"] == "group_name_not_available"
assert hd(json_response(res, 200)["errors"])["message"] == "existing_group_name"
end
test "list_groups/3 returns all groups", context do