Commit graph

9817 commits

Author SHA1 Message Date
Mark Felder
8f15000c0f Do not require a cc field when validating an incoming Follow activity
The cc field is not required and the code was keeping the cc if it existed on an activity or replacing it with the default of an empty list when casting. If any Follow activity was received with a cc field, it would attempt to keep it.

This was noticed in !4208 where we would craft Follow requests with a cc value of nil.
2024-08-07 14:38:29 -04:00
feld
45611ed325 Merge branch 'workerhelper-fix' into 'develop'
Fix WebPush notifications not generating jobs

See merge request pleroma/pleroma!4210
2024-08-07 17:37:44 +00:00
Mark Felder
721005b312 Fix WebPush notifications not generating jobs
Dialyzer pointed this one out.

The WorkerHelper removal in !4166 was missing this Oban.insert() and tests were not noticing any problems because we mocked the Push.send function instead of executing it and checking for the Oban job.
2024-08-07 13:00:31 -04:00
Mark Felder
06e8ece4cc Fix CommonAPI.follow/2 which returned users in the reverse order they were provided to the function 2024-08-07 12:39:58 -04:00
feld
351a306d46 Merge branch 'stream-follow-relationships-count' into 'develop'
StreamerView: Do not leak follows count if hidden

See merge request pleroma/pleroma!4205
2024-08-07 16:17:58 +00:00
Mark Felder
9d27a074c1 Merge branch 'stream-follow-relationships-count' into develop 2024-08-07 11:48:52 -04:00
Mark Felder
7d33b53908 Improve the variable naming 2024-08-07 11:47:43 -04:00
feld
a2490ddd9f Merge branch 'remove/workerhelper' into 'develop'
Remove WorkerHelper

See merge request pleroma/pleroma!4166
2024-08-07 13:26:41 +00:00
Mark Felder
c284c4e3e6 Extract the logic from the map 2024-08-07 09:19:33 -04:00
Mark Felder
0bfe592048 Credo 2024-08-06 12:48:36 -04:00
Mark Felder
9ae9e2fc5c Use a struct to hold the prepared data passed to publish_one/1 2024-08-06 12:16:06 -04:00
Mark Felder
83fcf42c70 Force cc to an empty list if undefined 2024-08-06 12:03:44 -04:00
Mark Felder
f8bdcaa161 Split Federator.publish_one/1 into a second function called prepare_one/1 2024-08-06 11:16:04 -04:00
marcin mikołajczak
52f7033f7a StreamerView: Do not leak follows count if hidden
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-04 16:03:25 +02:00
marcin mikołajczak
de9194893e Support id param in GET /api/v1/statuses
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-08-03 18:28:43 +02:00
Mark Felder
1f986ec713 Gun: Publisher job behavior improvement
Gun's connection pool also returns an error if duplicate workers are launched simultaneously. Snooze on this error as well, and lower the snooze to 3 seconds with the optimism that the connection will still be open by then and the delivery can be completed quickly.

The original setting of 30 seconds is pretty high and means there's an unnatural lag between deliveries of activities destined to the same server that were created at nearly the same time. This configuration should be more efficient.
2024-08-02 09:25:18 -04:00
Mark Felder
e6951e7e40 Fix User.disclose_client never working correctly
Our test environment cheats by constructing a conn with a custom oauth_access/2 function. This assigns a :token to the conn but due to the way it is constructed it has the :user preloaded. When the OAuth Plug fetches a token it does not preload the user, so the check for user.disclose_client was always nil and assumed to be false.

Preloading the :user ensures the test environment matches reality.
2024-07-31 14:14:35 -04:00
Mark Felder
52e9bec156 Remove WorkerHelper 2024-07-30 11:34:48 -04:00
feld
18469f3b1d Merge branch 'oban/simpler-publish' into 'develop'
Publisher job simplification

See merge request pleroma/pleroma!4194
2024-07-30 15:23:28 +00:00
feld
c9042763b0 Merge branch 'oban/backup' into 'develop'
Backups Refactoring

