Commit graph

117 commits

Author SHA1 Message Date
Nutomic
cd0f009f5f
Add helper deserialize_last() (#148) 2025-07-28 11:22:36 +02:00
Nutomic
fa27a0c0b4
Various additions and changes (#147)
* Add methods Object.id(), Object.deleted()

* Rename ActivityHandler to Activity

* comments

* fix

* comment
2025-07-10 10:26:45 +02:00
Nutomic
659a6a3cff
Add hook for incoming activities (#146)
* Add hook for incoming activities

* sync version working

* async working

* remove generic

* separate methods

* testing

* use trait to allow references
2025-06-18 11:38:34 +02:00
dullbananas
6efa33f006
Implement Clone for Data struct (#145)
* add clone impl

* fmt

* wrap field instead of implementing clone for whole data struct
2025-06-16 11:33:10 +02:00
Felix Ableitner
0c583ed6ee Feature flag for axum-original-uri 2025-06-05 15:40:49 +02:00
Kevin Kuriakose
7994df3706
Use OriginalUri for Axum ActivityData (#141)
* Use OriginalUri for axum ActivityData

When the inbox path is under a nested `Router`, the received request has a URI
with the common prefix stripped. This causes incoming signatures to be considered
invalid since the path is different (see https://github.com/LemmyNet/activitypub-federation-rust/issues/107#issuecomment-2767428107)

This commit uses `OriginalUri` for URI extraction instead, which will retrieve
the full URI regardless of router nesting

* Use router nesting for local_federation

With 8c787f5, router nesting is supported correctly in axum

* Fix docs typo (#143)

---------

Co-authored-by: Zami <szgie@proton.me>
Co-authored-by: Felix Ableitner <me@nutomic.com>
2025-06-02 04:56:25 -04:00
Nutomic
80dce32279
Upgrade deps (#135)
* Upgrade deps (#133)

* Upgrade deps

* fmt

* fix

* remove once_cell

* upgrade rust

* fix warnings

* Upgrading deps. (#137)

* Upgrading deps.

* Axum upgrade.

* Remove some uses of async_trait

* Remove diesel feature

* Rust 1.85

* fix once lock for domain regex

* Revert "Remove some uses of async_trait"

This reverts commit 51bf4b332e.

* update deps

* Make it work with Lemmy

---------

Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2025-06-02 04:39:58 -04:00
Nutomic
b3dac33990
Fixes for either impl (#140)
* Fixes for either impl

* link
2025-03-27 15:58:45 +01:00
Nutomic
697eb01185
Implement Object trait for Either (#139)
* Implement Object, Actor traits for Either

* Upgrade Rust version

* 1.82
2025-03-20 12:16:03 +01:00
Felix Ableitner
f75231ab48 Add note about faster rsa key generation 2025-03-10 17:44:52 +01:00
Nutomic
4ad668cc10
Add more url validation (#134)
* Add more url validation

* fix

* more fix

* Verify url after redirect

* Dont allow redirect for webfinger

* clippy

* more domain validation

* clippy

* fix lemmy test

* Remove trailing . from domain

* clippy

* fix

* manual redirect handling

* clippy

* prevent infinite recursion

* add timeout, comment
2025-01-23 05:11:49 -05:00
Nutomic
2d90dad9f7
Add verify_is_remote_object (#136)
* Add verify_is_remote_object

* doctest
2025-01-21 12:59:35 +01:00
Felix Ableitner
2ad0eff31c Clippy fixes, add cargo shear 2025-01-21 12:58:13 +01:00
Felix Ableitner
43b51d79ce Revert "Upgrade deps (#133)"
This reverts commit 8910550663.
2025-01-09 11:44:59 +01:00
Nutomic
8910550663
Upgrade deps (#133)
* Upgrade deps

* fmt

* fix
2025-01-03 13:41:20 -05:00
Nutomic
b9a89ffc8e
Add method to sign arbitrary http request (#131) 2024-11-19 14:22:05 +01:00
Nutomic
1c29f4e66b
Prevent overwriting local object (#130)
* Throw error when attempting to http fetch local object

* clippy
2024-11-12 13:20:02 +01:00
Nutomic
6814ff1932
If dereference fails, return object from local db instead (#129) 2024-11-08 07:37:55 -05:00
MrKaplan
6dfd30a8ab
Add test case for http fetch limit fixed in #97 (#128) 2024-09-20 10:02:04 +02:00
Nutomic
df8876c096
Log warning if activity sending is slow (#127) 2024-09-19 06:22:48 -04:00
Nutomic
a35c8cbea5
If id of fetched object doesnt match url, refetch it (#126) 2024-09-13 16:09:04 +02:00
Felix Ableitner
027b386514 Avoid stack overflow when fetching deeply nested comments (#124) 2024-09-13 11:21:26 +02:00
Kangwook Lee (이강욱)
487c988377
Upgrade axum and http (#123)
* Upgrade axum and http

* Fix formatting

* use expect

---------

Co-authored-by: Felix Ableitner <me@nutomic.com>
2024-09-11 08:47:13 -04:00
Dessalines
83a156394e
Fixing clippy. (#121) 2024-07-17 10:00:31 +02:00
藍+85CD
8f47daa2e2
refactor!: use rsa instead of openssl (#116)
* refactor!: use `rsa` instead of `openssl`

* fix: format code

* fix: format code

* fix: lint code

* fix: format code
2024-07-15 10:20:35 +02:00
Nutomic
08af457453
Dont connect to broken Pleroma instance during webfinger test (#117) 2024-07-11 11:42:31 -04:00
Nutomic
6edbc06a78
Convert content-type to lowercase for comparison (#114)
* Convert content-type to lowercase for comparison

* rust 1.78

* clippy priority

* upgrade dep
2024-06-11 11:16:04 +02:00
Felix Ableitner
e118e4f240 Reapply "Retry activity send in case of timeout or rate limit (#102)"
This reverts commit 32da1b747c.
2024-06-06 00:02:36 +02:00
Felix Ableitner
32da1b747c Revert "Retry activity send in case of timeout or rate limit (#102)"
This reverts commit 5402bc9c19.
2024-06-05 23:05:26 +02:00
Nutomic
cf1f84993b
Make response content-type check case insensitive (#111)
* Make response content-type check case insensitive

For wordpress compat

* cleaner

* clippy

* fmt

* fmt
2024-05-06 11:09:23 +02:00
Nutomic
be69efdee3
Require signed digest when verifying signatures (#109) 2024-05-02 10:58:56 +02:00
Nutomic
ddc455510b
Dont crash when calling is_local_url() without domain (#108) 2024-05-02 10:58:33 +02:00
Nutomic
54e8a1145f
Add function ObjectId.is_local (#106)
* Add function ObjectId.is_local

* add test

* add test
2024-04-10 11:31:55 +02:00
Nutomic
7def01a19a
Avoid running ci checks twice (#105)
* Avoid running ci checks twice

* upgrade rust

* move clippy config to cargo.toml
2024-04-09 11:28:57 +02:00
Nutomic
a2ac97db98
Allow fetching from local domain in case it redirects to remote (#104)
* Allow fetching from local domain in case it redirects to remote

* clippy

* fix lemmy tests
2024-04-09 11:28:22 +02:00
Nutomic
5402bc9c19
Retry activity send in case of timeout or rate limit (#102) 2024-04-09 10:38:08 +02:00
Nutomic
da28c9c890
Fix request_counter check because fetch_add returns original value (#97) 2024-03-08 09:36:44 -05:00
Nutomic
9b31a7b44b
Get Mastodon signed fetch working (#98)
* debug signed fetch

* regex

* content-type

* no dbg

* clippy
2024-03-08 15:26:57 +01:00
Nutomic
636b47c8b2
Add back activity send queue as optional feature (#94)
* Add back activity send queue as optional feature

* fix port collision in tests

* improve docs

* serialize fn

* deduplicate

* more dedup

* more dedup

* dedupupup

* test cleanup

* remove fn
2024-03-04 08:53:33 -05:00
Nutomic
a859db05bb
Add security checks when fetching objects (#95)
* Add security checks when fetching objects

* static

* as ref

* update comment

* fix header

* Update comment
2024-03-04 12:47:42 +01:00
Nutomic
ec97b44de4
Fix return type for deserialize_one (#93) 2024-01-05 10:18:12 -05:00
Nutomic
9e8d466b40
Better JSON error messages (#91) 2023-12-20 06:19:58 -05:00
Nutomic
709f29b7f8
Context doesnt have to be an array (#90) 2023-12-20 11:21:33 +01:00
Nutomic
50db596ce0
Better error when activity receive fails (#89)
* Minor refactoring

* Better error when receive fails

* clippy

* add test case

* comments

* take ref
2023-12-12 11:30:21 +01:00
Soso
12aad8bf3c
Webfinger: don't discard consumer errors (#85)
* Improve WebFinger errors

* Improve webfinger extraction

* Fix typo

* Document webfinger parsing

* Reimplement Regex based webfinger parsing

* clippy

* no unwrap

---------

Co-authored-by: Felix Ableitner <me@nutomic.com>
2023-12-11 22:48:32 +01:00
Nutomic
24830070f6
Add diesel feature, add ObjectId::dereference_forced (#88)
* Add diesel feature

This can simplify Lemmy code and avoid converting back and forth
to DbUrl type all the time.

* Also add diesel derives for CollectionId

* Add ObjectId::dereference_forced

* no deprecated code

* fmt
2023-12-11 15:04:18 +01:00
Nutomic
1f7de85a53
Upgrade dependencies (#86) 2023-12-01 15:40:12 +01:00
Nutomic
69b80aa6e1
Change impl of ObjectId::parse (#84)
* Change impl of ObjectId::parse

It should be consistent with Url::parse

* fmt
2023-11-24 11:21:00 +01:00
cetra3
098a4299f0
Remove anyhow from trait definitions (#82) 2023-11-20 11:42:47 +01:00
Nutomic
679228873a
Implement PartialEq for testing (#81) 2023-11-13 10:38:58 +01:00