Wykres commitów

51 Commity (41785c2fdce1dbbd7db6d40e2e07eb55ebf7068b)

Autor SHA1 Wiadomość Data
Alain St-Denis 41785c2fdc Refactor jsonld context management. Move LD signing to entities/activitypub. Move jsonld document_loader caching to __init__.py. Fix tests. 2023-03-24 18:34:15 -04:00
Alain St-Denis 9df803dafe Render Activitypub outbound payloads with calamus. 2023-01-07 15:59:38 +00:00
Alain St-Denis 58c8f95e54 Add audio and video media objects and much more. 2022-08-19 17:01:44 +00:00
Jason Robinson 9972b9d3fb Extract Diaspora guid
Diaspora entity guid will now be extracted from ActivityPub payloads implementing the Diaspora extension.
2020-04-25 00:32:33 +03:00
Jason Robinson 13f0cf0db6 Stop markdownifying received ActivityPub content
It was causing more trouble than benefits. Just accept
HTML content into entities raw_content attribute and
let apps deal with it.
2020-04-12 23:32:42 +03:00
Jason Robinson fd63767263 Fix sharedInbox from remote ActivityPub profiles
Fix reading `sharedInbox` from remote ActivityPub profiles. This caused public payloads not
to be deduplicated when sending public payloads to remote ActivityPub servers. Refetching
profiles should now fix this.

Closes #124
2020-02-22 01:31:46 +02:00
Jason Robinson ee7f3aef60 Only validate signatures for inbound entities
For now anyway.
2019-10-11 00:13:10 +03:00
Jason Robinson 9b137c491d Always validate outbound entities
This should stop invalid payloads being sent out, like shares
to the Diaspora network that have no target_guid (due to originating
from the AP side).

Temporary solution until mock posts are automatically created for
better cross-compatibility.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-10-10 23:21:05 +03:00
Jason Robinson 64f266e544 Refactor extract_mentions logic to base RawContentMixin
Since we're going to reuse the Diaspora style mentions syntax
(without the display name part), pull out the mentions extract code
from the Diaspora mixins to the base mixins.
2019-09-08 23:04:08 +03:00
Jason Robinson 42b6736361 Transform any found key in an AP payload if no other mapping 2019-09-08 02:00:11 +03:00
Jason Robinson a76e68b491 Accept both Document and Image objects as attachments 2019-09-08 01:59:31 +03:00
Jason Robinson c4e54d0027 Merge ImageObject into the base Image entity
No point having a separate object type when the features
of it match the entity Image type.

Also send out Image instead of Document for image type
attachments. Lets see if Mastodon and others are fine
with this.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-09-08 00:12:04 +03:00
Jason Robinson 54ecc5aea5 Always use markdownified `object.content` if `object.source` not markdown
This avoids for example text/bbcode ending up as raw_content which
we reserve for markdown.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-09-03 23:25:45 +03:00
Jason Robinson bac1e1f8e3 Parse attachments from fetched ActivityPub objects
For example images when processing a share of an unknown post.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-09-02 23:31:07 +03:00
Jason Robinson 1070831b2d Support a larger set of ActivityPub Actor types 2019-08-29 23:17:23 +03:00
Jason Robinson e92792fa35 Markdownify incoming HTML content from ActivityPub layer 2019-08-25 22:55:00 +03:00
Jason Robinson 61a0fc442b Add media type and rendered content to entities with raw_content
Entities with `raw_content` now also contain a `_media_type` and
`rendered_content`.

The default `_media_type` is `text/markdown` except for ActivityPub
originating posts it defaults to `text/html`. If the ActivityPub
payload contains a `source`, that mediaType will be used instead.
2019-08-18 22:37:18 +03:00
Jason Robinson b0c6be6cd7 Add pyfed:inlineImage property to ActivityPub attachments
If we rip out embedded images from raw_content then mark them as
pyfed:inlineImage. Receiving side will know then that those
attachments are included as inline images should they wish to
exclude those, if they support inline images via markdown or html.

Also rip out all embedded images, not just the ones from the
senders domain.
2019-08-18 21:43:27 +03:00
Jason Robinson 9ef0fd4547 Fix calling pre_send 2019-08-18 03:20:35 +03:00
Jason Robinson 00d243a785 Attach local images embedded into Post and Comment as attachments for AP
Rip out any embedded images for the senders domain into
entity._children list of Image objects.
2019-08-17 22:30:27 +03:00
Jason Robinson c2ae43fd4d Move allowed image types to a constant in AP objects 2019-08-17 18:08:01 +03:00
Jason Robinson 138f7263a1 Extract images as entity children from ActivityPub payloads 2019-08-17 18:00:34 +03:00
Jason Robinson 33c4b903b1 Ensure AP mappers recognize public namespace in receivers 2019-08-11 01:34:27 +03:00
Jason Robinson a5fe105b6c Support incoming retraction of ActivityPub shares 2019-08-06 23:56:55 +03:00
Jason Robinson 27a77e1316 Better support for fetching objects with ActivityPub 2019-08-06 23:18:24 +03:00
Jason Robinson ade389c236 Use also attributedTo for ActivityPub object actor_id's 2019-08-06 01:28:55 +03:00
Jason Robinson d6dd046b94 Fix check for followers in to/cc 2019-08-06 01:13:24 +03:00
Jason Robinson 79f580d01f Add support for ActivityPub Announce
Becomes a Share entity.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-08-05 01:15:11 +03:00
Jason Robinson 41637e7688 Add receivers in mappers to inbound entities
Entities processed by inbound mappers will now have a list of
receivers in `_receivers`. This replaces the
`_receiving_actor_id` which was previously set for Diaspora entities.