See merge request pleroma/pleroma!4158
2024-07-29 16:07:35 +00:00
Mark Felder
b48fd89a41 Revert unintended change to the Logger metadata tag name 2024-07-29 10:03:22 -04:00
Mark Felder
8893ad9899 Fix cancelling jobs 2024-07-29 09:59:35 -04:00
Mark Felder
74072622e0 Remove actor and actor_id from the job as it can be inferred by the activity 2024-07-29 09:52:13 -04:00
Mark Felder
59309a9eff Publisher job simplification
Publisher jobs now store the the activity id instead of inserting duplicate JSON data in the Oban queue for each delivery.
2024-07-28 21:04:36 -04:00
Mark Felder
c19d55cabb Safer string concatenation 2024-07-25 16:18:45 -04:00
Mark Felder
84b15ac111 Improve specs and matching 2024-07-25 16:18:31 -04:00
Mark Felder
775f45cfe2 Merge remote-tracking branch 'origin/develop' into oban/backup 2024-07-25 14:43:40 -04:00
Mark Felder
a964368e31 Add test to fetch and validate an activity that originally failed signature 2024-07-25 14:34:55 -04:00
Mark Felder
1b9c887dbb Extract validate_signature/2 from the HTTPSignaturePlug
This logic only exists in the Plug, so attempting to validate the signature by calling the library function HTTPSignature.validate_conn/2 directly will never work because we do not attempt to construct the (request-target) and @request-target headers with both the commonly misinterpreted and correct implementation of this field. Therefore all attempts to validate a signature from an Oban Job will fail.
2024-07-25 12:54:27 -04:00
Mark Felder
1a482a73c3 Fix Optimistic Inbox for failed signatures
When signatures fail on incoming activities we put the job into Oban to be processed later instead of doing the user fetching and validation inline which is expensive and increases latency on the incoming POST request. Unfortunately we did not retain the :method, :request_path, and :query_string parameters from the conn so the signature validation and Oban Job would always fail.

This was most obvious when Mastodon sends Deletes for users your server has never seen before.
2024-07-25 11:46:30 -04:00
Mark Felder
97d488aea3 Fix RichMedia negative cache entries
The negative cache entry was a nil value, but that is an expected response when the cache is missing an entry so it didn't work as intended.
2024-07-24 15:45:39 -04:00
Mark Felder
5a62868106 Consider errors during HTTP GET and HEAD to be unrecoverable and insert a negative cache entry
This is for a normal HTTP error response or timeout while receiving the data. A hard error from a process crash, DNS lookup failure, etc should produce a different response than {:ok, %Tesla.Env{}} and the request/job will be retryable.
2024-07-24 15:43:49 -04:00
Mark Felder
731f7b87d2 Pad RichMediaWorker timeout to be 2s longer than the Rich Media HTTP timeout 2024-07-24 15:42:50 -04:00
Mark Felder
858fd01c01 Pleroma.HTTP: permit passing through custom Tesla Middlware for requests 2024-07-24 15:40:15 -04:00
Mark Felder
187897874b Make backup timeout configurable 2024-07-23 10:30:57 -04:00
Mark Felder
e5cbbaf3f0 Extend the backup job time limit to 30 minutes 2024-07-23 10:30:57 -04:00
Mark Felder
3f60d7bf64 Better random tempdir format 2024-07-23 10:30:57 -04:00
Mark Felder
ece063586b Limit backup jobs to 5 minutes 2024-07-23 10:30:57 -04:00
Mark Felder
8f285a787f Refactor backups to be fully controlled by Oban 2024-07-23 10:30:40 -04:00
Mark Felder
2ee8f4f062 Fix dialyzer error
lib/pleroma/application.ex:1:pattern_match The pattern can never match the type true.
2024-07-23 10:25:39 -04:00
Mark Felder
12f498bc0d Fix order of args for show_reblogs/2 2024-07-22 19:19:21 -04:00
Mark Felder
3f4f567c9c Fix order of args for hide_reblogs/2 2024-07-22 19:16:00 -04:00
Mark Felder
adb93f7e5d Fix order of args for unfollow/2 2024-07-22 19:11:22 -04:00
Mark Felder
f79a16c062 Fix order of args for follow/2 2024-07-22 19:07:55 -04:00
Mark Felder
082319ff48 Fix order of args for unblock/2 2024-07-22 18:44:32 -04:00
Mark Felder
cbc5e48417 Fix order of args for block/2 2024-07-22 18:41:50 -04:00
Mark Felder
1cccc0fc21 Fix order of args for vote/3 2024-07-22 18:38:02 -04:00
Mark Felder
8127e0d8cc Fix order of args for thread_muted?/2 2024-07-22 18:25:37 -04:00
Mark Felder
4601473aaf Fix order of args for add_mute/2 2024-07-22 18:25:37 -04:00
Mark Felder
d27ad36ce4 Fix order of args for remove_mute/2 2024-07-22 18:25:37 -04:00