Commit Graph

42 Commits (d20d2b9218235b46c6076554184052269c510ba3)

Author SHA1 Message Date
Nutomic d20d2b9218
Implement federated user following (fixes #752) (#2577)
* Implement federated user following (fixes #752)

* rewrite send_activity_in_community and add docs, remove default for column pending

* improve migration

* replace null values in db migration
1 year ago
Nutomic a0fed24cee
When announcing incoming activities, keep extra fields (#2550) 2 years ago
Dessalines 5d837780f5
Add diesel_async, get rid of blocking function (#2510)
* Moving settings to Database.

- Moves many settings into the database. Fixes #2285
- Adds a local_site and instance table. Fixes #2365 . Fixes #2368
- Separates SQL update an insert forms, to avoid runtime errors.
- Adds TypedBuilder to all the SQL forms, instead of default.

* Fix weird clippy issue.

* Removing extra lines.

* Some fixes from suggestions.

* Fixing apub tests.

* Using instance creation helper function.

* Move forms to their own line.

* Trying to fix local_site_data, still broken.

* Testing out async

* Testing out async 2

* Fixing federation tests.

* Trying to fix check features 1.

* Starting on adding diesel async. 1/4th done.

* Added async to views and schema.

* Adding some more async

* Compiling now.

* Added diesel async. Fixes #2465

* Running clippy --fix

* Trying to fix cargo test on drone.

* Trying new muslrust.

* Trying a custom dns

* Trying a custom dns 2

* Trying a custom dns 3

* Trying a custom dns 4

* Trying a custom dns 5

* Trying a custom dns 6

* Trying a custom dns 7

* Addressing PR comments.

* Adding check_apub to all verify functions.

* Reverting back drone.

* Fixing merge

* Fix docker images.

* Adding missing discussion_languages.

* Trying to fix federation tests.

* Fix site setup user creation.

* Fix clippy

* Fix clippy 2

* Test api faster

* Try to fix 1

* Try to fix 2

* What are these lines about

* Trying to fix 3

* Moving federation test back to top.

* Remove logging cat.
2 years ago
Nutomic b0c3185663
Make verify apub url function async (#2514)
* Make verify apub url function async

* cleanup

* use dep from crates.io

* dont use unwrap
2 years ago
Dessalines 235cc8b228
Moving settings to Database. (#2492)
* Moving settings to Database.

- Moves many settings into the database. Fixes #2285
- Adds a local_site and instance table. Fixes #2365 . Fixes #2368
- Separates SQL update an insert forms, to avoid runtime errors.
- Adds TypedBuilder to all the SQL forms, instead of default.

* Fix weird clippy issue.

* Removing extra lines.

* Some fixes from suggestions.

* Fixing apub tests.

* Using instance creation helper function.

* Move forms to their own line.

* Trying to fix local_site_data, still broken.

* Fixing federation tests.

* Trying to fix check features 1.

* Addressing PR comments.

* Adding check_apub to all verify functions.
2 years ago
Nutomic ec5e63b5a9
Fix check for federated mod actions (#2489) 2 years ago
Nutomic fcaf7a084c
Upgrade activitypub_federation to 0.2.0, add setting federation.debug (#2300) 2 years ago
Nutomic a2a594b763
Extract Activitypub logic into separate library (#2288)
* Create example for apub lib

* some rewriting of apub lib

* Add LocalInstance struct for apub lib to avoid using Lemmy Settings

* Move ActorType trait to lemmy_apub, because its not needed in library

* Use reqwest_retry instead of custom impl, dont specify timeout on every send()

* Some improvements to example

* Moved inbox handling to library

* bug fixes

* Move context and serde helpers into library

* wip: example changes

* Add lemmy_utils feature to build only LemmyError

* Rename to activitypub_federation

* Remove lemmy_utils dep from activitypub_federation using generic error type

* Finish activitypub example

* Cleanup and fix tests

* Reorganize library files

* Remove ApubObject.to_tombstone()

* Extract activitypub library into separate git repository
2 years ago
Nutomic 3aa3d75a1e
Add cargo feature for building lemmy_api_common with mininum deps (#2243) 2 years ago
Nutomic 65cac21713
Fix verify_mod_action check for remote admin actions (#2190)
* Fix verify_mod_action check for remote admin actions

* fix federation test
2 years ago
Aode (lion) 97ebf2f6f3 Consolidate reqwest clients, use reqwest-middleware for tracing 2 years ago
Riley 35cbae61bc
Don't drop error context when adding a message to errors (#1958)
* Respond directly with LemmyError

Instrument Perform implementations for more precise traces
Use ApiError to format JSON errors when messages are present
Keep SpanTrace output in LemmyError Display impl

* Hide SpanTrace debug output from LemmyError

* Don't log when entering spans, only when leaving

* Update actix-web

* Update actix-rt

* Add newline after error info in LemmyError Display impl

* Propogate span information to blocking operations

* Instrument apub functions

* Use skip_all for more instrument attributes, don't skip 'self' in some api actions

* Make message a static string

* Send proper JSON over websocket

* Add 'message' to LemmyError display if present

* Use a quieter root span builder, don't pretty-print logs

* Keep passwords and emails out of logs

* Re-enable logging Login

* Instrument feeds

* Emit our own errors

* Move error log after status code recording

* Make Sensitive generic over the inner type

* Remove line that logged secrets
2 years ago
Felix Ableitner afccd5cf69 Replace activitystreams crate with activitystreams-kinds 3 years ago
Felix Ableitner c1f1b8aa0f Activities in community should also be sent to actors in cc 3 years ago
Felix Ableitner 252d87d332 Fix clippy error 3 years ago
Felix Ableitner 888e683856 For verify_is_public() we also need to check cc field 3 years ago
Felix Ableitner a5a674a270 Add method ApubObject.verify() 3 years ago
Felix Ableitner 8ea21c39b7 Reduce stack memory usage in apub code
- use our own, smaller Endpoints struct
- wrap ObjectId.url in Box
- adjust usage of Box in different places
3 years ago
Felix Ableitner c725514841 Change to_apub and from_apub to take by value and avoid cloning 3 years ago
Felix Ableitner 2edf8ba157 Move ObjectId to library 3 years ago
Felix Ableitner bd3352423a Remove ActivityFields trait, deserialize into another struct instead 3 years ago
Felix Ableitner 03d8ac75ef Move activity structs to protocol folder 3 years ago
Felix Ableitner 5ff044346f Move object and collection structs to protocol folder 3 years ago
Felix Ableitner d89156810d Move @context out of object/activity definitions 3 years ago
Felix Ableitner 2d04ff93f5 Change activity.cc to Vec<Url> in public activities 3 years ago
Felix Ableitner 271785b7fb When receiving activity, dont read community from cc (for pleroma compat and better verification) 3 years ago
Felix Ableitner 03b8ae7215 Activity.to should always be a vec (and unspecified size for public activities) 3 years ago
Nutomic 61189efe72
Rewrite collections to use new fetcher (#1861)
* Merge traits ToApub and FromApub into ApubObject

* Rewrite community outbox to use new fetcher

* Rewrite community moderators collection

* Rewrite tombstone
3 years ago
Nutomic 149a4e0de8
Breaking apub changes (#1859)
* Remove CommentInReplyToMigration

* Remove compat for RemovePostCommentOrCommunity

* Remove PublicUrlMigration

* Change type of pm to ChatMessage from Pleroma, make pm.to array

* Use person.summary instead of person.content for pleroma compat

* Also change group.content to summary

* Rewrite apub object test json to serve as nice examples

* Also add test case for parsing pleroma private message
3 years ago
Nutomic dd0ba10b44
Pleroma federation2 (#1855)
* Allow fetching person from Pleroma, including test case (ref #1461)

* Added test case for parsing community from apub json

- fixed a bug with objectid (de)serialization
- fixed a bug with outbox fetching (ref #1582)

* Added apub test for post

* Ignore errors when reading community outbox (fixes #1582)

* Dont fetch community outbox/moderators during tests

* added test for lemmy comment

* Added federation test for pleroma comment

* Added html2md crate to parse comment html from pleroma (fixes #1461)

* some fixes for update_apub_test_files.sh

* Add tests for ToApub, private message, remove update script

* Delete objects from db at the end of each test
3 years ago
Felix Ableitner 1aa0e1997b Major refactor, adding newtypes for apub crate
- this allows moving FromApub/ToApub traits into apub lib
3 years ago
Felix Ableitner f24999027e Merge crates db_schema and db_queries 3 years ago
Nutomic b96ce81f89
Move code to apub library (#1795)
* Remove dependency of apub_lib on LemmyContext

* Move ApubObject trait to library

* Reorganize files in apub lib

* Move ActorType, signatures, activity_queue to apub library
3 years ago
Dessalines 8708ad1b44 Moving settings and secrets to context. 3 years ago
Nutomic 527eefbe92
Rewrite fetcher (#1792)
* Use new fetcher implementation for post/comment

* rewrite person fetch to use new fetcher

* rewrite community to use new fetcher

* rename new_fetcher to dereference_object_id

* make ObjectId a newtype

* handle deletion in new fetcher

* rewrite apub object search to be generic

* move upsert() method out of ApubObject trait

* simplify ObjectId::new (and fix clippy)
3 years ago
Nutomic 2822f5a126
Change public activities to field to array (#1739) 3 years ago
Nutomic f6f169b4eb
Rewrite remaining activities (#1712)
* Limit type/method visibility in apub code

* Simplify db_queries traits by removing generics

* Simplify delete activity implementation

* Rewrite delete activities

* Implement helper functions for websocket message sending

* When receiving delete reason as empty string, change to none

* Rewrite remaining activities

* Simplify inbox

* Remove struct ActivityCommonFields, derive ActivityFields trait instead

* Community should announce received activities to followers
3 years ago
Nutomic 28d6370c35
Rewrite delete activities (#1699)
* Limit type/method visibility in apub code

* Simplify db_queries traits by removing generics

* Simplify delete activity implementation

* Rewrite delete activities

* Implement helper functions for websocket message sending

* When receiving delete reason as empty string, change to none
3 years ago
Nutomic 353a1fe0a0
Rewrite activitypub following, person, community, pm (#1692)
* Rewrite following activities

* Rewrite person apub

* Rewrite community apub

* Rewrite private message activity sending
3 years ago
Felix Ableitner 433ab1e78b Add docs for MediaType, PublicUrl values 3 years ago
Felix Ableitner ff265c7ebc Rewrite apub post (de)serialization using structs (ref #1657) 3 years ago
Felix Ableitner c1db86925f Merge apub, apub_receive crates (fixes #1621) 3 years ago