UserType now has a `receiver_variant` which is one of `ReceiverVariant`
enum. `ACTOR` means this receiver is a single actor ID.
`FOLLOWERS` means this is the followers of the ID in the receiver.

Contains terrible hack to figure out if ActivityPub to/cc contains
a reference to the followers collection of the sender 🙈 . Will replace
"later" with proper fetch+cache solution, once we have a cache.

Refs: https://git.feneas.org/socialhome/socialhome/issues/522
2019-08-04 17:41:08 +03:00
Jason Robinson 80cce66734 Add support for Retraction to/from ActivityPub
Retraction produces a { Delete { Tombstone }} and receiving
one produces a Retraction. Retraction.entity_type is set as
"Object" since we don't know it just by looking at the payload.
2019-07-21 01:35:35 +03:00
Jason Robinson b4a4d7128a Add outbound support for Comment entity over ActivityPub 2019-06-30 01:11:10 +03:00
Jason Robinson a333f7a9aa Support parsing Comment entities for incoming ActivityPub payloads
Basically a Note with an inReplyTo.
2019-06-30 01:11:10 +03:00
Jason Robinson 471d40f05e Fix parsing AP Note's with inReplyTo 2019-06-30 01:10:34 +03:00
Jason Robinson 40c652c5f0 Support incoming Undo of a Follow for ActivityPub 2019-06-29 00:55:23 +03:00
Jason Robinson b5d739f00a Mark ActivityPub entity as public if public namespace in receivers 2019-06-21 00:34:26 +03:00
Jason Robinson 9fd4038039 Fix AS2 attribute transformation into raw_content 2019-06-21 00:34:26 +03:00
Jason Robinson 5436da4f1c Make distinction between objects and activities when mapping AS2 ID's 2019-06-21 00:34:26 +03:00
Jason Robinson 56406056ae Use AS2 payload object type if there is one, fall back to payload type
This allows getting the Note out of Create {Note}.
2019-06-21 00:34:26 +03:00
Jason Robinson 5cc2ab46bd Render ActivitypubPost for to AS2 activity wrapped Note
Also ensure incoming processing maps Note, Article and Page
to an ActivitypubPost.

Refs: #7
2019-06-21 00:34:26 +03:00
Jason Robinson 30a2fadc65 Save source protocol and object on received ActivityPub objects
Also call validate entity on processing payloads to entities.
2019-05-12 18:32:41 +03:00
Jason Robinson 8aaedcc635 Fix sending ActivityPub Accept in response to a Follow 2019-03-18 23:41:05 +02:00
Jason Robinson 4b62b83908 Default AP profile public inbox to private inbox, if no sharedInbox 2019-03-17 21:33:58 +02:00
Jason Robinson 80c4e433d7 Entities of type `Profile` now have a dictionary of `inboxes`
With two elements, `private` and `public`. These should be URL's
indicating where to send payloads for the recipient.

ActivityPub profiles will parse these values from incoming profile
documents. Diaspora entities will default to the inboxes in the
specification.
2019-03-17 16:09:34 +02:00
Jason Robinson ced914578b Fix generating outbound entity for ActivitypubAccept 2019-03-17 03:42:42 +02:00
Jason Robinson 353ae9ff9d Add Accept entity and ActivityPub follow auto-Accept flow
When receiving an ActivityPub Follow, send back an Accept activity
automatically. Due to application hook needed to fetch sending
user private key (for signing), this is only available if Django
is installed since currently application hooks exist only for
Django configuration.

Django applications should include a new configuration item
"get_private_key_function" which points to a function which takes
a user identifier (fid, handle or guid) and returns a private key
in RSA object format.
2019-03-17 03:17:10 +02:00
Jason Robinson 29ba501d31 Fix mapping of image urls from ActivityPub AS2 actor 2019-03-14 23:03:24 +02:00
Jason Robinson ad17e2cd2f Fix document fetcher to parse correctly fetched AS2 document into profile 2019-03-14 22:06:39 +02:00
Jason Robinson 2fb2da6955 Work on ActivityPub HTTP signatures and payload delivery
Also removes some legacy cruft for the failed Diaspora URI's as ID's experiment.

Refs: #7
2019-03-06 22:42:33 +02:00
Jason Robinson a876d3a239 Add fetching of remote ActivityPub profile 2019-03-02 01:24:57 +02:00
Jason Robinson 008c8e8971 Inital passing ActivityPub mapper tests, Follow passes
Skip the rest of the tests, implement one by one until the same
functionality of the Diaspora mappers is ready.
2018-10-13 12:08:12 +03:00