Commit graph

251 commits

Author SHA1 Message Date
Trinity Pointard
30e9620d0a Add csrf protection 2018-06-24 18:58:57 +02:00
Bat
68c7aad179 Big repository reorganization
The code is divided in three crates:
- plume-common, for the ActivityPub module, and some common utils
- plume-models, for the models and database-related code
- plume, the app itself

This new organization will allow to test it more easily, but also to create other tools that only reuse a little part of
the code (for instance a Wordpress import tool, that would just use the plume-models crate)
2018-06-23 17:36:11 +01:00
Bat
0a1edba4b0 Fix the custom properties deserialization bug for Blogs as well 2018-06-23 15:00:35 +01:00
Bat
e7fd12ae6f Set to and cc for new Follow activities 2018-06-23 13:47:53 +01:00
Bat
3a19cae62e Add id, to and cc for Undo Announce 2018-06-23 13:42:27 +01:00
Bat
a88d0e102f Like: only compute ap_url once 2018-06-23 13:40:10 +01:00
Bat
d2c8631ba4 Add cc and to for Announce 2018-06-23 13:36:15 +01:00
Bat
cd9862bc4c Add cc, id and to for Articles 2018-06-23 13:29:41 +01:00
Bat
3ab6dfe288 Add id, to and cc to Undo for Likes 2018-06-23 13:19:14 +01:00
Bat
135797805e Make Like compliant to the spec 2018-06-23 13:17:17 +01:00
Bat
f2795baab5 Make Create Note compliant to the spec 2018-06-23 13:07:07 +01:00
Bat
3ea4823060 Make Accept Follow compliant to the spec 2018-06-23 12:50:14 +01:00
Bat
236767f498 Send the 'Content-Type: application/activity+json' header for ActivityPub request
Should fix #76
2018-06-23 12:23:37 +01:00
Bat
6140865660 Make Post::from_activity a bit more complete 2018-06-23 12:14:03 +01:00
Bat
3b2ca041d0 Rewrite Post::into_activity in a nicer way
And prefer expect over unwrap
2018-06-22 21:45:37 +01:00
Bat
6a5d806b1d Various federation fixes 2018-06-22 16:17:53 +01:00
Didier Link
b153a9ce2b add an argument in the macro may_fail to have the account linked in the error template 2018-06-22 00:50:06 +02:00
Didier Link
feff837313 Merge branch 'master' of https://github.com/Plume-org/Plume 2018-06-22 00:00:15 +02:00
Bat
e34d12922c Serialize publicKey in Person representation 2018-06-21 22:12:24 +01:00
Bat
dccab062e3 Implement Blog::into_activity 2018-06-21 22:07:04 +01:00
Bat
a0f680a9b6 Rewrite Blog::from_activity to use the activitypub crate instead of raw JSON 2018-06-21 21:39:44 +01:00
Bat
e7e557612e Rewrite User::from_activity to use the activitypub crate instead of raw JSON 2018-06-21 21:30:56 +01:00
Bat
f5f2aa7c59 Get rid of the activity_pub::actor::Actor trait 2018-06-21 18:53:57 +01:00
Bat
9a8472bdcc Move compute_box from Actor to Instance 2018-06-21 18:42:17 +01:00
Bat
606a3d12c7 Remove useless functions from activity_pub::actor::Actor 2018-06-21 18:23:01 +01:00
Bat
b2e8d54161 Drop activity_pub::activitypub and activity_pub::ActivityPub and only use the ActivityStream responder 2018-06-21 18:09:18 +01:00
Bat
6df4b70318 Set @context for ActivityStream responder 2018-06-21 17:30:07 +01:00
Bat
ea29dd91dc Set the correct content type for the ActivityStream responder 2018-06-21 17:25:29 +01:00
Bat
3fe2625e86 Simplify the Inbox trait
If we want to add, for instance, streams in the future, we could introduce
a new trait for that, similar to FromActivity or Notify

We also display inbox errors to the "client" if something fails,
which could be useful for debugging.
2018-06-21 17:00:37 +01:00
Bat
5193ad6f65 Remove legacy Inbox::unlike function 2018-06-21 16:45:54 +01:00
Bat
2217ec0d56 Remove PgConnection when we don't need it
Massive simplification in the ActivityPub module!
2018-06-21 16:31:42 +01:00
Bat
7ddad12420 Simplify the signature of activity_pub::sign::Signer::get_key_id 2018-06-21 16:25:32 +01:00
Bat
2621c0304e Better use of the activitypub crate in User::into_activity 2018-06-21 16:14:26 +01:00
Bat
5457a80eec Avoid calling compute_id when we shouldn't
It should only be used at initialization, after we should prefer ap_url,
as not everybody is using the same URLs as Plume.
2018-06-21 15:53:58 +01:00
Bat
4c211b4308 Remove the routes and the template for the comment form 2018-06-21 15:00:25 +01:00
Bat
7ba6f77e0f Automatically insert mentions in comments
Fix some bug with mentions too

Fix #52
2018-06-21 14:05:35 +01:00
Bat
0fd181e7ea Add support for markdown in comments + Correctly federate mentions in comments 2018-06-21 12:00:30 +01:00
Bat
5a5c1a8d99 List all comments 2018-06-21 11:38:07 +01:00
Didier Link
0e85a61aec Merge branch 'master' of https://github.com/Plume-org/Plume 2018-06-21 12:38:00 +02:00
Bat
b0e70a42a9 Merge branch 'master' of github.com:Plume-org/Plume 2018-06-21 11:31:17 +01:00
Bat
e6b8943085 New pattern for comment creation in code
Use the builder design pattern to build a NewComment

Add a function to transform a NewComment into a Create activity

Virtually send this activity to the shared inbox of the instance
2018-06-21 11:28:42 +01:00
Didier Link
2d1a035877 partially solve #68 2018-06-21 11:58:54 +02:00
Bat
3551bef895 Simplify the activity_pub::inbox::Notify trait + Fix notifications
Also fix a bug with the list of mentions that was returned
2018-06-20 22:51:47 +01:00
Bat
d7b71848fc Save mentions 2018-06-20 21:58:11 +01:00
Bat
c4cc4a4e13 Notify when receiving a mention 2018-06-20 21:05:30 +01:00
Bat
c9f29955a0 Save incoming mentions 2018-06-20 20:42:16 +01:00
Bat
215b577573 Add some ActivityPub function to Mention 2018-06-20 20:06:34 +01:00
Bat
356cc20e34 List mentions for user, instead of getting only the first one 2018-06-20 19:25:43 +01:00
Bat
ddd840d31d Add a list_by! macro 2018-06-20 19:23:54 +01:00
Bat
e074af57ff Add a Mention model 2018-06-20 19:22:34 +01:00