Commit graph

30 commits

Author SHA1 Message Date
Nutomic d39bc14c43
Add some more clippy lints (#2586)
* Add some more clippy lints

* restore config

* no allow dirty

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2022-11-24 16:38:00 +00:00
Nutomic a0fed24cee
When announcing incoming activities, keep extra fields (#2550) 2022-11-12 08:52:57 -05:00
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.
2022-11-09 10:05:00 +00:00
Nutomic b7a2677b4d
Be more explicit about returning deleted actors or not (#2335)
* Be more explicit about returning deleted actors or not

* simplify db queries
2022-07-05 17:40:44 -04:00
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
2022-06-02 16:33:41 +02:00
Nutomic 3aa3d75a1e
Add cargo feature for building lemmy_api_common with mininum deps (#2243) 2022-05-03 17:44:13 +00:00
Nutomic dd865c5af5
Implement instance actor (#1798)
* Implement instance actor

* wip: make site bans federate

* finish implementation and unit tests for federated bans

* start adding api tests

* fix api test

* remve site from GetCommunityResponse

* only federate site bans originating from user's home instance

* dont expose site.private_key in api
2022-02-07 19:23:12 +00:00
Nutomic 4a23ee4d8b
Dont make webfinger request when viewing community/user profile (fixes #1896) (#2049) 2022-01-27 16:39:22 +00:00
Dessalines 1410c5659c
Upgrading deps (#1995) 2021-12-14 13:30:37 +00:00
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
2021-12-06 09:54:47 -05:00
Riley 3fea5645f8
Add tracing (#1942) 2021-11-23 12:16:47 +00:00
Felix Ableitner c725514841 Change to_apub and from_apub to take by value and avoid cloning 2021-11-06 14:47:58 +01:00
Felix Ableitner bd3352423a Remove ActivityFields trait, deserialize into another struct instead 2021-11-05 21:14:19 +01:00
Felix Ableitner 0bde2d595e Add tests for parsing activities and collections 2021-11-02 12:44:51 +01:00
Felix Ableitner 03d8ac75ef Move activity structs to protocol folder 2021-10-29 12:50:32 +02:00
Felix Ableitner 5ff044346f Move object and collection structs to protocol folder 2021-10-29 12:50:32 +02:00
Felix Ableitner 358ef99ea2 Rewrite community followers and user outbox to use our own structs 2021-10-29 12:50:32 +02:00
Felix Ableitner d89156810d Move @context out of object/activity definitions 2021-10-29 12:50:32 +02:00
Felix Ableitner 03b8ae7215 Activity.to should always be a vec (and unspecified size for public activities) 2021-10-29 12:45:54 +02:00
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
2021-10-27 12:03:07 -04:00
Felix Ableitner 1aa0e1997b Major refactor, adding newtypes for apub crate
- this allows moving FromApub/ToApub traits into apub lib
2021-10-20 12:28:09 +02:00
Felix Ableitner f24999027e Merge crates db_schema and db_queries 2021-10-20 12:28:08 +02:00
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
2021-10-06 16:20:05 -04:00
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
2021-08-19 17:24:33 -04:00
Felix Ableitner 57b6ecaf40 Simplify lemmy_context() function (dont return errors) 2021-07-30 23:16:33 +02:00
Felix Ableitner c1db86925f Merge apub, apub_receive crates (fixes #1621) 2021-07-17 18:20:44 +02:00
Felix Ableitner 722cdb78ba Split lemmy_apub crate into two parts apub and apub_receive 2021-03-30 22:29:16 +02:00
Felix Ableitner 249fcc5066 Split api crate into api_structs and api 2021-03-25 20:19:40 +01:00
Felix Ableitner 4f54108a9c Merge branch 'main' into federated-moderation 2021-03-19 17:11:34 +01:00
Dessalines ddf4a667b1 ~80% done 2021-03-10 17:33:55 -05:00