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.
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.
Network utils has a method `fetch_host_ip_and_country` which will
fetch both. The country fetching uses the `ip-api.com` free service
to resolve country information.
Also provided is a Django view and url configuration for easy addition into Django projects. Django is not a hard dependency of this library, usage of the Django view obviously requires installing Django itself. For configuration details see documentation.
Closes#108
The given ID will be fetched using the correct entity class specific remote endpoint, validated to be from the correct author against their public key and then an instance of the entity class will be constructed and returned.
Also related changes and refactoring:
* New Diaspora protocol helper `federation.utils.diaspora.retrieve_and_parse_content`. See notes regarding the high level fetcher above.
* New Diaspora protocol helper `federation.utils.fetch_public_key`. Given a `handle` as a parameter, will fetch the remote profile and return the `public_key` from it.
* Refactoring for Diaspora `MagicEnvelope` class.
* Diaspora procotol receive flow now uses the `MagicEnvelope` class to verify payloads.
* Diaspora protocol receive flow now fetches the sender public key over the network if a `sender_key_fetcher` function is not passed in. Previously an error would be raised.
Closes#103
Maps to a `DiasporaReshare` for the Diaspora protocol.
The `Share` entity supports all the properties that a Diaspora reshare does. Additionally two other properties are supported: `raw_content` and `entity_type`. The former can be used for a "quoted share" case where the sharer adds their own note to the share. The latter can be used to reference the type of object that was shared, to help the receiver, if it is not sharing a `Post` entity. The value must be a base entity class name.
Closes#94