Compare commits

...

1238 Commits

Author SHA1 Message Date
lain
36d469cf02 Merge branch 'release/2.7.0' into 'stable'
v2.7.0

See merge request pleroma/pleroma!4179
2024-08-01 08:53:29 +00:00
Lain Soykaf
a5d32aab50 Mix: Update version to 2.7.0 2024-08-01 11:49:57 +04:00
Lain Soykaf
574bc1fa5f Frontend: Update to 2.7.0 2024-08-01 11:49:36 +04:00
Lain Soykaf
2e6ddc4991 Prepare changelog 2024-08-01 11:44:05 +04:00
feld
f2dc706f6f Merge branch 'fix/disclose_client' into 'develop'
Fix User.disclose_client never working correctly

See merge request pleroma/pleroma!4199
2024-07-31 18:38:49 +00: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
feld
f646b0554f Merge branch 'fix-migration' into 'develop'
Fix publisher job migration error

See merge request pleroma/pleroma!4198
2024-07-30 16:29:48 +00:00
Mark Felder
b50261262e Fix publisher job migration error 2024-07-30 11:48:10 -04:00
feld
355b028c23 Merge branch 'hackney-pool-timeout' into 'develop'
Align Hackney and Gun connection pool timeouts

See merge request pleroma/pleroma!4197
2024-07-30 15:33:17 +00:00
feld
a90838accf Merge branch 'federation/increase' into 'develop'
Increase federator outgoing job parallelism

See merge request pleroma/pleroma!4196
2024-07-30 15:31:18 +00: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
Mark Felder
49f46220ff Align Hackney and Gun connection pool timeouts 2024-07-30 11:11:30 -04:00
Mark Felder
a6119210b7 Increase federator outgoing job parallelism 2024-07-30 11:06:55 -04:00
Mark Felder
1bce582f0d Fix migration crashing due to Oban not running
We can use Pleroma.Repo to fetch the jobs
2024-07-30 10:58:10 -04:00
feld
4e24445b50 Merge branch 'oban/transmog' into 'develop'
Remove unused Oban queue

See merge request pleroma/pleroma!4195
2024-07-30 14:14:40 +00:00
Mark Felder
66649e1dcd Remove unused Oban queue 2024-07-30 09:49:09 -04:00
Mark Felder
05d4989795 Insert replacement jobs in the new format if any remain undelivered
The old jobs remain and will fail gracefully
2024-07-29 14:00:46 -04: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
feld
6876761837 Merge branch 'fix/optimistic-inbox' into 'develop'
Fix Optimistic Inbox for failed signatures

See merge request pleroma/pleroma!4193
2024-07-25 21:18:04 +00:00
Mark Felder
21cf321f74 Quiet Dialyzer
It is angry we are making a fake %Plug.Conn{} to pass through Signature.validate_signature/1. We can work around it by making the code support a map, but then we lose the benefit of being able to use put_req_header/3
2024-07-25 16:36:34 -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
feld
700c106680 Merge branch 'oban/rich-media-hardening' into 'develop'
Harden Rich Media parsing against very slow or malicious URLs

See merge request pleroma/pleroma!4192
2024-07-24 20:58:31 +00:00
Mark Felder
6598919213 Document the new timeout setting 2024-07-24 16:16:37 -04:00
Mark Felder
2314ff5981 Harden Rich Media parsing against very slow or malicious URLs 2024-07-24 15:55:30 -04:00
Mark Felder
8c5a68a62e Increase Oban.Pruner max_age to 15 mins 2024-07-24 15:52:23 -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
feld
f32a837afa Merge branch 'dialyzer' into 'develop'
Fix dialyzer error

See merge request pleroma/pleroma!4190
2024-07-23 14:51:45 +00: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
e5a738d465 Refactor tests for Backups 2024-07-23 10:30:56 -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
feld
ff663c0aeb Merge branch 'commonapi-cleanup' into 'develop'
CommonAPI Cleanup

See merge request pleroma/pleroma!4189
2024-07-22 23:36:18 +00:00
Mark Felder
c700c5db43 changelog 2024-07-22 19:23:16 -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
Mark Felder
f602813d31 Fix order of args for update/2 2024-07-22 18:25:37 -04:00
Mark Felder
7e37882cf7 Fix order of args for favorite/2 2024-07-22 18:25:37 -04:00
Mark Felder
b1d3348331 Annotate public functions with typespecs and mark some functions as private 2024-07-22 18:25:33 -04:00
Mark Felder
3a79f060bb Add missing type 2024-07-22 15:32:20 -04:00
feld
f77911f05b Merge branch 'oban/more-improvements' into 'develop'
Oban: more improvements

See merge request pleroma/pleroma!4187
2024-07-22 17:45:44 +00:00
feld
058f8acb58 Merge branch 'metadata/parsing-empty' into 'develop'
Fix Metadata providers when parsing objects with no content or summary

See merge request pleroma/pleroma!4188
2024-07-21 04:33:34 +00:00
Mark Felder
f9647a86ed Fix the ObjectValidator error matching 2024-07-21 00:03:51 -04:00
Mark Felder
cf70656d14 Fix test now that the reject error has more detail 2024-07-20 23:58:47 -04:00
Mark Felder
fb654acfad Fix OpenGraph and Twitter metadata providers when parsing objects with no content or summary fields. 2024-07-20 23:48:54 -04:00
Mark Felder
fdeb8616e8 Increase timeout for background, remote fetcher, and user refresh jobs 2024-07-20 22:16:33 -04:00
Mark Felder
d62a9afed3 Improved detecting unrecoverable errors for incoming federation jobs 2024-07-20 21:53:03 -04:00
Mark Felder
b8503f1ad4 PollWorker jobs will not retry if the activity no longer exists. 2024-07-20 21:24:13 -04:00
Mark Felder
e509519db4 Publisher jobs will not retry if the error received is a 400 2024-07-20 21:21:21 -04:00
feld
e4a6973e0b Merge branch 'transmogrifier/handle-non-validate-delete-errors' into 'develop'
Transmogrifier: handle non-validate errors on incoming Delete activities

See merge request pleroma/pleroma!4185
2024-07-21 00:47:10 +00:00
feld
776b069a04 Merge branch 'oban/cancel-federation' into 'develop'
Cancel queued publishing jobs when undoing an activity

See merge request pleroma/pleroma!4186
2024-07-20 19:33:27 +00:00
Mark Felder
d44765bc13 Support cancelling jobs when Unreacting 2024-07-20 15:14:46 -04:00
Mark Felder
304b7f5093 Support cancelling jobs when Unrepeating 2024-07-20 15:06:19 -04:00
Mark Felder
86ae00f9da Support cancelling jobs when Unfavoriting 2024-07-20 14:54:31 -04:00
Mark Felder
3f5c9f003b Reorganize test group to have shared a shared setup 2024-07-20 14:54:31 -04:00
Mark Felder
62280a3b9f Cancel queued (undelivered) publishing jobs for an activity when deleting that activity. 2024-07-20 14:54:04 -04:00
Mark Felder
d3c2180181 Formatting 2024-07-18 12:12:34 -04:00
Mint
1f3ac66844 Transmogrifier: handle non-validate errors on incoming Delete activities
This should fix WithClauseError resulting in Oban jobs for processing
incoming deletes being retried without getting cancelled when those
deletes are MRF rejected.
2024-07-18 18:04:32 +03:00
feld
c45ee5fc82 Merge branch 'oban/fetcher-rejected' into 'develop'
Dialyzer fix for RemoteFetcherWorker

See merge request pleroma/pleroma!4183
2024-07-17 18:03:48 +00:00
feld
89d22ac68e Merge branch 'docs/fix_mrfs' into 'develop'
Add docs for fix_mrf_policies

See merge request pleroma/pleroma!4184
2024-07-17 17:52:19 +00:00
Mark Felder
6cd3f9042f Add docs for fix_mrf_policies 2024-07-17 13:51:56 -04:00
feld
4544505761 Merge branch 'oban/rich-media-invalid' into 'develop'
Rework some Rich Media functionality for better error handling

See merge request pleroma/pleroma!4182
2024-07-17 17:50:17 +00:00
Mark Felder
c05cbaa937 Dialyzer fix for RemoteFetcherWorker 2024-07-17 13:42:13 -04:00
Mark Felder
f753bd3380 Explicitly handle the GET and HEAD errors 2024-07-17 13:12:51 -04:00
Mark Felder
1e0d5934d5 Fix return for cancelling job 2024-07-17 12:51:38 -04:00
Mark Felder
d124d8645e Rework some Rich Media functionality for better error handling
Oban should not retry jobs that are likely to fail again
2024-07-17 12:40:07 -04:00
feld
b4c5cc39f6 Merge branch 'oban/live_dashboard' into 'develop'
Add Oban Live Dashboard

See merge request pleroma/pleroma!4180
2024-07-17 13:52:07 +00:00
Mark Felder
4cbb59c8f6 Add Oban Live Dashboard 2024-07-17 09:32:29 -04:00
feld
683c4f0867 Merge branch 'fix-mrfs' into 'develop'
Added a Mix task "pleroma.config fix_mrf_policies"

See merge request pleroma/pleroma!4177
2024-07-15 19:21:53 +00:00
Mark Felder
c9203f125c Added a Mix task "pleroma.config fix_mrf_policies" which will remove erroneous MRF policies from ConfigDB 2024-07-15 15:21:16 -04:00
feld
cd535861e2 Merge branch 'oban/improvements' into 'develop'
Oban improvements

See merge request pleroma/pleroma!4176
2024-07-15 16:50:55 +00:00
Mark Felder
80e16de3bd Increase slow job queue parallelization 2024-07-15 12:00:58 -04:00
Mark Felder
30defb1674 Create a DeleteWorker and change user and instance deletion jobs to use it
These deletion tasks are slow, but the other background jobs are not. This
will allow us to have a lower timeout on the normal background jobs.
2024-07-15 11:58:07 -04:00
Mark Felder
52b6dd8bff Increase background job concurrency to 20 2024-07-15 11:45:13 -04:00
Mark Felder
2f14990c5c Change PurgeExpiredActivity to use the background queue 2024-07-15 11:45:13 -04:00
Mark Felder
2e2caad28d Fix Oban jobs exiting with :error instead of :cancel 2024-07-15 11:45:12 -04:00
Mark Felder
6278af209a Bump Oban to 2.17.12 2024-07-15 10:27:39 -04:00
Mark Felder
1e8d1904e6 Define missing Oban timeouts 2024-07-15 10:27:37 -04:00
feld
0ea63d824e Merge branch 'oban/deprecate-discards' into 'develop'
Oban: change :discard return values to :cancel

See merge request pleroma/pleroma!4175
2024-07-12 15:58:59 +00:00
Mark Felder
f52b229baa Oban: change :discard return values to :cancel
:discard will be removed in Oban 3.0. It was only meant for internal use.
2024-07-12 11:40:59 -04:00
feld
3754713599 Merge branch 'oban/fetcher-discard-rejected' into 'develop'
Discard Remote Fetcher jobs which errored due to an MRF rejection

See merge request pleroma/pleroma!4174
2024-07-12 14:56:55 +00:00
feld
680da772e7 Merge branch 'oban/remove-ingestion' into 'develop'
Remove the unused ingestion queue

See merge request pleroma/pleroma!4173
2024-07-12 14:55:02 +00:00
feld
2e7258cafd Merge branch 'move-poison' into 'develop'
Move poison dependency

See merge request pleroma/pleroma!4156
2024-07-12 14:26:25 +00:00
feld
19eeea7c12 Merge branch 'develop' into 'develop'
LDAP Authenticator: Improve error reporting.

See merge request pleroma/pleroma!4171
2024-07-12 14:25:49 +00:00
Mark Felder
b051e68bb0 Discard Remote Fetcher jobs which errored due to an MRF rejection 2024-07-12 10:15:02 -04:00
Mark Felder
d790df73f6 Remove the unused ingestion queue 2024-07-12 10:12:18 -04:00
Taylan Kammer
03c3c58d74 LDAP Authenticator: Improve error reporting. 2024-07-10 09:22:58 +02:00
feld
ef2ada59e0 Merge branch 'refactor/group-posts' into 'develop'
Refactor maybe_handle_group_posts/1

See merge request pleroma/pleroma!4170
2024-07-06 21:33:07 +00:00
Mark Felder
272aae157e Refactor maybe_handle_group_posts/1 2024-07-06 17:02:33 -04:00
Pleroma User
e4ba5777ee Merge branch 'develop' into 'move-poison'
# Conflicts:
#   mix.exs
2024-07-06 13:59:30 +00:00
tusooa
9e3633501b Merge branch 'weblate' into 'develop'
Translations update from Pleroma Weblate

See merge request pleroma/pleroma!4157
2024-07-03 02:24:28 +00:00
Pleroma User
2967e5fa44 Translated using Weblate (Ukrainian)
Currently translated at 94.5% (86 of 91 strings)

Translation: Pleroma/Pleroma Backend (domain static_pages)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-static_pages/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
4b7be135f0 Translated using Weblate (Ukrainian)
Currently translated at 16.2% (160 of 985 strings)

Translation: Pleroma/Pleroma Backend (domain config_descriptions)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-config_descriptions/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
a8ad40dfd2 Translated using Weblate (Ukrainian)
Currently translated at 12.0% (6 of 50 strings)

Translation: Pleroma/Pleroma Backend (domain oauth_scopes)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-oauth_scopes/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
4d07b82f3e Translated using Weblate (Ukrainian)
Currently translated at 94.5% (86 of 91 strings)

Translation: Pleroma/Pleroma Backend (domain static_pages)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-static_pages/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
245f924009 Translated using Weblate (Ukrainian)
Currently translated at 65.9% (31 of 47 strings)

Translation: Pleroma/Pleroma Backend (domain posix_errors)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-posix_errors/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
ee528296ee Translated using Weblate (Ukrainian)
Currently translated at 91.1% (31 of 34 strings)

Translation: Pleroma/Pleroma Backend (domain default)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-default/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
7406892940 Translated using Weblate (Ukrainian)
Currently translated at 15.7% (155 of 985 strings)

Translation: Pleroma/Pleroma Backend (domain config_descriptions)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-config_descriptions/uk/
2024-07-01 20:38:32 +00:00
Pleroma User
6c3df79299 Added translation using Weblate (Ukrainian) 2024-07-01 20:38:32 +00:00
Pleroma User
ad10750ba2 Added translation using Weblate (Ukrainian) 2024-07-01 20:38:32 +00:00
Pleroma User
35d64a8b64 Added translation using Weblate (Ukrainian) 2024-07-01 20:38:32 +00:00
feld
7a4687562a Merge branch 'fix/ldap' into 'develop'
Fix LDAP support

See merge request pleroma/pleroma!4168
2024-07-01 20:38:20 +00:00
Mark Felder
2fe1e96f2b Fix LDAP support 2024-07-01 16:02:13 -04:00
Mark Felder
eb419b7ffd Add eldap back to applications as the module functions were unavailable 2024-07-01 15:58:49 -04:00
Mark Felder
3127c5f0af Fix automatic LDAP account registration on OTP 24.3+ 2024-07-01 15:58:15 -04:00
feld
e1981264a3 Merge branch 'warnings/elixir-1.17' into 'develop'
Elixir 1.17 warnings

See merge request pleroma/pleroma!4163
2024-07-01 17:33:50 +00:00
Mark Felder
62d9333eb0 CI: Switch to Elixir 1.17 2024-07-01 15:58:56 +00:00
Mark Felder
da05e21375 Fix cycles job name 2024-07-01 15:58:20 +00:00
Mark Felder
9402789437 Dialyzer: fix typespec 2024-07-01 11:47:27 -04:00
Mark Felder
b283b686c4 Dialyzer: Function application with args (_ :: map()) will not succeed. 2024-07-01 11:45:27 -04:00
Mark Felder
7955cd90e6 Dialyzer: The guard clause can never succeed. 2024-07-01 11:45:27 -04:00
Mark Felder
fd62969dc4 Dialyzer: pattern can never match the type 2024-07-01 11:45:25 -04:00
Mark Felder
a008005bdd Dialyzer: fix typespec 2024-07-01 11:38:40 -04:00
Mark Felder
69482004fc Dialyzer: pattern can never match the type because it is covered by previous clauses. 2024-07-01 11:38:40 -04:00
Mark Felder
33fa035c31 Update elixir-captcha to fix the compile warning 2024-07-01 11:38:40 -04:00
Mark Felder
71c8030e61 Update Phoenix to 1.7.14 2024-07-01 11:38:40 -04:00
Mark Felder
436286c93f Update Tesla to 1.11.0 2024-07-01 11:38:40 -04:00
Mark Felder
fb52099a13 Elixir 1.17 single quote charlist warning 2024-07-01 11:38:40 -04:00
Mark Felder
6e1aa8aeeb Elixir 1.17 undefined module warning
Fixes module name being not fully qualified

    warning: AdminAPI.FallbackController.call/2 is undefined (module AdminAPI.FallbackController is not available or is yet to be defined)
    │
  5 │ defmodule Pleroma.Web.AdminAPI.RuleController do
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ lib/pleroma/web/admin_api/controllers/rule_controller.ex:5: Pleroma.Web.AdminAPI.RuleController.action/2

    warning: AdminAPI.FallbackController.init/1 is undefined (module AdminAPI.FallbackController is not available or is yet to be defined)
    │
  5 │ defmodule Pleroma.Web.AdminAPI.RuleController do
    │ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    │
    └─ lib/pleroma/web/admin_api/controllers/rule_controller.ex:5: Pleroma.Web.AdminAPI.RuleController.action/2
2024-07-01 11:38:40 -04:00
Mark Felder
d3cccce9fd Elixir 1.17 warnings for parens
Function calls must have parens
2024-07-01 11:38:40 -04:00
lain
ccbbee7963 Merge branch 'exif' into 'develop'
Ensure StripLocation works for PNGs

See merge request pleroma/pleroma!4167
2024-06-30 09:28:17 +00:00
Lain Soykaf
abbc5b6e48 Add changelog 2024-06-30 11:47:07 +04:00
Lain Soykaf
6d4fb53206 StripLocation: Remove all PNG extra info to make sure that GPS data is gone. 2024-06-28 21:59:00 +04:00
Lain Soykaf
ba88c5078a StripLocationTest: Add failing test for PNGs 2024-06-28 20:31:03 +04:00
feld
801a9367d0 Merge branch 'fix/oban-user-refresh-unique' into 'develop'
Oban Jobs for refreshing users were not respecting the uniqueness setting

See merge request pleroma/pleroma!4164
2024-06-28 14:47:25 +00:00
feld
01fb4776f8 Merge branch 'gun-pool-logs' into 'develop'
Change Gun connection pool logs to debug

See merge request pleroma/pleroma!4165
2024-06-28 14:39:42 +00:00
Mark Felder
9e5adf31c0 Change Gun connection pool logs to debug 2024-06-28 10:23:02 -04:00
Mark Felder
51a36bc9b8 Oban Jobs for refreshing users were not respecting the uniqueness setting 2024-06-28 10:12:58 -04:00
feld
394cb1e0f5 Merge branch 'ci/elixir-1.16' into 'develop'
Ci/elixir 1.16

See merge request pleroma/pleroma!4162
2024-06-28 13:20:46 +00:00
Mark Felder
01ed270dba Changelog 2024-06-27 14:06:15 +00:00
Mark Felder
6e932495dc Change CI jobs to Elixir 1.16.3 2024-06-27 14:05:59 +00:00
Mark Felder
f0334dce30 Add 1.16.3 ci image 2024-06-27 13:52:59 +00:00
feld
9953b0da59 Merge branch 'oban/richmedia-stream' into 'develop'
RichMedia: test that activity is streamed out after backfill

See merge request pleroma/pleroma!4160
2024-06-24 14:06:02 +00:00
Mark Felder
b135fa35a1 RichMedia: test that activity is streamed out 2024-06-24 09:47:16 -04:00
feld
a9bea02fe9 Merge branch 'oban/richmedia-stream' into 'develop'
Add test validating the activity_id is correctly present in the Oban job

See merge request pleroma/pleroma!4159
2024-06-24 02:05:41 +00:00
Mark Felder
634e3d4155 Add test validating the activity_id is correctly present in the Oban job
This was preventing the activity from being streamed over websockets.
2024-06-23 21:45:56 -04:00
pleromian
56927ffd22 add changelog for poison 2024-06-22 00:25:44 +02:00
feld
93eb458c24 Merge branch 'netbsd-wip' into 'develop'
update docs for NetBSD

See merge request pleroma/pleroma!4150
2024-06-21 15:35:48 +00:00
pleromian
47c6f3ddc6 poison is used only in tests 2024-06-21 00:41:09 +02:00
pleromian
b33b1b7253 docs: update nginx and rcscript path for NetBSD 2024-06-20 23:52:25 +02:00
feld
73916dbead Merge branch 'enable-erratic' into 'develop'
Enable erratic tests

See merge request pleroma/pleroma!4155
2024-06-20 20:20:32 +00:00
Mark Felder
7d5065819c Enable erratic tests 2024-06-20 19:43:39 +00:00
feld
fee1e17d87 Merge branch 'erratic/gun' into 'develop'
Gun Connection Pool: successfully retry after reclaiming the pool

See merge request pleroma/pleroma!4154
2024-06-20 18:50:07 +00:00
Mark Felder
9ef021e2da Switch the reclaimer to GenServer.start so it is not linked 2024-06-20 14:17:28 -04:00
Mark Felder
c765fcbe7e Gun Connection Pool: successfully retry after reclaiming the pool 2024-06-20 14:03:22 -04:00
feld
1071632a50 Merge branch 'fix/debug-logs' into 'develop'
Set console logs to :info for Elixir 1.15+

See merge request pleroma/pleroma!4151
2024-06-20 13:37:16 +00:00
Mark Felder
655ac98478 Merge remote-tracking branch 'origin/develop' into fix/debug-logs 2024-06-20 09:00:39 -04:00
feld
4a881ba366 Merge branch 'ci/cache' into 'develop'
Change CI caching strategy

See merge request pleroma/pleroma!4153
2024-06-20 13:00:09 +00:00
Mark Felder
f00a681cc1 Change CI caching strategy
Key the cache on the image being used and the commit sha. This should allow the cache to be reused by the same runner across multiple jobs/stages where appropriate.
2024-06-20 08:59:39 -04:00
feld
d4563f67e0 Merge branch 'oban/rich-media-backfill' into 'develop'
Rich Media Backfill with Oban

See merge request pleroma/pleroma!4152
2024-06-20 04:09:22 +00:00
Mark Felder
e1e099d3bf Set console logs to :info for Elixir 1.15+ 2024-06-19 23:26:12 -04:00
Mark Felder
17d04ccc8b RichMedia backfill processing through Oban 2024-06-19 23:20:22 -04:00
Mark Felder
4dfa50f256 Rename RichMediaExpirationWorker to RichMediaWorker 2024-06-19 22:24:48 -04:00
feld
9a4cdde5c9 Merge branch 'bugfix/elixir-1.15' into 'develop'
Elixir 1.15 compatibility

See merge request pleroma/pleroma!3917
2024-06-20 01:07:41 +00:00
pleromian
af53efa9e3 docs: update docs for NetBSD 2024-06-20 01:40:02 +02:00
Mark Felder
ed2976b237 Custom mix task to retry failed tests once in CI pipeline
This will be temporary* as we hunt down the cause of the random test failures

* gonna regret this
2024-06-19 19:04:12 -04:00
Mark Felder
3a8420b141 Remove remaining vestiges of Logger support in ConfigDB/TransferTask 2024-06-19 14:29:44 -04:00
Mark Felder
e0afb2c093 Elixir Logger configuration is now longer permitted through AdminFE and ConfigDB 2024-06-19 16:39:49 +00:00
Mark Felder
85b81cc933 Remove Logger from ConfigDB descriptions 2024-06-19 10:32:15 -04:00
Mark Felder
febf9d2684 Remove Logger from ConfigDB 2024-06-19 10:32:15 -04:00
Mark Felder
c11c35cf8f Enable :logger_backends application on < Elixir 1.15 2024-06-18 17:06:09 +00:00
Mark Felder
e43e09a04c Merge remote-tracking branch 'origin/develop' into bugfix/elixir-1.15 2024-06-18 16:47:01 +00:00
Mark Felder
e628d00a81 Disable Ecto logging in tests
The debug logs are very noisy and can be enabled during analysis of a specific error believed to be SQL-related
2024-06-18 15:25:18 +00:00
Mark Felder
3aed111a42 Enable capture_log globally 2024-06-18 10:50:31 -04:00
feld
3c1db78a6e Merge branch 'oban/user-refresh' into 'develop'
Refactor the async user refreshing to use Oban

See merge request pleroma/pleroma!4149
2024-06-18 13:06:11 +00:00
Mark Felder
9c67637255 Refactor the async user refreshing to use Oban
Previous implementation could cause duplicate simultaneous profile fetches which is not polite.
2024-06-17 10:41:14 -04:00
lain
825541b27c Merge branch 'async-user-refresh' into 'develop'
Async user refreshing

See merge request pleroma/pleroma!4148
2024-06-17 13:09:11 +00:00
Mark Felder
e37845cd35 Stale user refreshing should be done async to prevent blocking of rendering activities 2024-06-16 17:39:35 -04:00
Mark Felder
cbf8f8ac0d Fix mix pleroma.config dump on Elixir 1.15 2024-06-13 10:48:50 -04:00
Mark Felder
a734efeff8 Formatting 2024-06-12 15:21:43 -04:00
Lain Soykaf
41434ffcec Tests: Don't spawn processes in tests. 2024-06-12 15:20:04 -04:00
Haelwenn (lanodan) Monnier
6774ff15db docs: Bump elixir requirement up to 1.16 2024-06-12 15:20:04 -04:00
Haelwenn (lanodan) Monnier
cf9a058fae CI: Disallow failures for Elixir 1.15 2024-06-12 15:20:03 -04:00
Haelwenn (lanodan) Monnier
c389ea0f42 Fix compatibility with Loggers in Elixir 1.15+ 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
ba6afdb44d mix: Turn off prune_code_path 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
3d0d2a4513 media_controller_test: Make sure uploader is the Local one 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
2180537a2b MediaProxy: :whitelist config fallback to [] 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
66ac2e9b81 Upload.base_url: Don't pass nil to Path.join(), don't return nil 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
3e7f05d0b1 Add changelog entry (elixir-1.15) 2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
8757c5e35a Logger.warn → Logger.warning
Note: Logger.warning got added in Elixir 1.11.0
2024-06-12 15:18:47 -04:00
Haelwenn (lanodan) Monnier
cb91dab75f Switch formatting checks to Elixir 1.15 2024-06-12 15:18:47 -04:00
lain
38e6166d93 Merge branch '3280-emoji' into 'develop'
Transmogrifier: Encode Emoji id to be valid.

Closes #3280

See merge request pleroma/pleroma!4147
2024-06-12 09:15:14 +00:00
Lain Soykaf
1ae5c2b020 Transmogrifier: Encode Emoji id to be valid. 2024-06-12 12:41:33 +04:00
feld
4a28b81b59 Merge branch 'fix-webpush-actor' into 'develop'
Fix WebPush actor regression

See merge request pleroma/pleroma!4146
2024-06-11 23:08:12 +00:00
Mark Felder
5c8afbe646 Fix tests 2024-06-11 18:55:10 -04:00
Mark Felder
6a9d9da26f Cyclical complexity 2024-06-11 18:38:41 -04:00
Mark Felder
a291a6b8c0 Ensure the webpush notification for e.g., mentions start with the nickname of the actor it originates from 2024-06-11 18:15:32 -04:00
Mark Felder
603a575766 The user is not always preloaded into the notification 2024-06-11 18:14:07 -04:00
Mark Felder
568819c08a WebPush refactoring: separate build and deliver steps 2024-06-11 17:58:02 -04:00
feld
f47a124698 Merge branch 'webpush-polls' into 'develop'
Render nice web push notifications for polls

See merge request pleroma/pleroma!4144
2024-06-11 20:24:15 +00:00
feld
61506f8d93 Merge branch 'api-spex-error' into 'develop'
ApiSpec: Use conn.request_path for more legible error log

See merge request pleroma/pleroma!4145
2024-06-11 20:08:08 +00:00
Mark Felder
5313255b1a Use conn.request_path for more legible error log 2024-06-11 16:07:22 -04:00
Mark Felder
2fd155fb9b Add PollWorker test; move the streaming notification test to it 2024-06-11 15:59:48 -04:00
Mark Felder
51eeb80822 Merge remote-tracking branch 'origin/develop' into webpush-polls 2024-06-09 08:37:24 -04:00
lain
de80a7e890 Merge branch 'otp-bumps' into 'develop'
OTP version bumps

See merge request pleroma/pleroma!4143
2024-06-09 08:40:52 +00:00
Mark Felder
f000dab372 Switch test case to Impl.build_content/3 2024-06-08 22:54:59 -04:00
Mark Felder
8468d78882 Increase web push character limit for the body 2024-06-08 22:54:59 -04:00
Mark Felder
c1b84edefc Increase web push character limit for the body 2024-06-08 22:48:38 -04:00
Mark Felder
dcc50da400 Stream the notifications as part of the job 2024-06-08 22:40:08 -04:00
Mark Felder
3211557f74 Render nice web push notifications for polls 2024-06-08 22:08:12 -04:00
Mark Felder
b1ef6e5e9a Cleanup to make the code easier to follow 2024-06-08 19:50:01 -04:00
Mark Felder
86fa0889bc Remove unnecessary mastodon_type hack 2024-06-08 19:30:27 -04:00
Mark Felder
db88bf30d5 Add spec for send/1 2024-06-08 19:20:38 -04:00
Mark Felder
07cb89823f More robust validation the vapid config is set 2024-06-08 18:59:51 -04:00
Mark Felder
0641a1058a Update job names 2024-06-08 15:18:46 -04:00
Mark Felder
84319dbca4 OTP updates
Update to otp25 for Elixir 1.13; otp26 for Elixir 1.15
2024-06-08 14:44:09 -04:00
feld
9d67827619 Merge branch 'stream-poll-end' into 'develop'
Stream end of poll notification over websockets and web push

See merge request pleroma/pleroma!4137
2024-06-08 17:55:01 +00:00
Mark Felder
471412ad34 Stream end of poll notification over websockets and web push 2024-06-08 13:19:41 -04:00
Mark Felder
b1c52c3062 Rename Notification.send/1 to Notification.stream/1
Also update other places where we use the term "send" instead of "stream". This should make it clearer that we are streaming these over websockets / web push and not sending an activity.
2024-06-08 13:14:25 -04:00
Mark Felder
a5424c3681 Test that end of poll notifications are streamed over websockets 2024-06-08 13:08:28 -04:00
feld
c24e222887 Merge branch 'bump-deps' into 'develop'
Bump deps

See merge request pleroma/pleroma!4140
2024-06-08 01:39:09 +00:00
Pleroma User
dbf29cbae4 Bump deps 2024-06-08 01:39:08 +00:00
feld
b23b007d00 Merge branch 'feld/cleanup' into 'develop'
Minor cleanup commits

See merge request pleroma/pleroma!4142
2024-06-07 21:52:55 +00:00
feld
a4bd89c77e Merge branch 'spex/notification-types' into 'develop'
Spex: Add missing notification types to the api spec

See merge request pleroma/pleroma!4141
2024-06-07 20:42:50 +00:00
feld
f44987bd0f Merge branch 'bugfix/rich_media_config' into 'develop'
RichMedia: Respect configuration on status previews

See merge request pleroma/pleroma!4130
2024-06-07 20:37:19 +00:00
Mark Felder
d98b1c2757 Small cleanup / fixes 2024-06-07 16:35:26 -04:00
Mark Felder
5ed07aba7a Add missing pool to the type 2024-06-07 16:34:32 -04:00
Mark Felder
6ded017dee Do not start unused ConcurrentLimiter processes 2024-06-07 16:34:13 -04:00
Mark Felder
b52d772a6e Add some useful logging for ApiSpec errors 2024-06-07 16:26:56 -04:00
Mark Felder
5915062874 Add missing notification types to the api spec 2024-06-07 15:50:11 -04:00
Mark Felder
49156f0183 Fixes for default disabled rich media in test environment
Also add a test to validate the correct error when disabled
2024-06-07 13:31:34 -04:00
feld
bf8b251dc1 Merge branch 'cowboy-streaming' into 'develop'
Allow Cowboy to stream the response instead of chunk it

See merge request pleroma/pleroma!4138
2024-06-05 12:18:56 +00:00
Mark Felder
858d528cc1 Allow Cowboy to stream the response instead of chunk it 2024-06-04 23:08:05 -04:00
lain
acde8d0e0c Merge branch 'ipfs-dialyzer-fixes' into 'develop'
IPFS uploader: dialyzer fixes

See merge request pleroma/pleroma!4129
2024-06-01 11:30:42 +00:00
lain
cdeeb4dcc5 Merge branch '3276-pinned-collection-fetch' into 'develop'
Use proper workers for fetching pins instead of an ad-hoc task

Closes #3276

See merge request pleroma/pleroma!4136
2024-06-01 09:54:12 +00:00
Floatingghost
0302431888
Use proper workers for fetching pins instead of an ad-hoc task
BUG: https://git.pleroma.social/pleroma/pleroma/-/issues/3276
2024-05-31 09:09:04 -04:00
Mark Felder
cfc8d7aade IPFS uploader: dialyzer fixes
lib/pleroma/uploaders/ipfs.ex:43:no_return
Function put_file/1 has no local return.
________________________________________________________________________________
lib/pleroma/uploaders/ipfs.ex:49:call
The function call will not succeed.

Pleroma.HTTP.post(
  binary(),
  _mp :: %Tesla.Multipart{
    :boundary => binary(),
    :content_type_params => [binary()],
    :parts => [
      %Tesla.Multipart.Part{
        :body => binary(),
        :dispositions => [any()],
        :headers => [any()]
      },
      ...
    ]
  },
  [],
  [{:params, [{:"cid-version", <<49>>}]}]
)

will never return since the success typing is:
(binary(), binary(), [{binary(), binary()}], Keyword.t()) ::
  {:error, _}
  | {:ok,
     %Tesla.Env{
       :__client__ => %Tesla.Client{
         :adapter => nil | {_, _} | {_, _, _},
         :fun => _,
         :post => [any()],
         :pre => [any()]
       },
       :__module__ => atom(),
       :body => _,
       :headers => [{_, _}],
       :method => :delete | :get | :head | :options | :patch | :post | :put | :trace,
       :opts => [{_, _}],
       :query => [{_, _}],
       :status => nil | integer(),
       :url => binary()
     }}

and the contract is
(Pleroma.HTTP.Request.url(), String.t(), Pleroma.HTTP.Request.headers(), :elixir.keyword()) ::
  {:ok, Tesla.Env.t()} | {:error, any()}
2024-05-30 15:14:27 -04:00
feld
ff6f5a417f Merge branch 'mrf-nsfw-otp25' into 'develop'
Fix Logger.warn deprecation error on OTP25

See merge request pleroma/pleroma!4135
2024-05-30 15:38:18 +00:00
lain
6feb536e79 Merge branch 'missing-fks' into 'develop'
Add missing foreign key indexes

See merge request pleroma/pleroma!4134
2024-05-30 15:24:24 +00:00
Mark Felder
f5065eaf99 Fix Logger.warn deprecation error on OTP25 2024-05-30 11:09:42 -04:00
Mark Felder
5f6e477eca Missing FKs changelog 2024-05-30 10:53:05 -04:00
Mark Felder
c20ac6d1ad Add missing foreign key indexes 2024-05-30 10:53:00 -04:00
Mark Felder
b5fcb82bff Test for missing FK indexes 2024-05-30 10:49:45 -04:00
lain
bc4d6adbec Merge branch 'bandit-update' into 'develop'
Update Bandit to 1.5.2

See merge request pleroma/pleroma!4133
2024-05-30 09:35:42 +00:00
Mark Felder
36b440d9be Update Bandit to 1.5.2
Lots of fixes, also requires Websock Adapter update due to internal module changes in Bandit 1.4.0.
2024-05-29 21:59:50 -04:00
feld
b4332b47d5 Merge branch 'mix-indexer' into 'develop'
Add additional flags to the Pleroma.Search.Indexer Mix task

See merge request pleroma/pleroma!4131
2024-05-29 15:04:58 +00:00
Mark Felder
14b4bd69a8 Add additional flags to the Pleroma.Search.Indexer Mix task 2024-05-29 10:44:40 -04:00
Haelwenn (lanodan) Monnier
65c8763907
RichMedia: Add extra checks on configuration 2024-05-29 08:02:06 +02:00
Haelwenn (lanodan) Monnier
c16ef40f13
RichMedia: Respect configuration on status previews 2024-05-29 08:02:04 +02:00
feld
3b639b467e Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer fixes

See merge request pleroma/pleroma!4128
2024-05-28 17:26:58 +00:00
lain
41d3c14ba5 Merge branch 'feature/akkoma-prune-old-posts' into 'develop'
add options to mix prune_objects to delete more things

See merge request pleroma/pleroma!3952
2024-05-28 15:19:38 +00:00
Mark Felder
79c418bcb7 Dialyzer: fix invalid @spec 2024-05-28 11:07:28 -04:00
Lain Soykaf
f663135724 DatabaseTest: Fix test. 2024-05-28 18:54:36 +04:00
Mark Felder
6b6a2adb07 Dialyzer: The function call will not succeed.
:idna.encode/1 expects a charlist even though it will accept a binary string. That functionality is undocumented / not part of its typespec, so we should turn it into a charlist first. Also switch to using match?/2

lib/pleroma/user.ex:2056:call
The function call will not succeed.

:idna.encode(_host :: binary())

will never return since the success typing is:
(string()) :: string()

and the contract is
(string()) :: string()
2024-05-28 10:49:43 -04:00
Mark Felder
6551ca2db7 Dialyzer: overlapping_contract
Wrong @spec name for remove_from_block/2

lib/pleroma/user.ex:2721:overlapping_contract
Overloaded contract for Pleroma.User.add_to_block/2 has
overlapping domains; such contracts are currently unsupported and
are simply ignored.
2024-05-28 10:40:54 -04:00
Mark Felder
8743c6c640 Dialyzer: The pattern can never match the type
We will never pass :plain to query_with/4, so remove that match and change it to query_with/3

lib/pleroma/search/database_search.ex:127:pattern_match
The pattern can never match the type.

Pattern:
_q, :rum, _search_query, :plain

Type:

  %Ecto.Query{
    :aliases => _,
    :assocs => _,
    :combinations => _,
    :distinct => _,
    :from => _,
    :group_bys => _,
    :havings => _,
    :joins => _,
    :limit => _,
    :lock => _,
    :offset => _,
    :order_bys => _,
    :prefix => _,
    :preloads => _,
    :select => _,
    :sources => _,
    :updates => _,
    :wheres => _,
    :windows => _,
    :with_ctes => _
  },
  :rum,
  _,
  :websearch
2024-05-28 10:36:00 -04:00
Lain Soykaf
a041879eaa Linting 2024-05-28 18:26:30 +04:00
Mark Felder
1b3c84e241 Dialyzer: no_local_return
WebPushEncryption.send_web_push/4 was written to raise on erroroneus input, so we must guard against that.

lib/pleroma/web/push/impl.ex:65:no_return Function push_message/4 has no local return.
2024-05-28 10:19:35 -04:00
Mark Felder
17ebb2df84 Dialyzer: fix pattern matches preventing video thumbnailing from working
lib/pleroma/web/media_proxy/media_proxy_controller.ex:154:pattern_match
The pattern can never match the type.

Pattern:
{:ok, _thumbnail_binary}

Type:
{:error, boolean() | {:ffmpeg, :command_not_found}}
2024-05-28 10:19:22 -04:00
Mark Felder
18835bf701 Use the configured http client options for mediaproxy 2024-05-28 09:38:36 -04:00
Mark Felder
f8ce639e3f Dialyzer: guard clause can never succeed
lib/pleroma/web/activity_pub/mrf/dnsrbl_policy.ex:106:guard_fail
The guard clause:

when _ ::
  [
    binary()
    | [string() | char()]
    | {string() | integer(), string()}
    | {{byte(), byte(), byte(), byte()}, integer(), binary()}
    | {integer(), integer(), integer(), string() | byte()}
    | {integer(), integer(), string(), string(), string(), string()}
    | {string(), string(), integer(), integer(), integer(), integer(), integer()}
    | {char(), char(), char(), char(), char(), char(), char(), char()}
  ] === nil

can never succeed.
2024-05-28 09:30:19 -04:00
Mark Felder
42c5f7c74e Dialyzer: fix invalid @spec
The callback already defines the @spec and these do not match it.

lib/pleroma/upload/filter/exiftool/strip_location.ex:12:callback_spec_type_mismatch
The @spec return type does not match the expected return type
for filter/1 callback in Pleroma.Upload.Filter behaviour.

Actual:
@spec filter(...) :: {:ok, _}

Expected:
@spec filter(...) :: {:error, _} | {:ok, :filtered | :noop} | {:ok, :filtered, struct()}
2024-05-28 08:55:18 -04:00
Lain Soykaf
cc42b50c5b Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into pleroma-feature/akkoma-prune-old-posts 2024-05-28 16:51:19 +04:00
Mark Felder
0b864c3696 Dialyzer: fix invalid @spec
lib/pleroma/notification.ex:492:invalid_contract
The @spec for the function does not match the success typing of the function.

Function:
Pleroma.Notification.get_notified_from_activity/2

Success typing:
@spec get_notified_from_activity(_, _) :: [any()]
2024-05-28 08:49:34 -04:00
lain
bef15cde61 Merge branch 'secure-mode' into 'develop'
Reject requests from specified instances if `authorized_fetch_mode` is enabled

See merge request pleroma/pleroma!3711
2024-05-28 11:22:34 +00:00
Lain Soykaf
335691bae1 Add changelog 2024-05-28 14:38:44 +04:00
Lain Soykaf
8066645f71 Linting 2024-05-28 14:20:48 +04:00
Lain Soykaf
f5978da676 HTTPSignaturePlugTest: Rewrite to use mox. 2024-05-28 14:00:25 +04:00
Lain Soykaf
3b4be5daa2 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into pleroma-secure-mode 2024-05-28 12:31:12 +04:00
lain
25903a4996 Merge branch 'auth-fetch-exception' into 'develop'
HTTPSignaturePlug: Add :authorized_fetch_mode_exceptions

See merge request pleroma/pleroma!4007
2024-05-28 04:42:35 +00:00
lain
8ff0c32903 Merge branch 'httpfixes' into 'develop'
Some HTTP and connection pool improvements

See merge request pleroma/pleroma!4124
2024-05-28 04:38:01 +00:00
Lain Soykaf
73d58c22d4 Linting 2024-05-28 08:09:19 +04:00
feld
cdde3afb57 Merge branch 'credo' into 'develop'
Credo

See merge request pleroma/pleroma!4126
2024-05-27 19:21:14 +00:00
Mark Felder
bb86a01b9b Credo 2024-05-27 15:20:47 -04:00
Lain Soykaf
687ac4a850 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into auth-fetch-exception 2024-05-27 23:09:17 +04:00
feld
38db406ce4 Merge branch 'simpler-oban-queues' into 'develop'
Oban queue simplification

See merge request pleroma/pleroma!4123
2024-05-27 19:02:53 +00:00
lain
121791882f Merge branch 'explicitly-allow-unsafe-2' into 'develop'
Explicitly allow unsafe 2

See merge request pleroma/pleroma!4125
2024-05-27 18:43:05 +00:00
lain
3316a7ab70 Merge branch 'qdrant-search-2' into 'develop'
Search: Basic Qdrant/Ollama search

See merge request pleroma/pleroma!4109
2024-05-27 18:41:20 +00:00
Lain Soykaf
81e44ced0c HTTPSecurityPlug: Fix tests 2024-05-27 22:13:20 +04:00
Mark Felder
ba511a30b9 RichMedia use of ConcurrentLimiter was removed in the refactor 2024-05-27 14:12:38 -04:00
Mark Felder
6b8c15a4a1 Remove MediaProxyWarmingPolicy config for ConcurrentLimiter as we are not using it 2024-05-27 14:11:42 -04:00
feld
42150d5581 Merge branch 'logger-metadata' into 'develop'
Logger metadata

See merge request pleroma/pleroma!3990
2024-05-27 17:53:33 +00:00
Mark Felder
29eac86dc0 Logger metadata changelog 2024-05-27 13:53:22 -04:00
Mark Felder
f63e44b8bc Fix Oban related tests 2024-05-27 13:48:24 -04:00
Mark Felder
0847d9ebaf Oban queue simplification 2024-05-27 13:48:17 -04:00
lain
b1fec8594d Merge branch 'tusooa/extract-fix' into 'develop'
OAuth scopes translations: write out which operations are processed

See merge request pleroma/pleroma!3907
2024-05-27 17:41:33 +00:00
Lain Soykaf
c67b41415b Changelog: Add changelog entry. 2024-05-27 21:28:46 +04:00
Lain Soykaf
fc7ce339ed Cheatsheet: Add allow_unsafe_eval 2024-05-27 21:28:20 +04:00
Lain Soykaf
1c699144d2 HttpSecurityPlug: Don't allow unsafe-eval by default 2024-05-27 21:26:40 +04:00
lain
07b7a8d697 Merge branch 'image-description-summary' into 'develop'
Add support for Honk "summary" + "name"

See merge request pleroma/pleroma!3854
2024-05-27 16:51:07 +00:00
feld
10b7efa98c Merge branch 'anti-mention-spam-mrf' into 'develop'
Anti-mention Spam MRF

See merge request pleroma/pleroma!4072
2024-05-27 16:46:31 +00:00
feld
10713fa913 Merge branch 'feat/mrf-dnsrbl' into 'develop'
Anti-spam using an MRF DNSRBL

See merge request pleroma/pleroma!3278
2024-05-27 16:42:38 +00:00
Mark Felder
cab6372d7a Make user age limit configurable
Switch to milliseconds for consistency with other configuration options in codebase
2024-05-27 12:31:29 -04:00
Mark Felder
0d092a3d4f Changelog 2024-05-27 12:26:55 -04:00
Alex Gleason
02d8ce8f0b AntiMentionSpamPolicy: remove followers check 2024-05-27 12:25:09 -04:00
Alex Gleason
64cacc3694 AntiMentionSpamPolicy: fix user age check 2024-05-27 12:25:09 -04:00
Alex Gleason
5e963736ce Add AntiMentionSpamPolicy 2024-05-27 12:25:09 -04:00
Mark Felder
0bddca361d DNSRBL in an MRF 2024-05-27 12:23:36 -04:00
feld
6291bf22bd Merge branch 'prometheus-docs' into 'develop'
Update Prometheus docs

See merge request pleroma/pleroma!4018
2024-05-27 16:20:15 +00:00
Mark Felder
7258ab1aed Changelog 2024-05-27 12:20:00 -04:00
Mark Felder
f4693dc671 Update Prometheus/Grafana docs for PromEx 2024-05-27 12:18:51 -04:00
Lain Soykaf
284cd0abe5 Add changelog 2024-05-27 20:04:12 +04:00
Lain Soykaf
f4c0a01f09 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into image-description-summary 2024-05-27 20:03:14 +04:00
Lain Soykaf
e4f1325f78 InetHelper: Don't use deprecated function. 2024-05-27 19:44:41 +04:00
lain
7798fdc711 Merge branch 'show-reposted-replies' into 'develop'
Display reposted replies with exclude_replies: true

See merge request pleroma/pleroma!3961
2024-05-27 15:33:50 +00:00
Mark Felder
8b61d4e3e1 Changelogs 2024-05-27 11:28:31 -04:00
Lain Soykaf
d3e85da0fd Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into auth-fetch-exception 2024-05-27 19:27:02 +04:00
Mark Felder
37d79b76bb Use the configured http client options for mediaproxy 2024-05-27 11:26:21 -04:00
Mark Felder
d272eb62cd Trust the connection pools to enforce the concurrency limitations 2024-05-27 11:25:19 -04:00
Lain Soykaf
03d0c5abfb Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into tusooa/extract-fix 2024-05-27 19:21:20 +04:00
lain
e93ae96e13 Merge branch 'nsfw-api-mrf' into 'develop'
NSFW API Policy

See merge request pleroma/pleroma!3471
2024-05-27 15:20:43 +00:00
Mark Felder
6708f154a4 Rework Gun connection pool sizes to make better use of the default 250 connections 2024-05-27 11:18:58 -04:00
Mark Felder
a50c657427 Add a dedicated connection pool for Rich Media
Sharing this pool with regular Media is problematic as Rich Media will connect to many different
domains and thrash the pool, but regular Media will have predictable connections to the webservers
hosting media for the fediverse servers you peer with.
2024-05-27 11:17:02 -04:00
lain
d11ba9e85b Merge branch 'ipfs_uploader' into 'develop'
feat: simple, but not stupid, uploader for IPFS

See merge request pleroma/pleroma!3654
2024-05-27 15:06:12 +00:00
Lain Soykaf
ed93af64e1 Add changelog 2024-05-27 17:50:34 +04:00
Lain Soykaf
4325b1aec3 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into nsfw-api-mrf 2024-05-27 17:49:31 +04:00
Lain Soykaf
3055c1598b IPFSTest: Fix configuration mocking 2024-05-27 17:22:18 +04:00
Lain Soykaf
825b4122a5 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into pleroma-ipfs_uploader 2024-05-27 16:23:40 +04:00
lain
6757382abe Merge branch 'reject-replies-to-deleted' into 'develop'
Return a 422 when trying to reply to a deleted status

See merge request pleroma/pleroma!4122
2024-05-27 11:41:46 +00:00
Lain Soykaf
f214c2cdac NotificationTest: Remove impossible case. 2024-05-27 15:23:33 +04:00
Lain Soykaf
4d6316b488 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into reject-replies-to-deleted 2024-05-27 15:19:53 +04:00
Lain Soykaf
ddf103eca0 QdrantSearch: Fetch a post in search if possible. 2024-05-27 14:35:08 +04:00
Lain Soykaf
f4c04e6b2d QdrantSearch: Add health checks. 2024-05-27 14:21:55 +04:00
Lain Soykaf
ec3f3fef77 Fastembed Server: Add health check endpoint 2024-05-27 14:15:04 +04:00
Lain Soykaf
8b76f56050 QdrantSearch: Add healthcheck for qdrant 2024-05-27 14:01:17 +04:00
Lain Soykaf
08e9d995f8 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into qdrant-search-2 2024-05-27 13:50:22 +04:00
lain
5e43060128 Merge branch 'search-healthcheck' into 'develop'
Search backend healthcheck process

See merge request pleroma/pleroma!4120
2024-05-27 09:46:57 +00:00
Lain Soykaf
d35b69d268 Pleroma.Search: Remove wrong (but irrelevant) results 2024-05-27 13:18:02 +04:00
Mark Felder
d9b82255b9 Add an HTTP timeout for the healthcheck 2024-05-26 15:23:12 -04:00
Mark Felder
d4769b076a Return a 422 when trying to reply to a deleted status 2024-05-26 15:14:48 -04:00
feld
c3c804b71f Merge branch 'fix/rich-media-ttl' into 'develop'
Fix rich media parsing some Amazon URLs

See merge request pleroma/pleroma!4121
2024-05-26 18:29:46 +00:00
Mark Felder
03f4b46189 Test that healthchecks behave correctly for the expected HTTP responses 2024-05-26 14:21:24 -04:00
Mark Felder
f2b0d5f1d0 Make it easier to read the state for debugging purposes and expose functions for testing 2024-05-26 14:11:41 -04:00
Mark Felder
807782b7f9 Fix rich media parsing some Amazon URLs 2024-05-26 14:02:20 -04:00
Mark Felder
354b700bed Assert that AWS URLs without query parameters do not crash 2024-05-26 14:01:12 -04:00
Mark Felder
3474b42ce3 Drop TTL to 5 seconds 2024-05-25 16:55:29 -04:00
Mark Felder
61a3b79316 Search backend healthcheck process 2024-05-25 16:07:47 -04:00
lain
895eea5c75 Merge branch 'api-docs' into 'develop'
Update pleroma_api.md

See merge request pleroma/pleroma!4119
2024-05-25 07:17:05 +00:00
marcin mikołajczak
618b77071a Update pleroma_api.md
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-25 09:12:37 +02:00
tusooa
19b2637c51 Merge branch 'bugfix/realpath-over-readlink' into 'develop'
pleroma_ctl: Use realpath(1) instead of readlink(1)

See merge request pleroma/pleroma!4118
2024-05-25 00:54:17 +00:00
lain
134f3bff67 Merge branch 'bump-elixir' into 'develop'
Bump minimum Elixir to 1.13

See merge request pleroma/pleroma!4014
2024-05-24 09:20:06 +00:00
Lain Soykaf
a566ad56e1 QdrantSearch: Fix actor / author restriction 2024-05-23 18:55:16 +04:00
Lain Soykaf
94e4f21589 QdrantSearch: Deal with actor restrictions 2024-05-23 14:38:30 +04:00
Haelwenn (lanodan) Monnier
818712f99f
pleroma_ctl: Use realpath(1) instead of readlink(1)
From realpath(1) in POSIX 202x Draft 4.1:
> If file does not name a symbolic link, readlink shall write a diagnostic
> message to standard error and exit with non-zero status.

Which also doesn't includes `-f`, in preference of `realpath`.
2024-05-23 00:39:53 +02:00
Lain Soykaf
f726e5fbbd Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into qdrant-search-2 2024-05-22 20:07:43 +04:00
lain
05b9805bf9 Merge branch 'mergeback-2.6.3' into 'develop'
Mergeback 2.6.3

Closes #3245

See merge request pleroma/pleroma!4117
2024-05-22 15:48:42 +00:00
Lain Soykaf
3f0e9fd474 Merge branch 'stable' into develop 2024-05-22 19:47:15 +04:00
lain
a8e1fc0f6a Merge branch 'webfinger-validation' into 'develop'
Fix validate_webfinger when running a different domain for Webfinger

See merge request pleroma/pleroma!4116
2024-05-22 14:58:48 +00:00
Lain Soykaf
5f1f574f01 WebFingerControllerTest: Restore host after test. 2024-05-22 18:45:34 +04:00
marcin mikołajczak
d536d58080 changelog
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-22 15:54:17 +02:00
marcin mikołajczak
70cabbf6dc Fix tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-22 15:53:16 +02:00
marcin mikołajczak
d0b18e338b Fix validate_webfinger when running a different domain for Webfinger
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-22 15:52:35 +02:00
marcin mikołajczak
1f2f7e044d Revert "Webfinger: Allow managing account for subdomain"
This reverts commit 84bb854056.
2024-05-22 15:52:10 +02:00
lain
c8e5a1f6b0 Merge branch 'fix-webfinger-spoofing' into 'develop'
Fix webfinger spoofing

See merge request pleroma/pleroma!4114
2024-05-22 12:45:24 +00:00
Lain Soykaf
84bb854056 Webfinger: Allow managing account for subdomain 2024-05-22 15:12:29 +04:00
Lain Soykaf
91c93ce3cd Changelog: Adjust changelog type 2024-05-22 13:14:59 +04:00
Lain Soykaf
4491e8c9a3 Add changelog 2024-05-22 13:01:23 +04:00
Lain Soykaf
206ea92837 Webfinger: Fix test 2024-05-22 12:59:10 +04:00
Alex Gleason
b15f8b0642 Prevent webfinger spoofing 2024-05-22 12:57:45 +04:00
Lain Soykaf
d1b053f3ba Webfinger: Add test showing wrong webfinger behavior 2024-05-22 12:57:30 +04:00
lain
7fca598268 Merge branch 'status-notification-type' into 'develop'
Add "status" notification type

See merge request pleroma/pleroma!3659
2024-05-21 05:01:45 +00:00
marcin mikołajczak
36fa0debfe Fix get_notified_from
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-20 23:25:50 +02:00
Lain Soykaf
c67506ba68 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into auth-fetch-exception 2024-05-20 18:21:46 +04:00
Lain Soykaf
f5c0295247 CI: Specify correct image name. 2024-05-20 13:43:18 +04:00
Lain Soykaf
f8411a351d CI: Specify version fully in base image tag 2024-05-20 13:30:31 +04:00
Lain Soykaf
226874c9d6 CI: Add new builders for base images 2024-05-20 13:12:12 +04:00
Lain Soykaf
ad26b6d593 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into bump-elixir 2024-05-20 12:30:15 +04:00
lain
e8cd6662eb Merge branch 'familiar-followers' into 'develop'
Implement `/api/v1/accounts/familiar_followers`

See merge request pleroma/pleroma!4098
2024-05-19 12:05:55 +00:00
Lain Soykaf
1b4f1db9b2 QdrantSearch: Support pagination. 2024-05-19 14:41:05 +04:00
Lain Soykaf
dbaab6f54e Docs: Mention running the Qdrant server 2024-05-19 13:38:31 +04:00
Lain Soykaf
6ec306d068 Docs: Add more information about index memory consumption. 2024-05-19 13:24:24 +04:00
Lain Soykaf
6a3a0cc0f5 Docs: Write docs for the QdrantSearch 2024-05-19 13:20:37 +04:00
Lain Soykaf
23881842ae B FastembedAPI: Add readme 2024-05-19 13:04:27 +04:00
Lain Soykaf
8329ad5214 B FastembedAPI: Add requirements.txt 2024-05-19 12:59:03 +04:00
Lain Soykaf
dd48810186 B FastembedAPI: Move to more appropriate folder 2024-05-19 12:47:08 +04:00
Lain Soykaf
e142ea400a Docs: Switch docs from Ollama to OpenAI. 2024-05-19 12:42:08 +04:00
Lain Soykaf
c139a9f38c B Config: Set default Qdrant embedder to our fastembed-api server 2024-05-19 12:39:54 +04:00
Lain Soykaf
b9af017a4c B FastembedServer: Switch to OpenAI api, support changing models 2024-05-19 12:33:49 +04:00
Lain Soykaf
72ec261a69 B QdrantSearch: Switch to OpenAI api 2024-05-19 12:17:46 +04:00
Lain Soykaf
cc1321ea2e Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into qdrant-search-2 2024-05-19 11:51:33 +04:00
lain
401aca2548 Merge branch 'mark-read' into 'develop'
PleromaAPI: Simplify marking notifications as read

See merge request pleroma/pleroma!4111
2024-05-19 07:48:32 +00:00
Mark Felder
d07d49227f PleromaAPI: marking notifications as read no longer returns notifications 2024-05-18 18:17:35 +00:00
Lain Soykaf
3345ddd2d4 Linting 2024-05-18 15:02:22 +04:00
Lain Soykaf
7923ede8ba Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into qdrant-search-2 2024-05-18 14:45:26 +04:00
Lain Soykaf
39525bcec7 Add qdrant changelog 2024-05-18 14:07:47 +04:00
Lain Soykaf
e3933a067f QdrantSearch: Implement post deletion 2024-05-18 14:04:32 +04:00
Lain Soykaf
933117785f QdrantSearch: Add basic test 2024-05-18 13:43:47 +04:00
marcin mikołajczak
2e76ceb5b4 Merge remote-tracking branch 'origin/develop' into status-notification-type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-18 11:30:25 +02:00
Lain Soykaf
61e9027131 Add docker compose file for fastembed server 2024-05-18 12:19:42 +04:00
Lain Soykaf
769773a500 Add dockerfile 2024-05-18 12:08:42 +04:00
Lain Soykaf
069ce4448c Add basic fastembed server 2024-05-18 11:55:17 +04:00
feld
99eab1fa2a Merge branch 'revert-e944b152' into 'develop'
Revert "Merge branch 'strip-object-actor' into 'develop'"

See merge request pleroma/pleroma!4112
2024-05-16 23:34:00 +00:00
feld
9988dc2227 Revert "Merge branch 'strip-object-actor' into 'develop'"
This reverts merge request !4105
2024-05-16 23:33:48 +00:00
feld
7de657ac45 Merge branch 'bad-mrf' into 'develop'
Startup detection for configured MRF modules that are missing or incorrectly defined

See merge request pleroma/pleroma!4110
2024-05-16 20:37:37 +00:00
Mark Felder
7f8a9329e5 Startup detection for configured MRF modules that are missing or incorrectly defined 2024-05-16 16:13:29 -04:00
Lain Soykaf
a9be4907c0 SearchBackend: Add drop_index 2024-05-16 10:47:24 +04:00
feld
e944b15298 Merge branch 'strip-object-actor' into 'develop'
Strip actor from objects before federating

Closes #3269

See merge request pleroma/pleroma!4105
2024-05-15 20:51:47 +00:00
Mark Felder
2965ed47bd Changelog for stripping actor from objects 2024-05-15 16:40:31 -04:00
feld
53ef576739 Merge branch 'instance_rules' into 'develop'
Instance rules

See merge request pleroma/pleroma!3669
2024-05-15 20:29:04 +00:00
feld
8da103da57 Merge branch 'fix-muted-web-push' into 'develop'
Fix processing of Web Push and streaming notifications

See merge request pleroma/pleroma!4032
2024-05-15 20:12:41 +00:00
Lain Soykaf
1261c43a7a SearchBackend: Add create_index 2024-05-14 17:19:36 +04:00
Lain Soykaf
c50f0f31f4 Docs/Search: Add basic documentation of the qdrant search 2024-05-14 16:56:58 +04:00
Lain Soykaf
1490ff30af QdrantSearch: Add query prefix. 2024-05-14 15:09:38 +04:00
Lain Soykaf
bb08a766f4 QdrantSearch: Remove debugging stuff 2024-05-14 14:26:41 +04:00
Lain Soykaf
cd7e2138d1 Search: Basic Qdrant/Ollama search 2024-05-14 14:13:37 +04:00
feld
c954437cc0 Merge branch 'mastodon-instance-v2' into 'develop'
Add new values to /api/v2/instance

Closes #3250 and #3251

See merge request pleroma/pleroma!4106
2024-05-11 12:11:00 +00:00
Mark Felder
16c72d0701 Merge branch 'develop' into fix-muted-web-push 2024-05-11 08:06:04 -04:00
faried nawaz
fdc3cbb8cb
add documentation for the prune_objects mix task options 2024-05-09 10:43:41 +05:00
faried nawaz
1bf3ae07b6
add options to mix pleroma.database prune_objects to delete more activities 2024-05-09 10:43:34 +05:00
feld
6cfb0d7ddb Merge branch 'restore/card-img-alt' into 'develop'
Include image description in status media cards

See merge request pleroma/pleroma!4108
2024-05-08 17:55:32 +00:00
Mark Felder
ccceb41bf3 Add test for StatusView rendering of Cards when missing descriptions 2024-05-08 13:54:57 -04:00
Mark Felder
5e7f4f687e Improve StatusView tests for Cards 2024-05-08 13:52:25 -04:00
marcin mikołajczak
818d9f7b63 Include image description in status media cards
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-05-08 13:40:26 -04:00
feld
8eea4f58c7 Merge branch 'rich-media-db' into 'develop'
RichMedia refactor

See merge request pleroma/pleroma!4057
2024-05-08 03:12:09 +00:00
Mark Felder
54c2bab25f Fix module struct matching 2024-05-07 22:27:18 -04:00
Mark Felder
9a83301ff8 Credo 2024-05-07 22:11:19 -04:00
Mark Felder
37c35daba6 Credo 2024-05-07 22:10:49 -04:00
Mark Felder
9b9a32bf74 Fix compile warning
warning: "else" clauses will never match because all patterns in "with" will always match
  lib/pleroma/web/rich_media/parser/ttl/opengraph.ex:10
2024-05-07 21:56:27 -04:00
Mark Felder
19002fd6c1 Mastodon API: Remove deprecated GET /api/v1/statuses/:id/card endpoint
Removed back in 2019

https://github.com/mastodon/mastodon/pull/11213
2024-05-08 01:44:58 +00:00
Mark Felder
37de58823f Remove test validating missing descriptions are returned as an empty string 2024-05-08 00:49:29 +00:00
Mark Felder
5bbcf5b8b7 Improve test description 2024-05-08 00:36:16 +00:00
Mark Felder
c16c023ebf Rich Media Cards are fetched asynchonously and not guaranteed to be available on first post render 2024-05-08 00:26:32 +00:00
Mark Felder
fa66bd95dc Rich Media Cards are cached by URL not per status 2024-05-08 00:23:59 +00:00
Mark Felder
5a5a193877 Fix broken Rich Media parsing when the image URL is a relative path 2024-05-07 19:54:56 -04:00
Mark Felder
d21aa1a77c Respect the TTL returned in OpenGraph tags 2024-05-07 19:54:56 -04:00
Mark Felder
f40084e019 Fix broken tests 2024-05-07 19:54:56 -04:00
Mark Felder
df0734fcbf Increase the :max_body for Rich Media to 5MB
Websites are increasingly getting more bloated with tricks like inlining content (e.g., CNN.com) which puts pages at or above 5MB. This value may still be too low.
2024-05-07 19:54:56 -04:00
Mark Felder
ede414094f RichMedia refactor
Rich Media parsing was previously handled on-demand with a 2 second HTTP request timeout and retained only in Cachex. Every time a Pleroma instance is restarted it will have to request and parse the data for each status with a URL detected. When fetching a batch of statuses they were processed in parallel to attempt to keep the maximum latency at 2 seconds, but often resulted in a timeline appearing to hang during loading due to a URL that could not be successfully reached. URLs which had images links that expire (Amazon AWS) were parsed and inserted with a TTL to ensure the image link would not break.

Rich Media data is now cached in the database and fetched asynchronously. Cachex is used as a read-through cache. When the data becomes available we stream an update to the clients. If the result is returned quickly the experience is almost seamless. Activities were already processed for their Rich Media data during ingestion to warm the cache, so users should not normally encounter the asynchronous loading of the Rich Media data.

Implementation notes:

- The async worker is a Task with a globally unique process name to prevent duplicate processing of the same URL
- The Task will attempt to fetch the data 3 times with increasing sleep time between attempts
- The HTTP request obeys the default HTTP request timeout value instead of 2 seconds
- URLs that cannot be successfully parsed due to an unexpected error receives a negative cache entry for 15 minutes
- URLs that fail with an expected error will receive a negative cache with no TTL
- Activities that have no detected URLs insert a nil value in the Cachex :scrubber_cache so we do not repeat parsing the object content with Floki every time the activity is rendered
- Expiring image URLs are handled with an Oban job
- There is no automatic cleanup of the Rich Media data in the database, but it is safe to delete at any time
- The post draft/preview feature makes the URL processing synchronous so the rendered post preview will have an accurate rendering

Overall performance of timelines and creating new posts which contain URLs is greatly improved.
2024-05-07 19:54:56 -04:00
feld
b42963a52c Merge branch 'revert-50af909c' into 'develop'
Revert "Merge branch 'pleroma-card-image-description' into 'develop'"

See merge request pleroma/pleroma!4107
2024-05-07 23:21:37 +00:00
feld
750fb25f48 Revert "Merge branch 'pleroma-card-image-description' into 'develop'"
This reverts merge request !4101
2024-05-07 23:20:38 +00:00
Mark Felder
acf73f7e13 Update changelog entry 2024-05-07 17:48:40 -04:00
Mark Felder
06c26bf9c9 Add the absent max_featured_tags to the api spec for /api/v1/instance 2024-05-07 17:46:05 -04:00
Mark Felder
b979389958 Add configuration[accounts][max_pinned_statuses] to /api/v2/instance
Also add the absent max_featured_tags to the api spec for /api/v2/instance
2024-05-07 17:45:02 -04:00
Mark Felder
3cad57bf48 Add configuration[statuses][characters_reserved_per_url] to /api/v2/instance
Fixes #3250
2024-05-07 17:25:30 -04:00
Mark Felder
dd03184811 Strip actor from objects before federating 2024-05-07 11:54:45 -04:00
lain
ffa6805c09 Merge branch 'description-type' into 'develop'
Fix type in config description

See merge request pleroma/pleroma!4104
2024-05-07 11:39:48 +00:00
marcin mikołajczak
637f5bc431 Fix type in description
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-27 20:29:23 +02:00
Haelwenn
88412daf11 Apply @lanodan's suggestion
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-25 12:34:12 +02:00
lain
50af909c01 Merge branch 'pleroma-card-image-description' into 'develop'
Include image description in status media cards

See merge request pleroma/pleroma!4101
2024-04-19 07:39:05 +00:00
marcin mikołajczak
6f6bede900 Include image description in status media cards
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-19 10:20:31 +04:00
lain
87b8ac3ce6 Merge branch 'receiverworker-error-handling' into 'develop'
ReceiverWorker: Make sure non-{:ok, _} is returned as {:error, …}

See merge request pleroma/pleroma!4100
2024-04-19 06:04:44 +00:00
Haelwenn
71a0373232 Merge branch 'ffmpeg-limiter' into 'develop'
Prevent Media Helper from respawning ffmpeg for bad media

See merge request pleroma/pleroma!4086
2024-04-17 05:47:54 +00:00
Haelwenn (lanodan) Monnier
a299ddb10e
ReceiverWorker: Make sure non-{:ok, _} is returned as {:error, …}
Otherwise an error like `{:signature, {:error, {:error, :not_found}}}` ends up considered a success.
2024-04-17 07:43:47 +02:00
tusooa
d80e0d6873 Merge branch 'user-actor-webfinger' into 'develop'
FEP-2c59, add "webfinger" to user actor

See merge request pleroma/pleroma!4099
2024-04-12 03:09:37 +00:00
marcin mikołajczak
4f5c4d79c4 FEP-2c59, add "webfinger" to user actor
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-11 17:50:11 +02:00
marcin mikołajczak
ccc3ac241f Add hint to rules
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-06 11:45:19 +02:00
marcin mikołajczak
9e6cf45906 /api/v1/accounts/familiar_followers
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-04-06 11:43:56 +02:00
marcin mikołajczak
01a5f839c5 Merge remote-tracking branch 'origin/develop' into instance_rules 2024-04-06 10:42:23 +02:00
lain
987f44d811 Merge branch 'bookmark-folders' into 'develop'
Fix BookmarkFolderView, add test

See merge request pleroma/pleroma!4096
2024-03-20 13:26:47 +00:00
marcin mikołajczak
37ec645ff2 Fix BookmarkFolderView, add test
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-20 13:24:43 +01:00
Mark Felder
462d5aa5cb logger: remove request_id metadata which is not useful 2024-03-19 20:53:40 -04:00
Mark Felder
99cee755d8 Show Logger metadata in dev 2024-03-19 12:15:10 -04:00
Mark Felder
40823462e7 Logger metadata for request path and authenticated user 2024-03-19 12:15:10 -04:00
Mark Felder
7dfd148ff8 Logger metadata for inbound federation requests 2024-03-19 12:15:10 -04:00
Mark Felder
741f22bfe0 MediaHelper: cache failed URLs for 15 minutes to prevent excessive retries 2024-03-19 12:14:03 -04:00
Mark Felder
c25fda34e7 Skip generating notifications for internal users 2024-03-19 12:11:30 -04:00
Mark Felder
291d531e4c Unify notification push and streaming events for both local and federated activities
This also removes generation of notifications for blocked/filtered/muted users and threads.
2024-03-19 12:11:30 -04:00
lain
f775a1931b Merge branch 'transient-validators-defaults' into 'develop'
Set defaults values on transient objects (attachment, poll options) validators

See merge request pleroma/pleroma!4090
2024-03-19 12:44:13 +00:00
Lain Soykaf
4e8a1b40cb Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into transient-validators-defaults 2024-03-19 16:26:02 +04:00
lain
8a14fdbe47 Update transient-validators-defaults.change 2024-03-19 12:03:43 +00:00
lain
4e37cd85ef Merge branch 'fix-bookmark-test' into 'develop'
CI: Move changelog check to later in the pipeline

See merge request pleroma/pleroma!4095
2024-03-19 12:02:10 +00:00
Lain Soykaf
040a980277 Add changelog 2024-03-19 15:03:16 +04:00
Lain Soykaf
afae3a94a4 CI: Move changelog check to later in the pipeline
No reason to not run tests.
2024-03-19 13:54:35 +04:00
Lain Soykaf
9617189e96 Tests: Actually run the bookmark folder tests. 2024-03-19 13:51:04 +04:00
lain
8e37f19883 Merge branch 'test-improvements' into 'develop'
Tests: Explicitly set db pool size and max cases to the same value.

See merge request pleroma/pleroma!4094
2024-03-19 07:44:05 +00:00
Lain Soykaf
665947ab2a Tests: Reduced the max case number to make tests more stable. 2024-03-19 11:03:05 +04:00
Lain Soykaf
3cc8414c2e Add changelog 2024-03-19 10:38:29 +04:00
Lain Soykaf
923803a533 Tests: Explicitly set db pool size and max cases to the same value. 2024-03-19 10:34:37 +04:00
lain
ca5766c0a7 Merge branch 'postgres-bump' into 'develop'
Update minimum Postgres version to 11.0; disable JIT

See merge request pleroma/pleroma!4093
2024-03-19 04:46:40 +00:00
Mark Felder
357553a64a Remove usage of :persistent_term for Postgres version storage, fix test
This test should not have been passing. The search result's activity id should not be the same id as the local post.

capture_log was not being used. Removed.
2024-03-18 16:27:52 -04:00
Mark Felder
b822a912ad Remove test for postgres < 11 2024-03-18 16:15:40 -04:00
Mark Felder
1413d2e517 Remove vestiges of old Postgres support 2024-03-18 15:42:15 -04:00
Mark Felder
7f97fbc1ae Update minimum Postgres version to 11.0; disable JIT
This release is where JIT was introduced and it should be disabled. Pleroma's queries do not benefit from JIT, but it can increase latency of queries.
2024-03-18 15:36:26 -04:00
lain
0e4e20315b Merge branch 'bookmark-folders' into 'develop'
Bookmark folders

See merge request pleroma/pleroma!4080
2024-03-18 14:26:19 +00:00
marcin mikołajczak
60c4cb21ea InstanceView: Update features
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-18 14:02:29 +01:00
marcin mikołajczak
918c406a91 Merge remote-tracking branch 'origin/develop' into instance_rules
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-18 13:50:25 +01:00
lain
2b71f4897f Merge branch 'develop' into 'bookmark-folders'
# Conflicts:
#   docs/development/API/differences_in_mastoapi_responses.md
2024-03-18 10:35:02 +00:00
lain
cf0aa1238c Merge branch 'public-polls' into 'develop'
Expose nonAnonymous field from Smithereen polls

See merge request pleroma/pleroma!3962
2024-03-18 06:26:22 +00:00
lain
4f7f44ced1 Merge branch 'develop' into 'develop'
Notifications: filter on users rather than activities

See merge request pleroma/pleroma!4089
2024-03-17 20:17:04 +00:00
Matthieu Rakotojaona
a48f5f860e Notifications: filter on users rather than activities 2024-03-17 20:58:59 +01:00
lain
d5b64846ed Merge branch 'remove-rum-tests' into 'develop'
CI: Remove RUM tests.

See merge request pleroma/pleroma!4092
2024-03-17 16:33:26 +00:00
lain
56e456fb5b Merge branch 'fix-3241' into 'develop'
Consider a case when users.inbox is nil (Fix 3241)

Closes #3241

See merge request pleroma/pleroma!4083
2024-03-17 13:38:59 +00:00
Lain Soykaf
caf855cf9c ActivityPub.Publisher: Don't try federating if a user doesn't have an inbox. 2024-03-17 16:57:45 +04:00
Lain Soykaf
0450da88b6 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into pleroma-fix-3241 2024-03-17 16:42:17 +04:00
lain
95bcd5d28f Merge branch 'force-mention' into 'develop'
Add ForceMention mrf

See merge request pleroma/pleroma!4082
2024-03-17 12:32:14 +00:00
Lain Soykaf
f0cca36e07 CI: Remove RUM tests. 2024-03-17 15:39:24 +04:00
feld
0b5bba23ce Merge branch 'backups' into 'develop'
Include following/followers in backups

See merge request pleroma/pleroma!4085
2024-03-15 19:32:35 +00:00
Haelwenn (lanodan) Monnier
4ad1d02d7e
changelog.d/transient-validators-defaults.change: insert 2024-03-15 16:25:02 +01:00
Haelwenn (lanodan) Monnier
48c22a67de
QuestionOptionsValidator: set default AS types 2024-03-15 16:22:18 +01:00
Haelwenn (lanodan) Monnier
8b651fab1d
AttachmentValidator: Set "Link" as default type 2024-03-15 16:22:18 +01:00
marcin mikołajczak
bb0b17f4d9 Include following/followers in backups
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-10 23:53:12 +01:00
tusooa
df7a8d4efe Merge branch 'instance-contact-account' into 'develop'
Add contact account to InstanceView

See merge request pleroma/pleroma!3960
2024-03-10 13:14:19 +00:00
feld
72daf522c9 Merge branch 'fix-framegrabs' into 'develop'
Fix ffmpeg framegrabs with Exile

See merge request pleroma/pleroma!4087
2024-03-08 14:48:26 +00:00
marcin mikołajczak
c0c4a9ed0d Merge remote-tracking branch 'origin/develop' into instance-contact-account
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-08 12:12:55 +01:00
tusooa
139057f346 Merge branch 'link-verification' into 'develop'
Verify profile link ownership with rel="me"

Closes #2733

See merge request pleroma/pleroma!3959
2024-03-08 00:52:09 +00:00
Mark Felder
54ff7234b9 Fix ffmpeg framegrabs with Exile 2024-03-07 17:38:21 -05:00
marcin mikołajczak
961a5dd4cd Add test
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-07 16:42:22 +01:00
marcin mikołajczak
b7c625db0f Merge remote-tracking branch 'origin/develop' into link-verification 2024-03-07 13:13:49 +01:00
tusooa
47ce33a90d Apply tusooa's suggestion 2024-03-07 11:55:31 +00:00
tusooa
1422082bf2 Apply ledyba's suggestion(s) to 1 file(s) 2024-03-07 04:43:56 +00:00
tusooa
8298b326a7 Merge branch 'instance-v2' into 'develop'
Add some missing fields to instanceV2

See merge request pleroma/pleroma!4081
2024-03-07 01:31:27 +00:00
Kaede Fujisaki
0242c1f691 fmt 2024-03-02 18:34:12 +09:00
Kaede Fujisaki
1311f8314e add changelog.d 2024-03-02 18:24:39 +09:00
Kaede Fujisaki
fb1873b6ec add changelog.d 2024-03-02 18:23:56 +09:00
Kaede Fujisaki
2e548c31d4 Add changelog 2024-03-02 18:13:36 +09:00
Kaede Fujisaki
6ad4acea50 Consider a case when inbox is nil 2024-03-02 18:09:08 +09:00
marcin mikołajczak
9cfa4e67b1 Add ForceMention mrf
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-01 18:16:09 +01:00
marcin mikołajczak
d415686bb9 Allow to group bookmarks in folders
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-03-01 11:04:01 +01:00
marcin mikołajczak
acb9e46074 Add some missing fields to instanceV2
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-02-27 13:25:26 +01:00
Haelwenn
03e54aaba9 Merge branch 'remote-fetcher-error' into 'develop'
RemoteFetcherWorker: Make sure {:error, _} is returned on failure

See merge request pleroma/pleroma!4077
2024-02-24 11:37:34 +00:00
feld
bd4d2e1d83 Merge branch 'exile-freebsd' into 'develop'
Exile: change to upstream pre-release commit that fixes build on FreeBSD

See merge request pleroma/pleroma!4079
2024-02-23 20:52:04 +00:00
Mark Felder
267e20dbcd Exile: change to upstream pre-release commit that fixes build on FreeBSD 2024-02-23 15:36:37 -05:00
feld
6144cb43a8 Merge branch 'gun-pool-retry' into 'develop'
Gun connection pooling: rename variable for clarity

See merge request pleroma/pleroma!4078
2024-02-23 16:44:53 +00:00
Mark Felder
f4e48bc53e Rename variable to make the worker retry logic easier to read
The boolean value matches the intent of the "last_attempt" variable name now
2024-02-23 11:12:10 -05:00
Haelwenn
00e828b1a0 Merge branch 'gun-pool-retry' into 'develop'
Gun connection pool retry fix

See merge request pleroma/pleroma!4076
2024-02-23 06:47:56 +00:00
Haelwenn (lanodan) Monnier
6af6a9704d
RemoteFetcherWorker: Make sure {:error, _} is returned on failure
Otherwise jobs are considered a success.
2024-02-23 01:59:30 +01:00
marcin mikołajczak
c592a0e58d Merge remote-tracking branch 'origin/develop' into HEAD
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-02-22 21:05:20 +01:00
Mark Felder
72fc41d891 Prevent publisher jobs from erroring if the connection pool is full
A full pool is a soft-error. Snooze the job for 30 seconds and try again.
2024-02-22 14:14:40 -05:00
Mark Felder
ac55764599 Gun Connection Pool was not attempting to free a connection and retry once if the pool was full. 2024-02-22 14:07:46 -05:00
Haelwenn
f0468697cd Merge branch 'mergeback/2.6.2' into 'develop'
Mergeback: Security Release 2.6.2

Closes #3245

See merge request pleroma/pleroma!4075
2024-02-20 10:52:46 +00:00
Haelwenn (lanodan) Monnier
e149ee6e22
Mergeback of security release 2.6.2 2024-02-20 09:34:11 +01:00
Haelwenn (lanodan) Monnier
7d624c4750
StealEmojiPolicy: Sanitize shortcodes
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3245
2024-02-20 09:09:54 +01:00
feld
0b9bc4a0d0 Merge branch 'memleak' into 'develop'
Force more frequent full_sweep GC runs on the Websocket processes

See merge request pleroma/pleroma!4060
2024-02-17 16:21:55 +00:00
Mark Felder
7e99d0619d Force more frequent full_sweep GC runs on the Websocket processes
Websocket processes seem to be the primary culprit for Binary memory allocation bloat.
2024-02-17 09:53:52 -05:00
Haelwenn
a145d909b5 Merge branch 'weblate' into 'develop'
Translations update from Pleroma Weblate

See merge request pleroma/pleroma!4070
2024-02-16 18:28:55 +00:00
SyoBoN
2c9fed9b73 Translated using Weblate (Japanese)
Currently translated at 63.1% (60 of 95 strings)

Translation: Pleroma/Pleroma Backend (domain errors)
Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-backend-domain-errors/ja/
2024-02-16 17:54:01 +00:00
feld
0fbec6b532 Merge branch 'deps-changelog-revert' into 'develop'
Revert "Support a new changelog entry type: deps"

See merge request pleroma/pleroma!4071
2024-02-16 17:53:52 +00:00
Mark Felder
1951d56ed9 Revert "Add support for a "deps" changelog type and document deps changes since 2.6.1 release"
This reverts commit 2a4fa4c408.
2024-02-16 12:53:18 -05:00
Mark Felder
c9cd449bba Revert "Support a new changelog entry type: deps"
This reverts commit 4648997a10.
2024-02-16 12:52:56 -05:00
feld
03834454d9 Merge branch 'tesla' into 'develop'
Update Tesla, document some deps changes

See merge request pleroma/pleroma!4069
2024-02-15 15:27:34 +00:00
Mark Felder
2a4fa4c408 Add support for a "deps" changelog type and document deps changes since 2.6.1 release 2024-02-15 10:27:13 -05:00
Mark Felder
772f8d08cf Tesla changelog 2024-02-15 10:24:32 -05:00
Mark Felder
4648997a10 Support a new changelog entry type: deps 2024-02-15 10:24:31 -05:00
feld
b91317b9bf Merge branch 'bandit' into 'develop'
Support Bandit as a Phoenix HTTP adapter

See merge request pleroma/pleroma!4068
2024-02-15 15:23:41 +00:00
Mark Felder
202721e80c Remove Cowboy-specific HTTP options
These were only used in dev and served no specific purpose. The equivalent settings for Bandit are under a key called :http1_options and the default values are set to 10_000.
2024-02-15 09:55:03 -05:00
Mark Felder
0c5bec0493 Support Bandit as an alternate HTTP backend to Cowboy. This is currently considered experimental, but may improve performance and resource usage. 2024-02-15 09:54:52 -05:00
feld
4dd8a1a1ca Merge branch 'websocket-refactor' into 'develop'
Websocket refactor to use Phoenix.Socket.Transport

See merge request pleroma/pleroma!4064
2024-02-15 14:36:54 +00:00
lain
d3208d2250 Merge branch 'oauth-nickname' into 'develop'
Use User.full_nickname/1 in oauth html template

See merge request pleroma/pleroma!4054
2024-02-15 09:35:39 +00:00
lain
f2f455f283 Merge branch 'frontend-caching' into 'develop'
FrontendStatic should have reasonable caching

See merge request pleroma/pleroma!3685
2024-02-15 09:23:47 +00:00
Haelwenn
f28dcc9cb7 Merge branch 'config-stat-symlink' into 'develop'
Config: Check the permissions of the linked file instead of the symlink

See merge request pleroma/pleroma!4061
2024-02-15 01:48:03 +00:00
Haelwenn
d19642d7eb Merge branch 'bugfix-ccworks' into 'develop'
Bugfix for ccworks AP bridge

Closes #3234

See merge request pleroma/pleroma!4043
2024-02-15 01:30:22 +00:00
feld
802c618885 Merge branch 'atom-leaks' into 'develop'
Fix minor atom leaks

See merge request pleroma/pleroma!4065
2024-02-14 23:28:00 +00:00
Mark Felder
9138754b0a Changelog 2024-02-14 18:04:39 -05:00
Mark Felder
91c83a82a0 Fix atom leak in background worker
The only permitted values are "blocks_import", "follow_import", "mutes_import" of which we already have the equivalent atoms defined.
2024-02-14 18:03:54 -05:00
Mark Felder
86e6d395d9 Fix atom leak in password digest functionality
The value here gets passesd to :crypto.pbkdf2_hmac and it expects one of these atoms: :sha | :sha224 | :sha256 | :sha384 | :sha512 so it will always exist
2024-02-14 17:54:56 -05:00
Mark Felder
6be129ead2 Websocket refactor changelog 2024-02-14 15:27:12 -05:00
Mark Felder
d0f4b2b02f Remove invalid test
It is not allowed to use the Sec-WebSocket-Protocol header for arbitrary values. This was possible due to the raw websocket handling we were doing with Cowboy, but Phoenix.Socket.Transport does not allow this as the value of this header is compared against a static list of subprotocols.

https://hexdocs.pm/phoenix/Phoenix.Endpoint.html#socket/3-websocket-configuration

Additionally I cannot find anywhere that we depended on this behavior. Setting the Sec-WebSocket-Protocol header does not appear to be a part of PleromaFE.
2024-02-14 15:27:12 -05:00
Mark Felder
64ad451a7b Websocket refactor to use Phoenix.Socket.Transport
This will make us compatible with Cowboy and Bandit
2024-02-14 15:27:07 -05:00
feld
af9bb77cad Merge branch 'gun-logs' into 'develop'
Gun connection pool logs

See merge request pleroma/pleroma!4063
2024-02-14 18:57:11 +00:00
feld
1b2f9d4a6d Merge branch 'proxy-headers' into 'develop'
MediaProxy RFC compliance

See merge request pleroma/pleroma!4062
2024-02-14 18:56:54 +00:00
Mark Felder
9a4c8e2316 Change some Gun connection pool logs to debug level 2024-02-14 13:28:32 -05:00
Mark Felder
60ba6fd244 MediaProxy RFC compliance 2024-02-14 13:25:52 -05:00
Haelwenn (lanodan) Monnier
3b82864bcc
Config: Check the permissions of the linked file instead of the symlink↵ 2024-02-14 18:19:50 +01:00
feld
79d69ce72a Merge branch 'gitignore' into 'develop'
Update .gitignore

See merge request pleroma/pleroma!4059
2024-02-12 22:23:31 +00:00
Mark Felder
67c3acde34 Update .gitignore 2024-02-12 17:22:57 -05:00
feld
769e02d0de Merge branch 'notifications-query' into 'develop'
Fix notifications query to use the index

See merge request pleroma/pleroma!4058
2024-02-12 19:37:17 +00:00
Mark Felder
cb4d3db8c6 Changelog for notifications fix pulled in from Rebased 2024-02-12 14:14:38 -05:00
Alex Gleason
8daf19ec0f Fix notifications index 2024-02-12 14:13:11 -05:00
feld
991807080b Merge branch 'gun-fix' into 'develop'
Fix Gun connection supervisor logic error

See merge request pleroma/pleroma!4056
2024-02-09 16:48:05 +00:00
Mark Felder
0eca3e38eb Fix Gun connection supervisor logic error
This was recently changed to solve a Dialyzer error, but the replacement logic was faulty as "retry" would only be compared to :error and not have its truthiness evaluated.

The original logic was also faulty as it returned {:error, :pool_full} even retry was true. It never retried when the pool was full.
2024-02-09 10:48:40 -05:00
marcin mikołajczak
0fcdcc2300 Use User.full_nickname/1 in oauth html template
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-02-09 16:46:45 +01:00
feld
72480e7b2f Merge branch 'rich-media-tests' into 'develop'
Pleroma.Web.RichMedia.Parser: Remove test-specific codepaths

See merge request pleroma/pleroma!4053
2024-02-07 05:47:38 +00:00
Mark Felder
9f2319e50d RichMedia.Helpers: move the validate_page_url/1 function to the Parser module
This will ensure that the page validation happens in Parser.parse/1 so it can be called from anywhere and still filter invalid URLs.
2024-02-06 18:34:02 -05:00
Mark Felder
6b7b443ff9 Pleroma.Web.RichMedia.Parser: Remove test-specific codepaths
Also consolidate Tesla mocks into the HttpRequestMock module.

Tests were not exercising the real codepaths. The Rich Media Preview only works with https, but most of these tests were only mocking http.
2024-02-06 18:33:54 -05:00
feld
e957362779 Merge branch 'rich-media-cache' into 'develop'
Fix Rich Media Previews for updated activities

See merge request pleroma/pleroma!4052
2024-02-05 05:58:07 +00:00
Mark Felder
0cc038b67c Ensure URLs with IP addresses for the host do not generate previews 2024-02-05 00:09:37 -05:00
Mark Felder
579561e97b URI.authority is deprecated 2024-02-04 23:49:07 -05:00
Mark Felder
04fc4eddaa Fix Rich Media Previews for updated activities
The Rich Media Previews were not regenerated when a post was updated due to a cache invalidation issue. They are now cached by the activity id so they can be evicted with the other activity cache objects in the :scrubber_cache.
2024-02-04 23:47:04 -05:00
feld
0b9990a7e5 Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer and gradient fixes

See merge request pleroma/pleroma!4051
2024-02-04 17:56:14 +00:00
Mark Felder
0ffeb84f0c Changelog 2024-02-02 12:14:21 -05:00
Mark Felder
a2c686e16c Pleroma.Filter: fix gradient error
lib/pleroma/filter.ex: The clause on line 220 cannot be reached
2024-02-02 12:14:21 -05:00
Mark Felder
d42b0eb29b Pleroma.Config.DeprecationWarnings: fix gradient errors
lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 292 is expected to have type :ok | nil but it has type :error

lib/pleroma/config/deprecation_warnings.ex: The function call move_namespace_and_warn(
  [
    {Pleroma.ActivityExpiration, Pleroma.Workers.PurgeExpiredActivity,
     "
* `config :pleroma, Pleroma.ActivityExpiration` is now `config :pleroma, Pleroma.Workers.PurgeExpiredActivity`"}
  ],
  warning_preface
) on line 350 is expected to have type :ok | nil but it has type :ok | nil | :error

lib/pleroma/config/deprecation_warnings.ex: The function call move_namespace_and_warn(
  [
    {Pleroma.Plugs.RemoteIp, Pleroma.Web.Plugs.RemoteIp, "
* `config :pleroma, Pleroma.Plugs.RemoteIp` is now `config :pleroma, Pleroma.Web.Plugs.RemoteIp`"}
  ],
  warning_preface
) on line 366 is expected to have type :ok | nil but it has type :ok | nil | :error

lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 390 is expected to have type :ok | nil but it has type :error

lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 413 is expected to have type :ok | nil but it has type :error
2024-02-02 12:14:21 -05:00
Mark Felder
bff04da0f3 Pleroma.Emoji.Pack: fix gradient error
lib/pleroma/emoji/pack.ex: The tuple {:cwd, tmp_dir} on line 103 is expected to have type :cooked
| :keep_old_files
| :memory
| :verbose
| {:cwd, list(char())}
| {:file_filter, (record(:zip_file) -> boolean())}
| {:file_list, list(:file.name())} but it has type {:cwd, binary()}
2024-02-02 12:14:21 -05:00
Mark Felder
ac7f2cf105 Pleroma Emoji mix task: fix gradient error
lib/mix/tasks/pleroma/emoji.ex: The tuple {:cwd, pack_path} on line 114 is expected to have type :cooked
| :keep_old_files
| :memory
| :verbose
| {:cwd, list(char())}
| {:file_filter, (record(:zip_file) -> boolean())}
| {:file_list, list(:file.name())} but it has type {:cwd, binary()}
2024-02-02 12:14:21 -05:00
Mark Felder
15621b7284 Pleroma.HTTP.RequestBuilder: fix gradient error
lib/pleroma/http/request_builder.ex: The variable key on line 69 is expected to have type String.t() but it has type atom()
2024-02-02 12:14:21 -05:00
Mark Felder
cccfdde14c Pleroma.MFA: fix gradient error
lib/pleroma/mfa.ex: The map %{error: msg} on line 80 is expected to have type {:ok, list(binary())} | {:error, String.t()} but it has type %{required(:error) => any()}
2024-02-02 12:14:15 -05:00
Mark Felder
7745ee27bc Pleroma.MFA.Totp.provisioning_uri/3: add @spec 2024-02-02 12:13:31 -05:00
marcin mikołajczak
1ed8ae2d8e Add changelog
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-31 22:55:58 +01:00
marcin mikołajczak
226e53fdd7 Merge remote-tracking branch 'origin/develop' into status-notification-type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-31 22:19:33 +01:00
Mark Felder
f933d24b02 Pleroma.Config.DeprecationWarnings: fix type errors detected by gradient
lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 278 is expected to have type :ok | nil but it has type :error

lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 292 is expected to have type :ok | nil but it has type :error

lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 390 is expected to have type :ok | nil but it has type :error

lib/pleroma/config/deprecation_warnings.ex: The atom :error on line 413 is expected to have type :ok | nil but it has type :error
2024-01-31 14:55:14 -05:00
Mark Felder
518a38577b Fix dialyzer errors due to deprecated usage of put_layout/2 2024-01-31 14:55:11 -05:00
Mark Felder
97c4d3bcc9 Pleroma.Web.Plugs.RateLimiter.Supervisor: dialyzer error
lib/pleroma/web/plugs/rate_limiter/supervisor.ex:12:no_return
Function init/1 has no local return.
2024-01-31 13:12:56 -05:00
Mark Felder
92992c022d Pleroma.Web.OAuth.OAuthController: dialyzer error
validate_scopes/2 can never receive a map as it is only called in one place with a guard requiring a list

lib/pleroma/web/o_auth/o_auth_controller.ex:615:guard_fail
The guard test:

is_map(_params :: maybe_improper_list())

can never succeed.
2024-01-31 11:29:06 -05:00
Mark Felder
5e8bedcca0 Pleroma.Web.PleromaAPI.MascotController: fix dialyzer error due to bad error match
lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:37:pattern_match
The pattern can never match the type.

Pattern:
{:content_type, _}

Type:
{:error, _}

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:40:pattern_match
The pattern can never match the type.

Pattern:
{:upload, {:error, _}}

Type:
{:error, _}
2024-01-31 11:15:48 -05:00
Mark Felder
ed2f8e45e9 Pleroma.Web.MastodonAPI.SearchController: fix dialyzer errors
Add a separate Pagination.paginate_list/2 function instead of overloading paginate/4 and complicating its matching and @spec
2024-01-31 11:12:41 -05:00
Mark Felder
c6f783c551 Pleroma.Web.ControllerHelper: fix @spec to resolve dialyzer errors
lib/pleroma/web/admin_api/controllers/user_controller.ex:333:no_return
Function index/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:357:unused_fun
Function maybe_parse_filters/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:366:no_return
Function page_params/1 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:368:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.fetch_integer_param(_params :: any(), :page, 1)

breaks the contract
(map(), String.t(), integer() | nil) :: integer() | nil
2024-01-31 11:01:37 -05:00
feld
3b9d991514 Merge branch 'dialyzer-fixes' into 'develop'
More dialyzer fixes

See merge request pleroma/pleroma!4050
2024-01-31 15:37:44 +00:00
Mark Felder
e17441b0ed Changelog 2024-01-31 10:13:02 -05:00
Mark Felder
225afe05b3 Pleroma.Web.TwitterAPI.UtilController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
b8db67dafa Pleroma.Web.MastodonAPI.StatusController: fix dialzyer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
fb7535ff9a MascotController dialyzer error
lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:31:call
The function call will not succeed.

Pleroma.Web.ActivityPub.ActivityPub.upload(_file :: atom() | %{:content_type => _, _ => _}, [{:actor, <<_::56, _::size(8)>>}, ...]) ::
  :ok
def a() do
  :ok
end

will never return since the 2nd arguments differ
from the success typing arguments:

(any(), [
  {:activity_type | :description | :filters | :size_limit | :type | :uploader,
   atom() | binary() | [atom()] | non_neg_integer()}
])
2024-01-31 10:13:02 -05:00
Mark Felder
9760149886 Pleroma.Web.PleromaAPI.UserImportController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
c39e4dd214 Pleroma.Web.PleromaAPI.NotificationController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
e157fd60ee Pleroma.Web.PleromaAPI.MascotController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
9d16393d8b Pleroma.Web.PleromaAPI.EmojiPackController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
f1aeb80518 Pleroma.Web.PleromaAPI.EmojiFileController: fix dialyzer errors with replace_params: false 2024-01-31 10:13:02 -05:00
Mark Felder
4d20fbc6d9 Pleroma.Web.PleromaAPI.ChatController: fix dialyzer errors with replace_params: false 2024-01-31 10:12:59 -05:00
Mark Felder
fdddba100e Pleroma.Web.MastodonAPI.SearchController: fix dialyzer errors with replace_params: false 2024-01-30 18:40:46 -05:00
Mark Felder
324fd08455 Pleroma.Web.MastodonAPI.ScheduledActivityController: fix dialyzer errors with replace_params: false 2024-01-30 18:33:23 -05:00
Mark Felder
d3c6acd2f2 Pleroma.Web.MastodonAPI.PollController: fix dialyzer errors with replace_params: false 2024-01-30 18:31:13 -05:00
Mark Felder
0a6b2c9587 Pleroma.Web.MastodonAPI.NotificationController: fix dialyzer errors with replace_params: false 2024-01-30 18:27:31 -05:00
Mark Felder
90c9f38f40 Pleroma.Web.MastodonAPI.MediaController: fix dialyzer errors with replace_params: false 2024-01-30 18:09:11 -05:00
Mark Felder
9741f045e4 Pleroma.Web.MastodonAPI.ListController: fix dialyzer errors with replace_params: false 2024-01-30 18:05:28 -05:00
Mark Felder
14de8376ad Pleroma.Web.MastodonAPI.FollowRequestController: fix dialyzer errors with replace_params: false 2024-01-30 17:56:43 -05:00
Mark Felder
f400224a00 Pleroma.Web.AdminAPI.UserController: fix dialyzer errors with replace_params: false 2024-01-30 17:51:40 -05:00
Mark Felder
dd916e0b4c Pleroma.Web.AdminAPI.ReportController: fix dialyzer errors with replace_params: false 2024-01-30 17:24:26 -05:00
Mark Felder
b84a33a101 Pleroma.Web.AdminAPI.RelayController: fix dialyzer errors with replace_params: false 2024-01-30 17:13:14 -05:00
Mark Felder
fb6f53fc12 Pleroma.Web.AdminAPI.MediaProxyCacheController: fix dialyzer errors with replace_params: false 2024-01-30 17:11:43 -05:00
Mark Felder
ea26dcd800 Pleroma.Web.AdminAPI.InviteController: fix dialyzer errors with replace_params: false 2024-01-30 17:06:37 -05:00
Mark Felder
85c9397ec7 Pleroma.Web.AdminAPI.InstanceDocumentController: fix dialyzer errors with replace_params: false 2024-01-30 17:04:12 -05:00
Mark Felder
ef1f301756 Pleroma.Web.AdminAPI.ConfigController: fix dialyzer errors with replace_params: false 2024-01-30 16:59:28 -05:00
Mark Felder
dec82a6a36 Phoenix.Endpoint.Cowboy2Handler does not exist
This should have always failed as it would not be an existing atom. Unclear how it worked since the upgrade to Phoenix 1.6.
2024-01-30 16:58:19 -05:00
Mark Felder
81c8592d69 Pleroma.Web.MastodonAPI.AccountController: fix dialyzer errors with replace_params: false 2024-01-30 16:50:00 -05:00
feld
1bba02863d Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer fixes, some reverts

See merge request pleroma/pleroma!4049
2024-01-30 20:32:32 +00:00
Mark Felder
cfe7438b2f Pleroma.Web.MastodonAPI.DomainBlockController: dialyzer fixes via :replace_params 2024-01-30 14:52:15 -05:00
Mark Felder
608466d098 Modify our CastAndValidate plug to include the new functionality provided by the :replace_params config option
This allows us to configure Open API Spex to not overwrite the params with the casted versions which violates the Plug.Conn.t() contract

https://github.com/open-api-spex/open_api_spex/issues/92
https://github.com/open-api-spex/open_api_spex/pull/425
2024-01-30 14:49:55 -05:00
Mark Felder
91a70ba552 Bump open_api_spex 2024-01-30 14:48:45 -05:00
Mark Felder
8476eb1842 Revert "Pleroma.Web.AdminAPI.MediaProxyCacheController: dialyzer errors"
This reverts commit 8b02c85810.
2024-01-30 14:20:02 -05:00
Mark Felder
88a35b2865 Revert "Pleroma.Web.TwitterAPI.UtilController: dialyzer fixes"
This reverts commit 17f4251b19.
2024-01-30 14:19:54 -05:00
Mark Felder
674ae51d6a Revert "Pleroma.Web.PleromaAPI.UserImportController: Dialyzer errors"
This reverts commit 52e18a6249.
2024-01-30 14:19:41 -05:00
Mark Felder
4a80a285d1 Revert "Pleroma.Web.PleromaAPI.NotificationController: dialyzer errors"
This reverts commit 26a95e5787.
2024-01-30 14:19:32 -05:00
Mark Felder
1e76ceacd5 Revert "Pleroma.Web.AdminAPI.ConfigController: dialyzer error"
This reverts commit 60d89cb404.
2024-01-30 14:19:13 -05:00
Mark Felder
2c8e4f32c6 Revert "Pleroma.Web.PleromaAPI.MascotController: dialyzer errors"
This reverts commit 9c8055d4b3.
2024-01-30 14:18:36 -05:00
Mark Felder
b1a6102a85 Revert "Pleroma.Web.PleromaAPI.EmojiPackController: dialyzer errors"
This reverts commit 77bf617c4b.
2024-01-30 14:15:40 -05:00
Mark Felder
4a9ed4682a Revert "Pleroma.Web.PleromaAPI.EmojiFileController: dialyzer errors"
This reverts commit dc912dc590.
2024-01-30 14:15:17 -05:00
Mark Felder
b709fc4dfe Revert "Pleroma.Web.PleromaAPI.ChatController: Dialyzer error"
This reverts commit 8d64eedbec.
2024-01-30 14:15:05 -05:00
Mark Felder
589456f0ba Revert "Pleroma.Web.AdminAPI.InviteController: dialyzer errors"
This reverts commit db87be126e.
2024-01-30 14:14:56 -05:00
Mark Felder
4227db0871 Revert "Pleroma.Web.AdminAPI.UserController: dialyzer errors"
This reverts commit d92c3d927d.
2024-01-30 14:14:39 -05:00
Mark Felder
ac06a47689 Revert "Pleroma.Web.AdminAPI.RelayController: dialyzer errors"
This reverts commit 94838ed941.
2024-01-30 14:14:22 -05:00
Mark Felder
da5e0fca4f Revert "Pleroma.Web.AdminAPI.ReportController: dialyzer errors"
This reverts commit bfe626d578.
2024-01-30 14:14:07 -05:00
Mark Felder
39241107d9 Revert "Pleroma.Web.AdminAPI.InstanceDocumentController: fix dialyzer error"
This reverts commit a3024dd5ac.
2024-01-30 14:13:56 -05:00
Mark Felder
1fa1a93cd6 Revert "Pleroma.Web.MastodonAPI.AccountController: dialyzer errors"
This reverts commit e53c20b03c.
2024-01-30 14:13:46 -05:00
Mark Felder
41493bd642 Revert "Pleroma.Web.MastodonAPI.DomainBlockController: dialyzer errors"
This reverts commit 378edeaf15.
2024-01-30 14:13:23 -05:00
Mark Felder
a3426fcaf3 Revert "Pleroma.Web.MastodonAPI.MediaController: dialyzer errors"
This reverts commit 8cd5279857.
2024-01-30 14:13:13 -05:00
Mark Felder
b666710574 Pleroma.Web.MediaProxy.MediaProxyController: dialyzer errors
lib/pleroma/web/media_proxy/media_proxy_controller.ex:55:no_return
Function handle_preview/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:59:call
The function call will not succeed.

Pleroma.HTTP.request(<<72, 69, 65, 68>>, _media_proxy_url :: any(), [], [], [{:pool, :media}])

will never return since the success typing is:
(
  :delete | :get | :head | :options | :patch | :post | :put | :trace,
  binary(),
  any(),
  [{binary(), binary()}],
  Keyword.t()
) :: any()

and the contract is
(
  method(),
  Pleroma.HTTP.Request.url(),
  String.t(),
  Pleroma.HTTP.Request.headers(),
  :elixir.keyword()
) :: {:ok, Tesla.Env.t()} | {:error, any()}

________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:95:unused_fun
Function handle_preview/3 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:111:unused_fun
Function handle_png_preview/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:134:unused_fun
Function handle_jpeg_preview/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:152:unused_fun
Function handle_video_preview/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:164:unused_fun
Function drop_static_param_and_redirect/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:173:unused_fun
Function fallback_on_preview_error/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:177:unused_fun
Function put_preview_response_headers/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:177:unused_fun
Function put_preview_response_headers/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:187:unused_fun
Function thumbnail_max_dimensions/0 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:196:unused_fun
Function min_content_length_for_preview/0 will never be called.
________________________________________________________________________________
lib/pleroma/web/media_proxy/media_proxy_controller.ex:200:unused_fun
Function media_preview_proxy_config/0 will never be called.
2024-01-29 18:50:50 -05:00
Mark Felder
8cd5279857 Pleroma.Web.MastodonAPI.MediaController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/media_controller.ex:32:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:file => _, _ => _},
    _ => _
  },
  <<97, 116, 116, 97, 99, 104, 109, 101, 110, 116, 46, 106, 115, 111, 110>>,
  %{:attachment => map()}
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/media_controller.ex:48:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:file => _, _ => _},
    _ => _
  },
  202
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/media_controller.ex:63:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:description => _, _ => _},
    _ => _
  },
  <<97, 116, 116, 97, 99, 104, 109, 101, 110, 116, 46, 106, 115, 111, 110>>,
  %{:attachment => map()}
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
2024-01-29 18:36:46 -05:00
Mark Felder
378edeaf15 Pleroma.Web.MastodonAPI.DomainBlockController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:32:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:domain => _, _ => _},
    _ => _
  },
  %{}
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:43:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:domain => _, _ => _},
    _ => _
  },
  %{}
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-29 18:36:34 -05:00
Mark Felder
3cb2807244 Pleroma.Web.MastodonAPI.StatusView: dialyzer error
lib/pleroma/web/mastodon_api/views/status_view.ex:799:pattern_match_cov
The pattern
_, _

can never match, because previous clauses completely cover the type

  %URI{
    :authority => URI.authority(),
    :fragment => nil | binary(),
    :host => nil | binary(),
    :path => nil | binary(),
    :port => nil | char(),
    :query => nil | binary(),
    :scheme => nil | binary(),
    :userinfo => nil | binary()
  },
  %URI{
    :authority => URI.authority(),
    :fragment => nil | binary(),
    :host => nil | binary(),
    :path => nil | binary(),
    :port => nil | char(),
    :query => nil | binary(),
    :scheme => nil | binary(),
    :userinfo => nil | binary()
  }
.
2024-01-29 18:28:49 -05:00
Mark Felder
a266492776 Pleroma.User: dialyzer errors
lib/pleroma/user.ex:757:no_return
Function register_changeset/1 has no local return.
________________________________________________________________________________
lib/pleroma/user.ex:757:no_return
Function register_changeset/2 has no local return.
________________________________________________________________________________
lib/pleroma/user.ex:757:no_return
Function register_changeset/3 has no local return.
________________________________________________________________________________
lib/pleroma/user.ex:778:call
The function call will not succeed.

Pleroma.User.approval_changeset(
  %Ecto.Changeset{
    :action => atom(),
    :changes => %{atom() => _},
    :constraints => [
      %{
        :constraint =>
          binary()
          | %Regex{
              :opts => binary() | [any()],
              :re_pattern => _,
              :re_version => _,
              :source => binary()
            },
        :error_message => binary(),
        :error_type => atom(),
        :field => atom(),
        :match => :exact | :prefix | :suffix,
        :type => :check | :exclusion | :foreign_key | :unique
      }
    ],
    :data => nil | map(),
    :empty_values => _,
    :errors => Keyword.t({binary(), Keyword.t()}),
    :filters => %{atom() => _},
    :params => nil | %{binary() => _},
    :prepare => [(_ -> any())],
    :repo => atom(),
    :repo_opts => Keyword.t(),
    :required => [atom()],
    :types =>
      nil
      | %{
          atom() =>
            atom()
            | {:array | :assoc | :embed | :in | :map | :maybe | :param, _}
            | {:parameterized, atom(), _}
        },
    :valid? => boolean(),
    :validations => Keyword.t()
  },
  [{:set_approval, _}, ...]
)

breaks the contract
(t(), :elixir.keyword()) :: Ecto.Changeset.t()

________________________________________________________________________________
lib/pleroma/user.ex:854:unused_fun
Function maybe_validate_required_birthday/1 will never be called.
2024-01-29 17:37:52 -05:00
Mark Felder
2de84e2e3b API Specs: many dialyzer errors
Too many to include in a commit log

Module instead of schema was being passed
2024-01-29 17:10:28 -05:00
Mark Felder
4fc177eb46 Pleroma.Web.ControllerHelper: dialyzer error
lib/pleroma/web/controller_helper.ex:97:pattern_match
The pattern can never match the type.

Pattern:
nil

Type:
%Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{
    binary() =>
      binary()
      | [binary() | [any()] | %{binary() => _}]
      | %{binary() => binary() | [any()] | %{binary() => _}}
  },
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() =>
      binary()
      | [binary() | [any()] | %{binary() => _}]
      | %{binary() => binary() | [any()] | %{binary() => _}}
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{binary(), binary()}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{binary(), binary()}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}
2024-01-29 16:42:48 -05:00
Haelwenn
251c455b91 Merge branch 'deps-bump' into 'develop'
Bump dependencies

See merge request pleroma/pleroma!4044
2024-01-29 17:43:00 +00:00
feld
c9dc881747 Merge branch 'dialyzer-fixes' into 'develop'
More dialyzer fixes

See merge request pleroma/pleroma!4048
2024-01-28 23:20:25 +00:00
Mark Felder
6a22a80f9f Pleroma.Web.MastodonAPI.DirectoryController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/directory_controller.ex:6:unused_fun
Function skip_auth/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/directory_controller.ex:6:unused_fun
Function skip_plug/2 will never be called.
________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/directory_controller.ex:18:guard_fail
The guard clause:

when _action :: atom() == <<105, 110, 100, 101, 120>>

can never succeed.
2024-01-28 17:41:07 -05:00
Mark Felder
e53c20b03c Pleroma.Web.MastodonAPI.AccountController: dialyzer errors
lib/pleroma/web/mastodon_api/controllers/account_controller.ex:479:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:account => _, :user => _, _ => _},
    :body_params => %{:comment => _, _ => _},
    _ => _
  },
  <<114, 101, 108, 97, 116, 105, 111, 110, 115, 104, 105, 112, 46, 106, 115, 111, 110>>,
  [
    {:target, %Pleroma.User{:id => _, _ => _}} | {:user, %Pleroma.User{:id => _, _ => _}},
    ...
  ]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/mastodon_api/controllers/account_controller.ex:519:call
The function call will not succeed.

Plug.Conn.assign(
  _conn :: %{:body_params => %{:uri => _, _ => _}, _ => _},
  :account,
  _user :: %Pleroma.User{_ => _}
)

breaks the contract
(t(), atom(), term()) :: t()
2024-01-28 17:41:07 -05:00
Mark Felder
e2fc03ec72 Pleroma.Web.ActivityPub.Utils: dialyzer error
lib/pleroma/web/activity_pub/utils.ex:779:guard_fail
The guard clause:

when _ :: %Pleroma.Object{_ => _} === nil

can never succeed.
2024-01-28 17:14:41 -05:00
Mark Felder
082d665160 Pleroma.Web.AdminAPI.UserController: dialyzer errors
lib/pleroma/web/admin_api/controllers/user_controller.ex:205:no_return
Function activate/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:215:call
The function call will not succeed.

Keyword.values(
  _updated_users :: %Pleroma.User{
    :__meta__ => _,
    :accepts_chat_messages => _,
    :actor_type => _,
    :allow_following_move => _,
    :also_known_as => _,
    :ap_id => _,
    :avatar => _,
    :background => _,
    :banner => _,
    :bio => _,
    :birthday => _,
    :blocked_users => _,
    :blockee_blocks => _,
    :blocker_blocks => _,
    :blocker_users => _,
    :blocks => _,
    :confirmation_token => _,
    :default_scope => _,
    :deliveries => _,
    :disclose_client => _,
    :domain_blocks => _,
    :email => _,
    :email_notifications => _,
    :emoji => _,
    :endorsed_users => _,
    :endorsee_endorsements => _,
    :endorser_endorsements => _,
    :endorser_users => _,
    :featured_address => _,
    :fields => _,
    :follower_address => _,
    :follower_count => _,
    :following_address => _,
    :following_count => _,
    :hide_favorites => _,
    :hide_followers => _,
    :hide_followers_count => _,
    :hide_follows => _,
    :hide_follows_count => _,
    :id => _,
    :inbox => _,
    :incoming_relationships => _,
    :inserted_at => _,
    :invisible => _,
    :is_active => _,
    :is_admin => _,
    :is_approved => _,
    :is_confirmed => _,
    :is_discoverable => _,
    :is_locked => _,
    :is_moderator => _,
    :is_suggested => _,
    :keys => _,
    :language => _,
    :last_active_at => _,
    :last_digest_emailed_at => _,
    :last_refreshed_at => _,
    :last_status_at => _,
    :local => _,
    :mascot => _,
    :multi_factor_authentication_settings => _,
    :muted_notifications => _,
    :muted_reblogs => _,
    :muted_users => _,
    :mutee_mutes => _,
    :muter_mutes => _,
    :muter_users => _,
    :mutes => _,
    :name => _,
    :nickname => _,
    :no_rich_text => _,
    :note_count => _,
    :notification_muted_users => _,
    :notification_mutee_mutes => _,
    :notification_muter_mutes => _,
    :notification_muter_users => _,
    :notification_settings => _,
    :notifications => _,
    :outgoing_relationships => _,
    :password => _,
    :password_confirmation => _,
    :password_hash => _,
    :password_reset_pending => _,
    :pinned_objects => _,
    :pleroma_settings_store => _,
    :public_key => _,
    :raw_bio => _,
    :raw_fields => _,
    :reblog_muted_users => _,
    :reblog_mutee_mutes => _,
    :reblog_muter_mutes => _,
    :reblog_muter_users => _,
    :registration_reason => _,
    :registrations => _,
    :search_rank => _,
    :search_type => _,
    :shared_inbox => _,
    :show_birthday => _,
    :show_role => _,
    :skip_thread_containment => _,
    :subscribee_subscriptions => _,
    :subscribee_users => _,
    :subscriber_subscriptions => _,
    :subscriber_users => _,
    :subscribers => _,
    :tags => _,
    :updated_at => _,
    :uri => _
  }
)

will never return since the success typing is:
([any()]) :: [any()]

and the contract is
(t()) :: [value()]

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:218:no_return
Function deactivate/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:228:call
The function call will not succeed.

Keyword.values(
  _updated_users :: %Pleroma.User{
    :__meta__ => _,
    :accepts_chat_messages => _,
    :actor_type => _,
    :allow_following_move => _,
    :also_known_as => _,
    :ap_id => _,
    :avatar => _,
    :background => _,
    :banner => _,
    :bio => _,
    :birthday => _,
    :blocked_users => _,
    :blockee_blocks => _,
    :blocker_blocks => _,
    :blocker_users => _,
    :blocks => _,
    :confirmation_token => _,
    :default_scope => _,
    :deliveries => _,
    :disclose_client => _,
    :domain_blocks => _,
    :email => _,
    :email_notifications => _,
    :emoji => _,
    :endorsed_users => _,
    :endorsee_endorsements => _,
    :endorser_endorsements => _,
    :endorser_users => _,
    :featured_address => _,
    :fields => _,
    :follower_address => _,
    :follower_count => _,
    :following_address => _,
    :following_count => _,
    :hide_favorites => _,
    :hide_followers => _,
    :hide_followers_count => _,
    :hide_follows => _,
    :hide_follows_count => _,
    :id => _,
    :inbox => _,
    :incoming_relationships => _,
    :inserted_at => _,
    :invisible => _,
    :is_active => _,
    :is_admin => _,
    :is_approved => _,
    :is_confirmed => _,
    :is_discoverable => _,
    :is_locked => _,
    :is_moderator => _,
    :is_suggested => _,
    :keys => _,
    :language => _,
    :last_active_at => _,
    :last_digest_emailed_at => _,
    :last_refreshed_at => _,
    :last_status_at => _,
    :local => _,
    :mascot => _,
    :multi_factor_authentication_settings => _,
    :muted_notifications => _,
    :muted_reblogs => _,
    :muted_users => _,
    :mutee_mutes => _,
    :muter_mutes => _,
    :muter_users => _,
    :mutes => _,
    :name => _,
    :nickname => _,
    :no_rich_text => _,
    :note_count => _,
    :notification_muted_users => _,
    :notification_mutee_mutes => _,
    :notification_muter_mutes => _,
    :notification_muter_users => _,
    :notification_settings => _,
    :notifications => _,
    :outgoing_relationships => _,
    :password => _,
    :password_confirmation => _,
    :password_hash => _,
    :password_reset_pending => _,
    :pinned_objects => _,
    :pleroma_settings_store => _,
    :public_key => _,
    :raw_bio => _,
    :raw_fields => _,
    :reblog_muted_users => _,
    :reblog_mutee_mutes => _,
    :reblog_muter_mutes => _,
    :reblog_muter_users => _,
    :registration_reason => _,
    :registrations => _,
    :search_rank => _,
    :search_type => _,
    :shared_inbox => _,
    :show_birthday => _,
    :show_role => _,
    :skip_thread_containment => _,
    :subscribee_subscriptions => _,
    :subscribee_users => _,
    :subscriber_subscriptions => _,
    :subscriber_users => _,
    :subscribers => _,
    :tags => _,
    :updated_at => _,
    :uri => _
  }
)

will never return since the success typing is:
([any()]) :: [any()]

and the contract is
(t()) :: [value()]
2024-01-28 17:14:37 -05:00
Mark Felder
a3024dd5ac Pleroma.Web.AdminAPI.InstanceDocumentController: fix dialyzer error
lib/pleroma/web/admin_api/controllers/instance_document_controller.ex:32:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:file => _, _ => _}, _ => _}, %{<<_::24>> => binary()}) ::
  :ok
def a() do
  :ok
end

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-28 16:35:30 -05:00
Mark Felder
bfe626d578 Pleroma.Web.AdminAPI.ReportController: dialyzer errors
lib/pleroma/web/admin_api/controllers/report_controller.ex:48:no_return
Function update/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/report_controller.ex:70:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.json_response(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:reports => _, _ => _},
    _ => _
  },
  :bad_request,
  _result :: [any()]
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | 1..1_114_111,
  any()
)

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/report_controller.ex:72:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.json_response(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:reports => _, _ => _},
    _ => _
  },
  :no_content,
  <<>>
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | 1..1_114_111,
  any()
)

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/report_controller.ex:76:no_return
Function notes_create/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/report_controller.ex:89:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.json_response(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:content => _, _ => _},
    _ => _
  },
  :no_content,
  <<>>
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | 1..1_114_111,
  any()
)

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/report_controller.ex:91:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.json_response(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:content => _, _ => _},
    _ => _
  },
  :bad_request,
  <<>>
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | 1..1_114_111,
  any()
)
2024-01-28 16:32:50 -05:00
Mark Felder
94838ed941 Pleroma.Web.AdminAPI.RelayController: dialyzer errors
lib/pleroma/web/admin_api/controllers/relay_controller.ex:34:no_return
Function follow/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/relay_controller.ex:38:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:relay_url => _, _ => _},
    _ => _
  },
  %{:actor => binary(), :followed_back => boolean()}
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/relay_controller.ex:41:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:relay_url => _, _ => _},
    _ => _
  },
  500
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/relay_controller.ex:47:no_return
Function unfollow/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/relay_controller.ex:51:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:relay_url => _, _ => _},
    _ => _
  },
  _target :: binary()
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/relay_controller.ex:54:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:relay_url => _, _ => _},
    _ => _
  },
  500
)

breaks the contract
(t(), status()) :: t()
2024-01-28 16:09:55 -05:00
Mark Felder
d92c3d927d Pleroma.Web.AdminAPI.UserController: dialyzer errors
lib/pleroma/web/admin_api/controllers/user_controller.ex:54:no_return
Function delete/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:74:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:nicknames => _, _ => _},
    _ => _
  },
  _nicknames :: any()
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:77:no_return
Function follow/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:99:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:followed => _, :follower => _, _ => _},
    _ => _
  },
  <<111, 107>>
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:102:no_return
Function unfollow/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:124:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:followed => _, :follower => _, _ => _},
    _ => _
  },
  <<111, 107>>
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:127:no_return
Function create/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:130:no_return
The created anonymous function has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:163:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:users => _, _ => _},
    _ => _
  },
  <<99, 114, 101, 97, 116, 101, 100, 95, 109, 97, 110, 121, 46, 106, 115, 111, 110>>,
  [{:users, [any()]}, ...]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:175:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:users => _, _ => _},
    _ => _
  },
  :conflict
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:205:no_return
Function activate/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:215:call
The function call will not succeed.

Keyword.values(
  _updated_users :: %Pleroma.User{
    :__meta__ => _,
    :accepts_chat_messages => _,
    :actor_type => _,
    :allow_following_move => _,
    :also_known_as => _,
    :ap_id => _,
    :avatar => _,
    :background => _,
    :banner => _,
    :bio => _,
    :birthday => _,
    :blocked_users => _,
    :blockee_blocks => _,
    :blocker_blocks => _,
    :blocker_users => _,
    :blocks => _,
    :confirmation_token => _,
    :default_scope => _,
    :deliveries => _,
    :disclose_client => _,
    :domain_blocks => _,
    :email => _,
    :email_notifications => _,
    :emoji => _,
    :endorsed_users => _,
    :endorsee_endorsements => _,
    :endorser_endorsements => _,
    :endorser_users => _,
    :featured_address => _,
    :fields => _,
    :follower_address => _,
    :follower_count => _,
    :following_address => _,
    :following_count => _,
    :hide_favorites => _,
    :hide_followers => _,
    :hide_followers_count => _,
    :hide_follows => _,
    :hide_follows_count => _,
    :id => _,
    :inbox => _,
    :incoming_relationships => _,
    :inserted_at => _,
    :invisible => _,
    :is_active => _,
    :is_admin => _,
    :is_approved => _,
    :is_confirmed => _,
    :is_discoverable => _,
    :is_locked => _,
    :is_moderator => _,
    :is_suggested => _,
    :keys => _,
    :language => _,
    :last_active_at => _,
    :last_digest_emailed_at => _,
    :last_refreshed_at => _,
    :last_status_at => _,
    :local => _,
    :mascot => _,
    :multi_factor_authentication_settings => _,
    :muted_notifications => _,
    :muted_reblogs => _,
    :muted_users => _,
    :mutee_mutes => _,
    :muter_mutes => _,
    :muter_users => _,
    :mutes => _,
    :name => _,
    :nickname => _,
    :no_rich_text => _,
    :note_count => _,
    :notification_muted_users => _,
    :notification_mutee_mutes => _,
    :notification_muter_mutes => _,
    :notification_muter_users => _,
    :notification_settings => _,
    :notifications => _,
    :outgoing_relationships => _,
    :password => _,
    :password_confirmation => _,
    :password_hash => _,
    :password_reset_pending => _,
    :pinned_objects => _,
    :pleroma_settings_store => _,
    :public_key => _,
    :raw_bio => _,
    :raw_fields => _,
    :reblog_muted_users => _,
    :reblog_mutee_mutes => _,
    :reblog_muter_mutes => _,
    :reblog_muter_users => _,
    :registration_reason => _,
    :registrations => _,
    :search_rank => _,
    :search_type => _,
    :shared_inbox => _,
    :show_birthday => _,
    :show_role => _,
    :skip_thread_containment => _,
    :subscribee_subscriptions => _,
    :subscribee_users => _,
    :subscriber_subscriptions => _,
    :subscriber_users => _,
    :subscribers => _,
    :tags => _,
    :updated_at => _,
    :uri => _
  }
)

will never return since the success typing is:
([any()]) :: [any()]

and the contract is
(t()) :: [value()]

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:218:no_return
Function deactivate/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:228:call
The function call will not succeed.

Keyword.values(
  _updated_users :: %Pleroma.User{
    :__meta__ => _,
    :accepts_chat_messages => _,
    :actor_type => _,
    :allow_following_move => _,
    :also_known_as => _,
    :ap_id => _,
    :avatar => _,
    :background => _,
    :banner => _,
    :bio => _,
    :birthday => _,
    :blocked_users => _,
    :blockee_blocks => _,
    :blocker_blocks => _,
    :blocker_users => _,
    :blocks => _,
    :confirmation_token => _,
    :default_scope => _,
    :deliveries => _,
    :disclose_client => _,
    :domain_blocks => _,
    :email => _,
    :email_notifications => _,
    :emoji => _,
    :endorsed_users => _,
    :endorsee_endorsements => _,
    :endorser_endorsements => _,
    :endorser_users => _,
    :featured_address => _,
    :fields => _,
    :follower_address => _,
    :follower_count => _,
    :following_address => _,
    :following_count => _,
    :hide_favorites => _,
    :hide_followers => _,
    :hide_followers_count => _,
    :hide_follows => _,
    :hide_follows_count => _,
    :id => _,
    :inbox => _,
    :incoming_relationships => _,
    :inserted_at => _,
    :invisible => _,
    :is_active => _,
    :is_admin => _,
    :is_approved => _,
    :is_confirmed => _,
    :is_discoverable => _,
    :is_locked => _,
    :is_moderator => _,
    :is_suggested => _,
    :keys => _,
    :language => _,
    :last_active_at => _,
    :last_digest_emailed_at => _,
    :last_refreshed_at => _,
    :last_status_at => _,
    :local => _,
    :mascot => _,
    :multi_factor_authentication_settings => _,
    :muted_notifications => _,
    :muted_reblogs => _,
    :muted_users => _,
    :mutee_mutes => _,
    :muter_mutes => _,
    :muter_users => _,
    :mutes => _,
    :name => _,
    :nickname => _,
    :no_rich_text => _,
    :note_count => _,
    :notification_muted_users => _,
    :notification_mutee_mutes => _,
    :notification_muter_mutes => _,
    :notification_muter_users => _,
    :notification_settings => _,
    :notifications => _,
    :outgoing_relationships => _,
    :password => _,
    :password_confirmation => _,
    :password_hash => _,
    :password_reset_pending => _,
    :pinned_objects => _,
    :pleroma_settings_store => _,
    :public_key => _,
    :raw_bio => _,
    :raw_fields => _,
    :reblog_muted_users => _,
    :reblog_mutee_mutes => _,
    :reblog_muter_mutes => _,
    :reblog_muter_users => _,
    :registration_reason => _,
    :registrations => _,
    :search_rank => _,
    :search_type => _,
    :shared_inbox => _,
    :show_birthday => _,
    :show_role => _,
    :skip_thread_containment => _,
    :subscribee_subscriptions => _,
    :subscribee_users => _,
    :subscriber_subscriptions => _,
    :subscriber_users => _,
    :subscribers => _,
    :tags => _,
    :updated_at => _,
    :uri => _
  }
)

will never return since the success typing is:
([any()]) :: [any()]

and the contract is
(t()) :: [value()]

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:231:no_return
Function approve/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:241:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:nicknames => _, _ => _},
    _ => _
  },
  <<105, 110, 100, 101, 120, 46, 106, 115, 111, 110>>,
  [{:users, _}, ...]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:244:no_return
Function suggest/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:254:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:nicknames => _, _ => _},
    _ => _
  },
  <<105, 110, 100, 101, 120, 46, 106, 115, 111, 110>>,
  [{:users, _}, ...]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:257:no_return
Function unsuggest/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:267:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:nicknames => _, _ => _},
    _ => _
  },
  <<105, 110, 100, 101, 120, 46, 106, 115, 111, 110>>,
  [{:users, _}, ...]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:270:no_return
Function index/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:294:unused_fun
Function maybe_parse_filters/1 will never be called.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:303:no_return
Function page_params/1 has no local return.
________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/user_controller.ex:305:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.fetch_integer_param(_params :: any(), :page, 1)

breaks the contract
(map(), String.t(), integer() | nil) :: integer() | nil
2024-01-28 16:05:25 -05:00
Mark Felder
db87be126e Pleroma.Web.AdminAPI.InviteController: dialyzer errors
lib/pleroma/web/admin_api/controllers/invite_controller.ex:46:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{:body_params => %{:token => _, _ => _}, _ => _},
  <<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
  [
    {:invite,
     %Pleroma.UserInviteToken{
       :__meta__ => _,
       :expires_at => _,
       :id => _,
       :inserted_at => _,
       :invite_type => _,
       :max_use => _,
       :token => _,
       :updated_at => _,
       :used => _,
       :uses => _
     }},
    ...
  ]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/admin_api/controllers/invite_controller.ex:66:call
The function call will not succeed.

Pleroma.Web.ControllerHelper.json_response(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:email => _, _ => _},
    _ => _
  },
  :no_content,
  <<>>
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | 1..1_114_111,
  any()
)
2024-01-28 15:53:47 -05:00
Mark Felder
8d64eedbec Pleroma.Web.PleromaAPI.ChatController: Dialyzer error
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:128:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:last_read_id => _, _ => _},
    _ => _
  },
  <<115, 104, 111, 119, 46, 106, 115, 111, 110>>,
  [
    {:chat,
     %Pleroma.Chat{
       :__meta__ => _,
       :id => _,
       :inserted_at => _,
       :recipient => _,
       :updated_at => _,
       :user => _,
       :user_id => _
     }},
    ...
  ]
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
2024-01-28 15:52:09 -05:00
Mark Felder
456f7cab3e Pleroma.Web.PleromaAPI.ChatController: Dialyzer errors
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:91:pattern_match
The pattern can never match the type.

Pattern:
{:reject, _message}

Type:
nil

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:96:pattern_match
The pattern can never match the type.

Pattern:
{:error, _message}

Type:
nil
2024-01-28 15:52:09 -05:00
Mark Felder
dc912dc590 Pleroma.Web.PleromaAPI.EmojiFileController: dialyzer errors
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:52:no_return
Function update/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:59:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:shortcode => _, _ => _}, _ => _}, %{
  binary() =>
    binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | char(),
        binary() | []
      )
})

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:62:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:shortcode => _, _ => _}, _ => _}, :conflict)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:70:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:shortcode => _, _ => _}, _ => _}, :unprocessable_entity) ::
  :ok
def a() do
  :ok
end

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:75:call
The function call will not succeed.

Pleroma.Web.PleromaAPI.EmojiFileController.handle_error(
  _conn :: %{:body_params => %{:shortcode => _, _ => _}, _ => _},
  _error :: {:error, atom()},
  %{:code => _, :message => <<_::328>>, :pack_name => binary()}
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  {:error, atom()},
  %{:message => <<_::328, _::size(88)>>, :pack_name => binary(), :code => _}
)

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex:75:call
The function call will not succeed.

Pleroma.Web.PleromaAPI.EmojiFileController.handle_error(
  _conn :: %{:body_params => %{:shortcode => _, _ => _}, _ => _},
  _error :: {:error, atom()},
  %{:code => binary(), :message => <<_::328>>, :pack_name => binary()}
)

will never return since the 1st arguments differ
from the success typing arguments:

(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() =>
        binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{binary(), binary()}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{binary(), binary()}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  {:error, atom()},
  %{:message => <<_::328, _::size(88)>>, :pack_name => binary(), :code => _}
)
2024-01-28 15:52:09 -05:00
Mark Felder
77bf617c4b Pleroma.Web.PleromaAPI.EmojiPackController: dialyzer errors
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:112:no_return
Function download/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:114:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _}, <<111, 107>>)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:117:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:122:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:127:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{:body_params => %{:name => _, :url => _, _ => _}, _ => _},
  :internal_server_error
)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:187:no_return
Function update/2 has no local return.
________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:189:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, map())

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:192:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, :bad_request)

breaks the contract
(t(), status()) :: t()

________________________________________________________________________________
lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:203:call
The function call will not succeed.

Plug.Conn.put_status(_conn :: %{:body_params => %{:metadata => _, _ => _}, _ => _}, :internal_server_error) ::
  :ok
def a() do
  :ok
end

breaks the contract
(t(), status()) :: t()
2024-01-28 15:52:09 -05:00
Mark Felder
a32d6b3aa4 Pleroma.Web.PleromaAPI.MascotController: dialyzer error
lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:33:pattern_match
The pattern can never match the type.

Pattern:
{:content_type, _}

Type:
{:error, _}
2024-01-28 15:52:09 -05:00
Mark Felder
9c8055d4b3 Pleroma.Web.PleromaAPI.MascotController: dialyzer errors
lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:25:no_return
Function update/2 has no local return.

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:27:call
The function call will not succeed.

Pleroma.Web.ActivityPub.ActivityPub.upload(_file :: atom() | %{:content_type => _, _ => _}, [{:actor, <<_::56, _::size(8)>>}, ...]) ::
  :ok
def a() do
  :ok
end

will never return since the 2nd arguments differ
from the success typing arguments:

(any(), [
  {:activity_type | :description | :filters | :size_limit | :type | :uploader,
   atom() | binary() | [atom()] | non_neg_integer()}
])

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:31:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:file => _, _ => _},
    _ => _
  },
  _attachment :: any()
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:34:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:file => _, _ => _},
    _ => _
  },
  :unsupported_media_type
)

breaks the contract
(t(), status()) :: t()

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:34:call
The function call will not succeed.

Plug.Conn.put_status(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:file => _, _ => _},
    _ => _
  },
  :unsupported_media_type
)

breaks the contract
(t(), status()) :: t()

lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:38:unused_fun
Function render_attachment/1 will never be called.
2024-01-28 15:52:09 -05:00
Mark Felder
563aebd5ce Pleroma.Web.Plugs.UploadedMedia: dialyzer error
lib/pleroma/web/plugs/uploaded_media.ex:98:call
The function call will not succeed.

Pleroma.ReverseProxy.call(
  _conn :: %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  _url :: any(),
  _proxy_opts :: [{:http, [{:follow_redirect, true} | {:pool, :upload}, ...]}, ...]
)

breaks the contract
(Plug.Conn.t(), url :: String.t(), [option()]) :: Plug.Conn.t()
2024-01-28 14:22:35 -05:00
Mark Felder
60d89cb404 Pleroma.Web.AdminAPI.ConfigController: dialyzer error
lib/pleroma/web/admin_api/controllers/config_controller.ex:162:call
The function call will not succeed.

Phoenix.Controller.render(
  _conn :: %{:body_params => %{:configs => _, _ => _}, _ => _},
  <<105, 110, 100, 101, 120, 46, 106, 115, 111, 110>>,
  %{:configs => [any()], :need_reboot => _}
)

will never return since the success typing is:
(
  %Plug.Conn{
    :adapter => {atom(), _},
    :assigns => %{atom() => _},
    :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :halted => boolean(),
    :host => binary(),
    :method => binary(),
    :owner => pid(),
    :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
    :path_info => [binary()],
    :path_params => %{binary() => binary() | [any()] | map()},
    :port => char(),
    :private => %{atom() => _},
    :query_params => %Plug.Conn.Unfetched{
      :aspect => atom(),
      binary() => binary() | [any()] | map()
    },
    :query_string => binary(),
    :remote_ip =>
      {byte(), byte(), byte(), byte()}
      | {char(), char(), char(), char(), char(), char(), char(), char()},
    :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
    :req_headers => [{_, _}],
    :request_path => binary(),
    :resp_body =>
      nil
      | binary()
      | maybe_improper_list(
          binary() | maybe_improper_list(any(), binary() | []) | byte(),
          binary() | []
        ),
    :resp_cookies => %{binary() => map()},
    :resp_headers => [{_, _}],
    :scheme => :http | :https,
    :script_name => [binary()],
    :secret_key_base => nil | binary(),
    :state =>
      :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset | :upgraded,
    :status => nil | non_neg_integer()
  },
  atom() | binary(),
  atom() | binary() | [{_, _}] | map()
) :: %Plug.Conn{
  :adapter => {atom(), _},
  :assigns => %{atom() => _},
  :body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :halted => boolean(),
  :host => binary(),
  :method => binary(),
  :owner => pid(),
  :params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
  :path_info => [binary()],
  :path_params => %{binary() => binary() | [any()] | map()},
  :port => char(),
  :private => %{atom() => _},
  :query_params => %Plug.Conn.Unfetched{
    :aspect => atom(),
    binary() => binary() | [any()] | map()
  },
  :query_string => binary(),
  :remote_ip =>
    {byte(), byte(), byte(), byte()}
    | {char(), char(), char(), char(), char(), char(), char(), char()},
  :req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
  :req_headers => [{_, _}],
  :request_path => binary(),
  :resp_body =>
    nil
    | binary()
    | maybe_improper_list(
        binary() | maybe_improper_list(any(), binary() | []) | byte(),
        binary() | []
      ),
  :resp_cookies => %{binary() => map()},
  :resp_headers => [{_, _}],
  :scheme => :http | :https,
  :script_name => [binary()],
  :secret_key_base => nil | binary(),
  :state => :sent,
  :status => nil | non_neg_integer()
}

and the contract is
(Plug.Conn.t(), binary() | atom(), Keyword.t() | map()) :: Plug.Conn.t()
2024-01-27 16:42:30 -05:00
Mark Felder
26a95e5787 Pleroma.Web.PleromaAPI.NotificationController: dialyzer errors
lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex:53:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:list => _, _ => _},
    _ => _
  },
  <<106, 111, 98, 32, 115, 116, 97, 114, 116, 101, 100>>
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-27 16:15:03 -05:00
Mark Felder
52e18a6249 Pleroma.Web.PleromaAPI.UserImportController: Dialyzer errors
lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex:53:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:list => _, _ => _},
    _ => _
  },
  <<106, 111, 98, 32, 115, 116, 97, 114, 116, 101, 100>>
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-27 15:57:21 -05:00
Mark Felder
17f4251b19 Pleroma.Web.TwitterAPI.UtilController: dialyzer fixes
lib/pleroma/web/twitter_api/controllers/util_controller.ex:158:call
The function call will not succeed.

Phoenix.Controller.json(_conn :: %{:body_params => %{:ap_id => _, :profile => _, _ => _}, _ => _}, %{
  :error =>
    <<67, 111, 117, 108, 100, 110, 39, 116, 32, 102, 105, 110, 100, 32, 117, 115, 101, 114>>
})

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-27 15:47:07 -05:00
Mark Felder
8b02c85810 Pleroma.Web.AdminAPI.MediaProxyCacheController: dialyzer errors
lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex:64:call
The function call will not succeed.

Phoenix.Controller.json(
  _conn :: %{
    :assigns => %{:user => _, _ => _},
    :body_params => %{:urls => _, _ => _},
    _ => _
  },
  %{}
)

breaks the contract
(Plug.Conn.t(), term()) :: Plug.Conn.t()
2024-01-27 15:41:14 -05:00
Mark Felder
861c8ebfe4 These are all due to Cachex typespec bugs 2024-01-27 15:14:40 -05:00
Mark Felder
5c193a34a2 Pleroma.Web.ActivityPub.SideEffects: dialyzer errors
lib/pleroma/web/activity_pub/side_effects.ex:544:call
The function call will not succeed.

Pleroma.Web.ActivityPub.SideEffects.delete_object(
  _object :: %Pleroma.Activity{
    :__meta__ => _,
    :actor => _,
    :bookmark => _,
    :data => map(),
    :id => _,
    :inserted_at => _,
    :local => _,
    :notifications => _,
    :object => _,
    :pagination_id => _,
    :recipients => _,
    :report_notes => _,
    :thread_muted? => _,
    :updated_at => _,
    :user_actor => _
  }
)

breaks the contract
(Pleroma.Object.t()) :: :ok | {:error, Ecto.Changeset.t()}
2024-01-27 15:05:12 -05:00
Mark Felder
b6a1e7fb31 Pleroma.Web.ActivityPub.SideEffects: dialyzer errors
lib/pleroma/web/activity_pub/side_effects.ex:622:callback_type_mismatch
Type mismatch for @callback handle_after_transaction/1 in Pleroma.Web.ActivityPub.SideEffects.Handling behaviour.

Expected type:
map()

Actual type:
Keyword.t()

lib/pleroma/web/activity_pub/side_effects.ex:622:callback_arg_type_mismatch
The inferred type for the 1st argument is not a
supertype of the expected type for the handle_after_transaction/1 callback
in the Pleroma.Web.ActivityPub.SideEffects.Handling behaviour.

Success type:
Keyword.t()

Behaviour callback type:
map()
2024-01-27 15:02:20 -05:00
Mark Felder
5f5bd64b83 Pleroma.Web.ActivityPub.SideEffects: dialyzer errors
lib/pleroma/web/activity_pub/side_effects.ex:328:pattern_match
The pattern can never match the type.

Pattern:
{:actor, _}

Type:
{:error, boolean()}

lib/pleroma/web/activity_pub/side_effects.ex:328:pattern_match
The pattern can never match the type.

Pattern:
{:actor, _}

Type:
nil
2024-01-27 14:55:29 -05:00
Mark Felder
94d7e28cbe Pleroma.Web.ActivityPub.ObjectValidator: dialyzer error
lib/pleroma/web/activity_pub/object_validator.ex:165:pattern_match
The pattern can never match the type.

Pattern:
{:local, _}

Type:

  {:error,
   %Ecto.Changeset{
     :action => atom(),
     :changes => %{atom() => _},
     :constraints => [
       %{
         :constraint =>
           binary()
           | %Regex{
               :opts => binary() | [any()],
               :re_pattern => _,
               :re_version => _,
               :source => binary()
             },
         :error_message => binary(),
         :error_type => atom(),
         :field => atom(),
         :match => :exact | :prefix | :suffix,
         :type => :check | :exclusion | :foreign_key | :unique
       }
     ],
     :data => nil | map(),
     :empty_values => _,
     :errors => Keyword.t({binary(), Keyword.t()}),
     :filters => %{atom() => _},
     :params => nil | %{binary() => _},
     :prepare => [(_ -> any())],
     :repo => atom(),
     :repo_opts => Keyword.t(),
     :required => [atom()],
     :types =>
       nil
       | %{
           atom() =>
             atom()
             | {:array | :assoc | :embed | :in | :map | :maybe | :param, _}
             | {:parameterized, atom(), _}
         },
     :valid? => boolean(),
     :validations => Keyword.t()
   }}
2024-01-27 14:29:48 -05:00
Mark Felder
5c08153fc5 Pleroma.Gun.ConnectionPool.Reclaimer: dialyzer error
lib/pleroma/gun/connection_pool/reclaimer.ex:12:call
The function call will not succeed.

:gen_server.start(Pleroma.Gun.ConnectionPool.Reclaimer, [], [
  {:name, {:via, Registry, {Pleroma.Gun.ConnectionPool, <<_::72>>}}},
  ...
])

will never return since the success typing is:
(atom(), any(), [
  {:debug, [:log | :statistics | :trace | {_, _}]}
  | {:hibernate_after, timeout()}
  | {:spawn_opt, [:link | :monitor | {_, _}]}
  | {:timeout, timeout()}
]) :: :ignore | {:error, _} | {:ok, pid() | {pid(), reference()}}

and the contract is
(Module :: module(), Args :: term(), Options :: [start_opt()]) :: start_ret()
2024-01-27 14:25:16 -05:00
Mark Felder
9f357d88c2 Pleroma.Emoji: dialyzer error
lib/pleroma/emoji.ex:54:unknown_type
Unknown type: Emoji.t/0.
2024-01-27 14:00:17 -05:00
Mark Felder
948d5a93a0 Pleroma.Object: dialyzer error
lib/pleroma/object.ex:245:call
The function call will not succeed.

Pleroma.Object.cleanup_attachments(any(), %{<<_::48>> => %Pleroma.Object{:data => map(), atom() => _}})

breaks the contract
(boolean(), %{:object => map()}) :: {:ok, Oban.Job.t() | nil}
2024-01-27 13:58:50 -05:00
Mark Felder
2062e126f1 Pleroma.Web.ActivityPub.Builder: fix dialyzer error
lib/pleroma/web/activity_pub/builder.ex:115:pattern_match
The pattern can never match the type.

Pattern:
_emojo = %{:file => _path}

Type:
nil | binary()
2024-01-27 10:41:09 -05:00
Mark Felder
3fbe8ada93 Pleroma.ReverseProxy: dialyzer errors
lib/pleroma/reverse_proxy.ex:225:pattern_match
The pattern can never match the type.

Pattern:
:done

Type:
{:ok, :no_duration_limit, :no_duration_limit}

lib/pleroma/reverse_proxy.ex:226:pattern_match
The pattern can never match the type.

Pattern:
{:error, _error}

Type:
{:ok, :no_duration_limit, :no_duration_limit}

lib/pleroma/reverse_proxy.ex:391:pattern_match
The pattern can never match the type.

Pattern:
__duration = nil, _max

Type:
integer(), _
2024-01-27 10:28:49 -05:00
feld
b1659b7755 Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer fixes

See merge request pleroma/pleroma!4047
2024-01-27 15:09:54 +00:00
Mark Felder
6fcecbd48b Formatting 2024-01-27 10:09:20 -05:00
Mark Felder
7d7662277c Changelog 2024-01-26 21:05:43 -05:00
Mark Felder
b2ab479488 Pleroma.Helpers.QtFastStart: Dialzyer error
lib/pleroma/helpers/qt_fast_start.ex:129:improper_list_constr
List construction (cons) will produce an improper list, because its second argument is <<_::32>>.

lib/pleroma/helpers/qt_fast_start.ex:129:improper_list_constr
List construction (cons) will produce an improper list, because its second argument is <<_::64>>.
2024-01-26 21:03:41 -05:00
Mark Felder
6e0945354d Pleroma.ModerationLog: fix invalid type 2024-01-26 21:03:41 -05:00
Mark Felder
e834343496 Pleroma.Search.SearchBackend: dialyzer error
Incorrect spec. Both search backends return :ok so that is what should be the spec.

lib/pleroma/search/database_search.ex:56:callback_type_mismatch
Type mismatch for @callback remove_from_index/1 in Pleroma.Search.SearchBackend behaviour.

Expected type:
{:error, _} | {:ok, _}

Actual type:
:ok
2024-01-26 21:03:41 -05:00
Mark Felder
1b40ebfa20 Pleroma.Signature: dialyzer error
lib/pleroma/signature.ex:30:pattern_match
The pattern can never match the type.

Pattern:
%{<<97, 112, 95, 105, 100>> => _ap_id}

Type:
{:error, _} | {:ok, map()}
2024-01-26 21:03:41 -05:00
Mark Felder
87cf7010fc Pleroma.Upload: dialyzer error
I have opted to set this to :upper as this retains the same behavior but clears up the error.

lib/pleroma/upload.ex:178:call
The function call will not succeed.

Base.encode16(binary(), [{:lower, true}])

breaks the contract
(binary(), [{:case, encode_case()}]) :: binary()
2024-01-26 21:03:23 -05:00
Mark Felder
06b8923d42 RichMedia.Parser.TTL.AwsSignedUrl: dialyzer fix
lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex:9:callback_type_mismatch
Type mismatch for @callback ttl/2 in Pleroma.Web.RichMedia.Parser.TTL behaviour.

Expected type:
nil | integer()

Actual type:
{:error, <<_::64, _::size(8)>>} | {:ok, integer()}
2024-01-26 17:37:32 -05:00
Mark Felder
28af5e3bd7 TwitterAPI.UtilController: fix dialyzer errors
lib/pleroma/web/twitter_api/controllers/util_controller.ex:300:pattern_match
The pattern can never match the type.

Pattern:
{:error, :no_such_alias}

Type:
{:not_found, nil}

lib/pleroma/web/twitter_api/controllers/util_controller.ex:304:pattern_match
The pattern can never match the type.

Pattern:
{:error, _error}

Type:
{:not_found, nil}
2024-01-26 17:22:27 -05:00
Mark Felder
5b95abaeea Credo.Check.Readability.PredicateFunctionNames
This check was recently improved in Credo and it does make sense for readability.

The offending functions in Pleroma have been renamed and a couple missing the ? suffix have been fixed as well.
2024-01-26 16:59:58 -05:00
Mark Felder
18d38486a5 InetCidr.parse/2 is deprecated 2024-01-26 15:57:50 -05:00
Haelwenn (lanodan) Monnier
5c5d9d9b9d Bump dependencies 2024-01-26 15:50:45 -05:00
feld
a24322fcce Merge branch 'elixir-1.15-base' into 'develop'
CI: pin 1.15 to otp25

See merge request pleroma/pleroma!4046
2024-01-26 17:40:38 +00:00
Mark Felder
a658cf70b9 Pin to otp25
The 1.15.7 image by default uses OTP26 now, but we really want otp25
2024-01-26 17:38:40 +00:00
feld
6bd29956f5 Merge branch 'elixir-1.15-base' into 'develop'
CI: set correct image version for Elixir 1.15

See merge request pleroma/pleroma!4045
2024-01-26 17:35:49 +00:00
Mark Felder
f23c07f43a Set correct image version 2024-01-26 12:35:18 -05:00
Haelwenn (lanodan) Monnier
799891d359
Transmogrifier: Cleanup obsolete handling of "contentMap": null 2024-01-26 17:10:10 +01:00
Haelwenn (lanodan) Monnier
558b421079
Test incoming federation from Convergence AP Bridge 2024-01-26 17:05:18 +01:00
Haelwenn (lanodan) Monnier
acef2a4a40
CommonFixes: Use Maps.filter_empty_values on fix_object_defaults 2024-01-26 16:19:25 +01:00
Haelwenn (lanodan) Monnier
0de1a7629c
Maps: Add filter_empty_values/1 2024-01-26 16:18:29 +01:00
feld
626c22961f Merge branch 'dialyzer-fixes' into 'develop'
More dialyzer fixes

See merge request pleroma/pleroma!4042
2024-01-23 00:16:55 +00:00
Mark Felder
3a8594e927 MastodonAPI.Controller.StatusController: fix dialyzer error
lib/pleroma/web/mastodon_api/controllers/status_controller.ex:333:pattern_match
The pattern can never match the type.

Pattern:
{:ok, _activity}

Type:
{:error, _}
2024-01-22 18:37:29 -05:00
Mark Felder
138b3cb608 Clear up missing function dialyzer errors for :eldap 2024-01-22 18:37:29 -05:00
Mark Felder
115b2ad638 MRF.KeywordPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/keyword_policy.ex:13:neg_guard_fail
Guard test:
not is_binary(_string :: binary())

can never succeed.
2024-01-22 18:37:29 -05:00
Mark Felder
0dd65246ea MRF.HashtagPolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex:87:exact_eq
The test <<_::32>> == <<_::48>> can never evaluate to 'true'.
2024-01-22 18:37:19 -05:00
Mark Felder
5f71928f6b MRF.InlineQuotePolicy: fix dialyzer error
lib/pleroma/web/activity_pub/mrf/inline_quote_policy.ex:60:callback_type_mismatch
Type mismatch for @callback config_description/0 in Pleroma.Web.ActivityPub.MRF.Policy behaviour.

Expected type:
%{
  :description => binary(),
  :key => atom(),
  :label => binary(),
  :related_policy => binary(),
  :children => [map()]
}

Actual type:
%{
  :children => [
    %{
      :description => <<_::808>>,
      :key => :template,
      :suggestions => [any(), ...],
      :type => :string
    },
    ...
  ],
  :description => <<_::336>>,
  :key => :mrf_inline_quote,
  :label => <<_::184>>,
  :related_policy => <<_::360>>,
  :type => :group
}
2024-01-22 18:37:13 -05:00
Mark Felder
a7fa6f18dc Pleroma.Migrators.Support.BaseMigrator: Fix dialyzer errors
lib/pleroma/migrators/context_objects_deletion_migrator.ex:13:exact_eq
The test :error | float() == 0 can never evaluate to 'true'.

lib/pleroma/migrators/hashtags_table_migrator.ex:13:exact_eq
The test :error | float() == 0 can never evaluate to 'true'.
2024-01-22 18:37:13 -05:00
Mark Felder
6ce7011a2e Pleroma.Gun.ConnectionPool.WorkerSupervisor: fix dialyzer error
lib/pleroma/gun/connection_pool/worker_supervisor.ex:24:guard_fail
The guard clause:

when _ :: true === nil

can never succeed.
2024-01-22 18:37:13 -05:00
Mark Felder
65d49ac090 Pleroma.HTTP.AdapterHelper: fix dialyzer errors
lib/pleroma/http/adapter_helper.ex:18:unknown_type
Unknown type: Connection.host/0.

lib/pleroma/http/adapter_helper.ex:19:unknown_type
Unknown type: Connection.host/0.

lib/pleroma/http/adapter_helper.ex:19:unknown_type
Unknown type: Connection.proxy_type/0.
2024-01-22 18:37:13 -05:00
Mark Felder
c74c5f479a Pleroma.Migrators.Support.BaseMigratorState: fix dialyzer error
lib/pleroma/migrators/support/base_migrator_state.ex:10:unknown_type
Unknown type: Pleroma.DataMigration.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
36355d3ed9 Pleroma.Web.ActivityPub.Builder: fix dialyzer error
lib/pleroma/web/activity_pub/builder.ex:205:unknown_type
Unknown type: Pleroma.Web.CommonAPI.ActivityDraft.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
39da451b6d Pleroma.Web.ActivityPub.Builder: fix dialyzer errors
lib/pleroma/web/activity_pub/builder.ex:35:unknown_type
Unknown type: Activity.t/0.

lib/pleroma/web/activity_pub/builder.ex:40:unknown_type
Unknown type: Activity.t/0.

lib/pleroma/web/activity_pub/builder.ex:144:unknown_type
Unknown type: Activity.t/0.
________________________________________________________________________________
lib/pleroma/web/activity_pub/builder.ex:204:unknown_type
Unknown type: Pleroma.Web.CommonAPI.ActivityDraft.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
10f3a2833f Pleroma.User.Query: fix dialyzer error
lib/pleroma/user/query.ex:74:unknown_type
Unknown type: Query.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
40feac086f Pleroma.User: fix dialyzer errors
lib/pleroma/user.ex:1514:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.

lib/pleroma/user.ex:2629:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.

lib/pleroma/user.ex:2638:unknown_type
Unknown type: Pleroma.UserRelationship.t/0.
2024-01-22 18:37:13 -05:00
Mark Felder
1361856213 Pleroma.User.Backup: fix some dialyzer errors
lib/pleroma/user/backup.ex:207:call
The function call will not succeed.

:zip.create(
  string(),
  [:"\"actor.json\"", :"\"outbox.json\"", :"\"likes.json\"", :"\"bookmarks.json\""],
  [{:cwd, binary()}, ...]
)

will never return since the success typing is:
(
  atom() | [atom() | [any()] | char()],
  [
    atom()
    | [atom() | [any()] | char()]
    | {atom() | [atom() | [any()] | char()], binary()}
    | {atom() | [atom() | [any()] | char()], binary(),
       {:file_info, :undefined | non_neg_integer(),
        :device | :directory | :other | :regular | :symlink | :undefined,
        :none | :read | :read_write | :undefined | :write,
        :undefined | non_neg_integer() | {_, _}, :undefined | non_neg_integer() | {_, _},
        :undefined | non_neg_integer() | {_, _}, :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer(),
        :undefined | non_neg_integer(), :undefined | non_neg_integer()}}
  ],
  [
    :cooked
    | :memory
    | :verbose
    | {:comment, string()}
    | {:compress, :all | [[any()]] | {:add, [any()]} | {:del, [any()]}}
    | {:cwd, string()}
    | {:uncompress, :all | [[any()]] | {:add, [any()]} | {:del, [any()]}}
  ]
) ::
  {:error, _}
  | {:ok,
     atom() | [atom() | [any()] | char()] | {atom() | [atom() | [any()] | char()], binary()}}

and the contract is
(name, fileList, options) :: retValue
when name: :file.name(),
     fileList: [:FileSpec],
     fileSpec:
       :file.name() | {:file.name(), binary()} | {:file.name(), binary(), :file.file_info()},
     options: [:Option],
     option: create_option(),
     retValue:
       {:ok, FileName :: filename()}
       | {:ok, {FileName :: filename(), binary()}}
       | {:error, Reason :: term()}
2024-01-22 18:37:13 -05:00
Mark Felder
bff47479a7 Exile: fix for MacOS dev environments 2024-01-22 18:37:13 -05:00
Mark Felder
38ebefce9c Announcement: fix dialyzer errors and add typespec for the changeset
It was possible for this to raise (no_local_return) because the data key could be missing from the params
2024-01-22 18:37:13 -05:00
Mark Felder
eb4dd50f53 Use config to control inclusion of test emoji 2024-01-22 18:37:13 -05:00
Mark Felder
6df93e61c4 Use config to determine sending to the streamer registry instead of MIX_ENV compile time function definition 2024-01-22 18:37:13 -05:00
Mark Felder
653b14e1c7 Use config to control Uploader callback timeout 2024-01-22 18:37:13 -05:00
Mark Felder
8efae57d67 Dialyzer: suppress Mix.Task errors
Callback info about the 'Elixir.Mix.Task' behaviour is not available.
2024-01-22 18:37:13 -05:00
feld
f7b3681eb0 Merge branch 'exile-macos' into 'develop'
Exile: fix for MacOS dev environments

See merge request pleroma/pleroma!4041
2024-01-22 21:11:38 +00:00
Mark Felder
1632a3fec9 Exile: fix for MacOS dev environments 2024-01-22 15:35:12 -05:00
feld
d802e65cd3 Merge branch 'exile-bsds' into 'develop'
Exile: switch to fork with BSD compile fix

See merge request pleroma/pleroma!4040
2024-01-22 18:59:59 +00:00
Mark Felder
fff235433e Exile: switch to fork with BSD compile fix 2024-01-22 13:44:20 -05:00
lain
52aadc09e9 Merge branch 'exile' into 'develop'
Replace custom fifo implementation with Exile

See merge request pleroma/pleroma!4039
2024-01-22 16:49:30 +00:00
Mark Felder
0ac010ba3f Replace custom fifo implementation with Exile
This is for streaming media to ffmpeg thumbnailer. The existing implementation relies on undocumented behavior.

Erlang open_port/2 does not officially support passing a string of a file path for opening. The specs clearly state you are to provide one of the following for open_port/2:

    {spawn, Command :: string() | binary()} |
    {spawn_driver, Command :: string() | binary()} |
    {spawn_executable, FileName :: file:name_all()} |
    {fd, In :: integer() >= 0, Out :: integer() >= 0}

Our method technically works but is strongly discouraged as it can block the scheduler and dialyzer throws errors as it recognizes we're breaking the contract and some of the functions we wrote may never return.

This is indirectly covered by the Erlang FAQ section "9.12 Why can't I open devices (e.g. a serial port) like normal files?"
https://www.erlang.org/faq/problems#idm1127
2024-01-22 10:13:17 -05:00
marcin mikołajczak
def088ce52 format
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-21 18:23:24 +01:00
Haelwenn
ab3f03a04a Merge branch 'develop' into 'public-polls'
# Conflicts:
#   docs/development/API/differences_in_mastoapi_responses.md
2024-01-21 12:03:29 +00:00
feld
548434f85c Merge branch 'new-pipelines' into 'develop'
Fix testing cache policy, really.

See merge request pleroma/pleroma!4038
2024-01-21 04:36:24 +00:00
Mark Felder
951a82f2d7 Fix testing cache policy 2024-01-21 04:35:31 +00:00
feld
12b689a81e Merge branch 'new-pipelines' into 'develop'
Fix testing cache policy

See merge request pleroma/pleroma!4037
2024-01-21 04:34:06 +00:00
Mark Felder
badd7654fd Fix testing cache policy 2024-01-21 04:29:13 +00:00
feld
931fa4cb78 Merge branch 'new-pipelines' into 'develop'
New CI pipelines

See merge request pleroma/pleroma!4036
2024-01-21 04:17:51 +00:00
Mark Felder
518ddd458c Clarify formatting and cycles versions 2024-01-21 04:14:41 +00:00
Mark Felder
8f0051d739 Rename 1.15 image to include otp25, clarify test names 2024-01-21 04:10:20 +00:00
Mark Felder
058fa5471a Fix the image name 2024-01-21 04:06:17 +00:00
Mark Felder
aee971bd26 Only need amd64 for now 2024-01-21 03:59:26 +00:00
Mark Felder
06813d4a0e Reorganize ci scripts 2024-01-21 03:58:53 +00:00
Mark Felder
68f421c203 Use our own 1.15 ci-base image 2024-01-20 22:53:07 -05:00
Mark Felder
1790400313 Add Dialyxir with manual job execution 2024-01-20 22:49:37 -05:00
Mark Felder
06ac829eb4 Spec building should be in build stage 2024-01-20 22:45:29 -05:00
Mark Felder
df31ec0d52 Linting as a separate stage 2024-01-20 22:43:41 -05:00
Mark Felder
a0518a4ee1 Add a build and test pipeline for elixir 1.15 with a new naming convention 2024-01-20 22:37:38 -05:00
feld
1edfce4322 Merge branch 'dialyzer-fixes' into 'develop'
Dialyzer fixes

See merge request pleroma/pleroma!4035
2024-01-21 00:54:25 +00:00
Mark Felder
dcd0102800 Credo 2024-01-20 19:39:13 -05:00
Mark Felder
cca9d6aeaa Dialyzer fixes 2024-01-20 19:29:29 -05:00
Mark Felder
2330100371 Use config to control starting all HTTP pools in test env 2024-01-20 19:10:57 -05:00
Mark Felder
17877f612e Use config to control streamer registry 2024-01-20 18:51:20 -05:00
Mark Felder
4bb57d4f25 Use config to control background migrators 2024-01-20 18:47:25 -05:00
Mark Felder
c7eda0b24a Use config to control loading of custom modules 2024-01-20 18:43:53 -05:00
Mark Felder
029aaf3d74 Use config to control max_restarts 2024-01-20 18:41:04 -05:00
Mark Felder
65ac513776 Dialyzer: fix pattern match coverage 2024-01-20 17:58:47 -05:00
Mark Felder
88042109a3 Dialyzer: fix pattern match coverage 2024-01-20 17:56:32 -05:00
Mark Felder
7f649a7a19 Dialyzer: remove function that will never match 2024-01-20 17:50:21 -05:00
Mark Felder
2fbb67add7 Fix typo in typespec 2024-01-20 17:48:12 -05:00
Mark Felder
ea26add540 Fix incorrect type definition for maybe_direct_follow/2 2024-01-20 17:43:34 -05:00
Mark Felder
38d01ff511 Fix invalid types 2024-01-20 17:37:27 -05:00
Mark Felder
83eece7764 Fix invalid type
lib/pleroma/web/auth/authenticator.ex:8:unknown_type
Unknown type: User.t/0.
2024-01-20 17:33:37 -05:00
Mark Felder
4f07116108 Fix invalid type
lib/pleroma/web/activity_pub/publisher.ex:31:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:32:19 -05:00
Mark Felder
ec5ae83da6 Fix invalid types
lib/pleroma/web/activity_pub/mrf/policy.ex:6:unknown_type
Unknown type: Map.t/0.

lib/pleroma/web/activity_pub/mrf/policy.ex:7:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:31:07 -05:00
Mark Felder
2061a1d917 Fix invalid type
lib/pleroma/uploaders/uploader.ex:43:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:29:27 -05:00
Mark Felder
551e90cd52 Fix invalid type
lib/pleroma/upload.ex:89:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:28:54 -05:00
Mark Felder
f050a75b92 Fix invalid types due to typos
lib/pleroma/web/feed/feed_view.ex:135:unknown_type
Unknown type: NativeDateTime.t/0.

lib/pleroma/web/feed/feed_view.ex:148:unknown_type
Unknown type: NativeDateTime.t/0.
2024-01-20 17:22:40 -05:00
Mark Felder
e5120a2703 Fix invalid type due to typos
lib/pleroma/web/o_auth/authorization.ex:61:unknown_type
Unknown type: Authtorizatiton.t/0.
2024-01-20 17:21:12 -05:00
Mark Felder
65dfaa6cb9 Fix invalid type due to late aliasing
lib/pleroma/web/o_auth/token/query.ex:12:unknown_type
Unknown type: Token.t/0.
2024-01-20 17:18:16 -05:00
Mark Felder
09ae0ab24a Fix invalid type
lib/pleroma/web/rich_media/parser.ex:105:unknown_type
Unknown type: Integer.t/0.
2024-01-20 17:16:10 -05:00
Mark Felder
467a65af90 Fix invalid types
lib/pleroma/web/rich_media/parser/ttl.ex:6:unknown_type
Unknown type: Integer.t/0.

lib/pleroma/web/rich_media/parser/ttl.ex:6:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:14:56 -05:00
Mark Felder
e3f52ee13f Fix invalid types
lib/pleroma/web/streamer.ex:37:unknown_type
Unknown type: Map.t/0.
________________________________________________________________________________
lib/pleroma/web/streamer.ex:63:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:14:10 -05:00
Mark Felder
593c7e26d4 Fix invalid type
lib/pleroma/migrators/hashtags_table_migrator.ex:103:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:13:27 -05:00
Mark Felder
559aeb5dd0 Add missing type Pleroma.Emoji.t()
lib/pleroma/emoji/loader.ex:23:unknown_type
Unknown type: Pleroma.Emoji.t/0.
2024-01-20 17:08:18 -05:00
Mark Felder
8ed506a370 Fix invalid type
lib/pleroma/docs/json.ex:21:unknown_type
Unknown type: Map.t/0.
2024-01-20 17:05:55 -05:00
Mark Felder
0b7d214211 Fix invalid typespec references to Ecto.Changeset.t() 2024-01-20 16:47:50 -05:00
Mark Felder
dc8045d766 FlakeId.Ecto.CompatType.t() does not exist
This type is not exported and usable. FlakeId intends to return the type as :uuid, so we replace it in the typespecs with Ecto.UUID.t() which assuages the dialyzer errors

e.g.,

lib/pleroma/bookmark.ex:25:unknown_type
Unknown type: FlakeId.Ecto.CompatType.t/0.
2024-01-20 16:36:01 -05:00
Mark Felder
b16a01ba9d Pleroma.ApplicationRequirements: fix dialyzer errors
lib/pleroma/application_requirements.ex:19:unknown_type
Unknown type: Pleroma.ApplicationRequirements.VerifyError.t/0.

lib/pleroma/application_requirements.ex:199:pattern_match_cov
The pattern
variable_result

can never match, because previous clauses completely cover the type
:ok.
2024-01-20 16:10:11 -05:00
Mark Felder
df1d390a49 Pleroma.Activity.Queries: fix dialyzer error
lib/pleroma/activity/queries.ex:12:unknown_type
Unknown type: Activity.t/0.
2024-01-20 16:01:32 -05:00
Mark Felder
2a28377be0 Fix mix task pleroma.instance dialyzer error
lib/mix/tasks/pleroma/instance.ex:356:pattern_match_cov
The pattern
:variable_

can never match, because previous clauses completely cover the type
%{
  :anonymize => boolean(),
  :dedupe => boolean(),
  :read_description => boolean(),
  :strip_location => boolean()
}.
2024-01-20 15:55:33 -05:00
Haelwenn
a5f64ffd0c Apply lanodan’s suggestion to 1 file 2024-01-19 21:28:15 +00:00
Haelwenn
3c65a2899d Merge branch 'handle_object_fetch_failures' into 'develop'
Handle object fetch failures gracefully

See merge request pleroma/pleroma!4015
2024-01-19 18:43:00 +00:00
marcin mikołajczak
fa02a1e634 Update MastoAPI responses docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-19 18:05:50 +01:00
marcin mikołajczak
90b442727e Update Admin API docs
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-19 17:53:37 +01:00
Haelwenn
81a13b4b9e Merge branch 'api-docs' into 'develop'
Update API docs for my changes

See merge request pleroma/pleroma!4033
2024-01-18 02:19:58 +00:00
marcin mikołajczak
b39403a48f Update API docs for my changes
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-01-17 17:13:21 +01:00
Haelwenn
4c20713ecd Merge branch 'otp26' into 'develop'
OTP26 support

See merge request pleroma/pleroma!4025
2024-01-17 09:51:56 +00:00
Haelwenn
355487041a We are unsure if OTP27 will bring more breaking changes 2024-01-16 11:22:34 -05:00
Mark Felder
e44f6a2ab3 Skip tests on MacOS/Darwin that have always failed 2024-01-15 20:18:43 -05:00
Mark Felder
012ab87605 Pleroma.Web.MastodonAPI.SubscriptionControllerTest: disable async and use on_exit/1 to ensure web push config gets restored 2024-01-16 00:59:44 +00:00
Mark Felder
ad363c62c3 Fix StatusController test by using the get_query_parameter/2 helper to reliably retrieve the max_id value 2024-01-15 17:32:57 -05:00
Mark Felder
8bd8ee03c2 Add Pleroma.Test.Helpers.get_query_parameter/2 to retrieve specific query parameter values 2024-01-15 17:32:15 -05:00
Mark Felder
4cbf11d32c Fix ChatController tests validating prev/next URLs by sorting the query parameters before comparison 2024-01-15 17:12:06 -05:00
Mark Felder
e7c6410192 Add Pleroma.Support.Helpers.uri_query_sort/1 for easy sorting of a URL's query parameters 2024-01-15 17:08:24 -05:00
Haelwenn
9b39bc6aa8 Merge branch 'mrf-regex-error' into 'develop'
MRF: Log sensible regex error for subdomain_match

See merge request pleroma/pleroma!4026
2024-01-15 08:24:54 +00:00
Haelwenn
c29430b018 Merge branch 'mrf-steal-emoji-extname' into 'develop'
MRF.StealEmojiPolicy: Properly add fallback extension to filenames missing one

See merge request pleroma/pleroma!4029
2024-01-15 08:24:24 +00:00
Mark Felder
12c052551b Allow the Remote Fetcher to attempt fetching an unreachable instance 2024-01-14 14:05:43 -05:00
tusooa
d3a4f5b7d7 Merge branch 'nil-contentMap' into 'develop'
Support objects with a nil contentMap (firefish)

Closes #3231

See merge request pleroma/pleroma!4030
2024-01-13 22:23:21 +00:00
feld
9cc46c5538 Merge branch 'qtfaststart-fix' into 'develop'
Fix MediaProxy crashing on some videos

See merge request pleroma/pleroma!4024
2024-01-13 04:35:32 +00:00
feld
d4b889783c Merge branch 'fix-duplicate-inbox-deliveries' into 'develop'
Fix duplicate inbox deliveries

See merge request pleroma/pleroma!4031
2024-01-11 20:21:57 +00:00
Mint
379d7fafd5 Merge branch 'use-shared-inbox-test' of pleromergit:pleroma/pleroma into fix-duplicate-inbox-deliveries 2024-01-11 23:10:40 +03:00
Mark Felder
dcb2b1413b Add test to validate shared inboxes are used when multiple recipients from the same instance are recipients 2024-01-11 15:05:15 -05:00
Mint
3c30eadd5e Fix duplicate inbox deliveries 2024-01-11 20:48:35 +03:00
Haelwenn (lanodan) Monnier
7651198508 Support objects with a nil contentMap (firefish)
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3231
2024-01-11 07:16:45 +01:00
tusooa
8bc59e9743 Merge branch 'emoji-use-v1-api' into 'develop'
Make remote emoji packs API use specifically the V1 URL

See merge request pleroma/pleroma!4028
2024-01-10 01:26:46 +00:00
Haelwenn (lanodan) Monnier
4ca65c6182 MRF.StealEmojiPolicy: Properly add fallback extension to filenames missing one 2024-01-07 19:37:35 +01:00
Ekaterina Vaartis
6a55b680a3 Fix tests 2024-01-07 17:49:08 +03:00
Ekaterina Vaartis
29158681f9 Fetch count before downloading the pack and use that as page size 2024-01-07 17:07:50 +03:00
Ekaterina Vaartis
69e4ebbb8e Make remote emoji packs API use specifically the V1 URL
Akkoma does not understand it without V1, and it works either way with
normal pleroma, so no reason to not do this
2024-01-07 15:30:52 +03:00
Haelwenn
67a5542a73 Merge branch 'fix-account-auth-check' into 'develop'
Fix authentication check on account rendering when bio is defined

See merge request pleroma/pleroma!4027
2024-01-05 00:45:29 +00:00
Alexander Tumin
32d8e0d496 Fix authentication check on account rendering when bio is defined 2024-01-04 16:57:48 +03:00
Haelwenn (lanodan) Monnier
6af49270a9 MRF: Log sensible error for subdomains_regex 2024-01-02 15:37:41 +01:00
Lain Soykaf
fc910f9bb9 Linting 2023-12-30 11:45:16 +04:00
Lain Soykaf
8883fa326a Mix: Update http_signatures version 2023-12-30 11:44:23 +04:00
Mark Felder
c6acd2abb3 Revert grammar leak from bad merge 2023-12-29 23:31:48 -05:00
Mark Felder
63a74f7b6d Support for Erlang OTP 26 2023-12-29 23:22:31 -05:00
Mark Felder
04366492b2 ConfigDB export to file does not have a consistent order.
Just test a few values to prove it was written
2023-12-29 23:18:45 -05:00
Mark Felder
1b5168ae02 Phoenix detects the webfinger requests with content-type application/jrd+json as "jrd" now 2023-12-29 23:18:45 -05:00
Mark Felder
347e5f33c7 Fix regex string match due to OTP26 key order change
OTP25:
"<http://localhost:4001/api/v1/favourites?limit=1&max_id=Ad1FhzPIS7gcHjUcoC&offset=0>; rel=\"next\""

OTP26:
"<http://localhost:4001/api/v1/favourites?offset=0&limit=1&max_id=Ad1FmOIAXiSNgygflA>; rel=\"next\""
2023-12-29 23:18:45 -05:00
Mark Felder
0820c23988 Fix Chat controller tests failing due to OTP26 key order change 2023-12-29 23:18:45 -05:00
Mark Felder
d4dd21303a Remove call to Pleroma.Web.Endpoint.config_change/2
This is not necessary for the tests to pass and breaks other tests as this change doesn't get cleanly reverted causing the hostname to stay set this way and leak into other test causing failures with "sub.example.com" not matching "localhost"
2023-12-29 22:51:40 -05:00
Mark Felder
36b3867787 Fix test "transforms config to tuples"
This should have never worked. The default empty values for the other MRF Simple options will always be there.
2023-12-29 22:50:26 -05:00
Mark Felder
b51ba39dd1 Update Floki to get the :attributes_as_maps feature to allow us to compare equality of parsed documents without issues of key ordering 2023-12-29 22:50:26 -05:00
Mark Felder
e121e06214 Implement a custom uri_equal?/2 to fix comparisons of URLs with unordered query parameters 2023-12-29 22:50:26 -05:00
Mark Felder
e7d6b835ae Fix tests by leveraging Keyword.equal?/2 2023-12-29 22:50:26 -05:00
Haelwenn
f74f5e0a56 Merge branch 'publisher' into 'develop'
Discard some failed publisher jobs

See merge request pleroma/pleroma!4022
2023-12-29 23:18:34 +00:00
Mark Felder
50edef5bc1 Change QTFastStart to recover gracefully if it encounters an error during bitstring matching
This fixes issues with internal errors when trying to serve the video
2023-12-29 14:12:44 -05:00
Mark Felder
833117f573 Fix tests
Need to handle the edge case of no valid HTTP response which has no status code
2023-12-29 13:04:06 -05:00
feld
8ac4458630 Merge branch 'finch-redirects' into 'develop'
Fix following redirects with Finch

See merge request pleroma/pleroma!4023
2023-12-29 17:00:58 +00:00
lain
a6fc97ffec Merge branch 'bugfix/chat-attachment-empty-array' into 'develop'
ChatMessage: Tolerate attachment field set to an empty array

Closes #3224

See merge request pleroma/pleroma!4020
2023-12-29 08:12:27 +00:00
Mark Felder
4afe211e50 Return the full tuple from Tesla 2023-12-29 01:04:05 -05:00
Mark Felder
2950397d47 Fix following redirects with Finch 2023-12-29 00:50:50 -05:00
Mark Felder
141702538b Discard on a 404 as well 2023-12-29 00:31:05 -05:00
Mark Felder
7ebca7ecfa Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410 2023-12-29 00:25:33 -05:00
Mark Felder
77949d4590 Make the Publisher log error less noisy 2023-12-29 00:25:11 -05:00
Mark Felder
f17f92105b Oban jobs should be discarded on permanent errors 2023-12-28 23:52:59 -05:00
feld
3954dfd4f1 Merge branch 'remove-multiple-federator-modules' into 'develop'
Fix the Federator perform/2 Oban callback

See merge request pleroma/pleroma!4021
2023-12-29 04:33:45 +00:00
Haelwenn (lanodan) Monnier
39dc6c65ef ChatMessage: Tolerate attachment field set to an empty array
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3224
2023-12-29 05:32:47 +01:00
Mark Felder
d519a535e1 Changelog 2023-12-28 23:32:21 -05:00
Mark Felder
aa070c7daf Handle 401s as I have observed it in the wild 2023-12-28 23:09:33 -05:00
Mark Felder
efd50759d5 Log errors when publishing activities 2023-12-28 22:59:27 -05:00
Mark Felder
08ba9a15b2 Fix the Federator perform/2 Oban callback 2023-12-28 22:51:47 -05:00
Haelwenn
7f3a83d3ed Merge branch 'remove-multiple-federator-modules' into 'develop'
Remove support for multiple federation publisher modules

See merge request pleroma/pleroma!4019
2023-12-29 03:35:24 +00:00
Mark Felder
ddb9e90c40 Update minimum elixir version found in various docs 2023-12-28 15:59:25 -05:00
Mark Felder
013f7c4f8f Changelog 2023-12-28 14:55:26 -05:00
Mark Felder
e35fa60d8a Remove reference to the :federation_publisher_modules setting in our config test 2023-12-28 14:53:40 -05:00
Mark Felder
3acfdb6f8a Retire the Pleroma.Web.Federator.Publisher module 2023-12-28 14:53:09 -05:00
Mark Felder
1d816222e0 Remove support for multiple federation publisher modules
This also unravels some needless indirection.
2023-12-28 11:55:19 -05:00
Haelwenn
ddc321a094 Merge branch 'tusooa/3205-group-actor' into 'develop'
Implement group actors

See merge request pleroma/pleroma!3969
2023-12-28 10:46:53 +00:00
Haelwenn
81ce04990e Merge branch 'typo' into 'develop'
Fix some typos

See merge request pleroma/pleroma!4017
2023-12-28 10:02:17 +00:00
Mark Felder
a6fd251e44 Improve test descriptions 2023-12-27 22:37:06 -05:00
Mark Felder
ad0a5deb67 Prevent requeuing Remote Fetcher jobs that exceed thread depth 2023-12-27 22:28:41 -05:00
Mark Felder
a2708f7fe3 Leverage existing atoms as return errors for the object fetcher 2023-12-27 22:01:59 -05:00
Mark Felder
287f2c9719 Formatting 2023-12-27 21:55:07 -05:00
Mark Felder
882267e3ec Remove duplicate log messages from Transmogrifier
Object fetch errors are logged in the fetcher module
2023-12-27 21:39:29 -05:00
Mark Felder
becb070603 Conslidate log messages for object fetcher failures and leverage Logger.metadata 2023-12-27 21:22:51 -05:00
Mark Felder
6c9929b809 Set Logger level to error 2023-12-27 20:18:14 -05:00
marcin mikołajczak
017e35fbf1 Fix some more typos
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-28 00:17:04 +01:00
marcin mikołajczak
f53197c82a Fix operation name typo
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-27 23:52:46 +01:00
Mark Felder
be0cca9afd RemoteFetcherWorker Oban job tests 2023-12-27 16:08:57 -05:00
Mark Felder
53db65678d Separate files for each distinct sentence in the changelog 2023-12-27 15:44:31 -05:00
Mark Felder
d4c77103d1 Fix detection of user follower collection being private
We were overzealous with matching on a raw error from the object fetch that should have never been relied on like this. If we can't fetch successfully we should assume that the collection is private.

Building a more expressive and universal error struct to match on may be something to consider.
2023-12-27 15:27:39 -05:00
marcin mikołajczak
f6fee39e42 Add changelog
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-27 21:24:20 +01:00
feld
47e00524f7 Merge branch 'instance-defdelegates' into 'develop'
defdelegates for Pleroma.Instances

See merge request pleroma/pleroma!4016
2023-12-27 17:51:52 +00:00
Mark Felder
1a337dcc18 These functions in Pleroma.Instances should be defdelegates to Pleroma.Instances.Instance 2023-12-27 12:44:16 -05:00
tusooa
b273025fd7
Add pleroma:group_actors to instance features 2023-12-27 12:28:11 -05:00
tusooa
e9d2fadd8e
Add changelog for group actors 2023-12-27 12:28:11 -05:00
tusooa
e34a975dd9
Do not boost if group is blocking poster 2023-12-27 12:28:10 -05:00
tusooa
5f5533b88a
Test group actor behaviour in SideEffects 2023-12-27 12:28:10 -05:00
tusooa
5459bbc1ef
Allow group actors to boost posts 2023-12-27 12:28:04 -05:00
tusooa
7a58ddfa48
Allow local user to have group actor type
https://git.pleroma.social/pleroma/pleroma/-/issues/3205
2023-12-27 12:27:37 -05:00
tusooa
40f170f0a7 Merge branch 'webfinger-fix' into 'develop'
Use correct domain for fqn and InstanceView

See merge request pleroma/pleroma!3958
2023-12-27 17:10:32 +00:00
Mark Felder
5f51094138 Update changelog 2023-12-27 11:09:42 -05:00
Mark Felder
73c4c6d7de Revert "Mark instances as unreachable when returning a 403 from an object fetch"
This reverts commit d472bafec1.
2023-12-26 17:20:36 -05:00
Mark Felder
9c0040124a Skip remote fetch jobs for unreachable instances 2023-12-26 16:28:05 -05:00
Mark Felder
5f6966cd9f Remove mistaken duplicate fetch 2023-12-26 16:23:41 -05:00
Mark Felder
c4f0a3b570 Changelogs 2023-12-26 16:08:36 -05:00
Mark Felder
c6b38441f1 Cancel remote fetch jobs for deleted objects 2023-12-26 16:05:44 -05:00
Mark Felder
67dd81e825 Consolidate the HTTP status code checking into the private get_object/1 2023-12-26 16:05:28 -05:00
Mark Felder
d472bafec1 Mark instances as unreachable when returning a 403 from an object fetch
This is a definite sign the instance is blocked and they are enforcing authorized_fetch
2023-12-26 15:54:21 -05:00
Mark Felder
603e9f6a92 Fix Transmogrifier tests
These tests relied on the removed Fetcher.fetch_object_from_id!/2 function injecting the error tuple into a log message with the exact words "Object containment failed."

We will keep this behavior by generating a similar log message, but perhaps this should do a better job of matching on the error tuple returned by Transmogrifier.handle_incoming/1
2023-12-26 14:22:06 -05:00
Mark Felder
ea0ec5fbcf Remove Fetcher.fetch_object_from_id!/2
It was only being called once and can be replaced with a case statement.
2023-12-26 14:20:35 -05:00
marcin mikołajczak
6051715a99 Merge remote-tracking branch 'origin/develop' into instance_rules
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-22 14:34:30 +01:00
marcin mikołajczak
9fc6676d8c Merge remote-tracking branch 'origin/develop' into instance-contact-account
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-22 13:54:44 +01:00
marcin mikołajczak
28e5e65676 Merge remote-tracking branch 'origin/develop' into webfinger-fix
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-22 13:29:56 +01:00
lain
5f1d707367 Merge branch 'bad_inbox_request' into 'develop'
Return a 400 from a bad delivery attempt to the inbox

Closes #2884

See merge request pleroma/pleroma!4009
2023-12-22 11:04:25 +00:00
Haelwenn
bd50892c25 Merge branch 'instance-v2' into 'develop'
Implement api/v2/instance route

See merge request pleroma/pleroma!3939
2023-12-21 21:14:46 +00:00
Mark Felder
7e3bbdded5 Elixir 1.13 is the minimum required version 2023-12-20 23:39:12 +00:00
feld
344c798b4c Merge branch 'fix-otp-comparison' into 'develop'
Fix invalid string comparison for OTP versions and replace with config

See merge request pleroma/pleroma!4013
2023-12-20 23:26:59 +00:00
Mark Felder
928bda2e43 Fix invalid string comparison for OTP versions and replace with config
Old way was wrong for multiple reasons. If we do this as a config value it fixes :slave.start/3 being picked up as a compile warning on OTP26.

Also if we want to do any real clustering we'll need something like this to support OTP25 and older.
2023-12-20 23:13:33 +00:00
marcin mikołajczak
4f2fb8dc5e Use consistent terminology
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-21 00:13:13 +01:00
marcin mikołajczak
39d3df86c8 Use consistent terminology
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-12-21 00:10:30 +01:00
feld
56618873af Merge branch 'deprecations' into 'develop'
More deprecation fixes/cleanup

See merge request pleroma/pleroma!4012
2023-12-20 22:11:35 +00:00
Mark Felder
d9fe41a301 More deprecation fixes 2023-12-20 16:47:58 -05:00
Haelwenn (lanodan) Monnier
1fc53c3077 config/description.exs: Remove quack
Was already removed in f40ccce7e9
2023-12-20 16:24:42 -05:00
Mark Felder
fb3eb6e0a4 Fix more Logger warn -> warning 2023-12-20 16:24:27 -05:00
Mark Felder
2207fafa91 Fix more Logger warn -> warning 2023-12-20 16:24:19 -05:00
Mark Felder
cd3abe0b4c Fix more Logger warn -> warning 2023-12-20 16:23:57 -05:00
feld
cbdd134174 Merge branch 'deprecations' into 'develop'
Deprecations

See merge request pleroma/pleroma!4011
2023-12-20 21:13:35 +00:00
Mark Felder
45150848fb Backwards compatibility for OTP 2023-12-20 15:56:56 -05:00
Mark Felder
3c80c86437 Chase deprecations/warnings for Elixir 1.15 2023-12-20 20:17:25 +00:00
Mark Felder
107f00d93f OTP26: Chase the :slave.start/3 deprecation 2023-12-20 20:16:39 +00:00
Mark Felder
9896b64f54 Elixir 1.15: Chase the Logger.warn deprecation 2023-12-20 20:16:26 +00:00
feld
d72d42f9ce Merge branch 'testsecrets' into 'develop'
Clarify location of test.secret.exs file

See merge request pleroma/pleroma!4010
2023-12-20 19:13:03 +00:00
Mark Felder
bf57fd82bb Clarify location of test.secret.exs file 2023-12-20 14:12:06 -05:00
Mark Felder
f43f33e307 Return a 400 from a bad delivery attempt to the inbox
This stops the backend from generating 500 errors from these events.
2023-12-19 13:56:17 -05:00
feld
99b07c817e Merge branch 'web_push' into 'develop'
Fix Web Push notification delivery

See merge request pleroma/pleroma!4008
2023-12-19 16:19:35 +00:00
Mark Felder
e2066994b1 Fix Web Push notification delivery
Finch does not automatically append header content-type: octet-stream for binary payloads.
2023-12-19 10:56:55 -05:00
Haelwenn
8893a044b3 Merge branch 'priority_activities' into 'develop'
Priority activities

See merge request pleroma/pleroma!4004
2023-12-18 00:49:09 +00:00
Lain Soykaf
c1423ddca3 ActivityPub.Publisher: Filter inboxes 2023-12-17 11:15:58 +04:00
Haelwenn (lanodan) Monnier
086ba59d03 HTTPSignaturePlug: Add :authorized_fetch_mode_exceptions 2023-12-16 19:25:51 +01:00
Lain Soykaf
77bb1bb6c8 Actually write changelog 2023-12-16 21:41:28 +04:00
Haelwenn (lanodan) Monnier
f271ea6e43 Move Plugs.RemoteIP.maybe_add_cidr/1 to InetHelper.parse_cidr/1 2023-12-16 18:23:26 +01:00
Lain Soykaf
a0f70cf7d0 Add changelog 2023-12-16 20:40:51 +04:00
Lain Soykaf
c212fc1dcf User: Ignore non-local users when setting 'last active at' 2023-12-16 20:32:13 +04:00
Lain Soykaf
3fbc80eb58 B ActivityPub.Publisher: Prioritize direct mentions 2023-12-16 20:26:08 +04:00
Haelwenn
147b37b893 Merge branch 'mergeback/2.6.1' into 'develop'
mergeback: 2.6.1

Closes #3194

See merge request pleroma/pleroma!4003
2023-12-16 01:03:37 +00:00
tusooa
f5559f3aff
Skip changelog for 2.6.1 mergeback 2023-12-15 19:45:23 -05:00
tusooa
453cb6a388
Merge remote-tracking branch 'upstream/stable' into mergeback/2.6.1 2023-12-15 19:43:07 -05:00
lain
7622a83973 Merge branch 'service-actor-outbox' into 'develop'
ap userview: add outbox field.

See merge request pleroma/pleroma!4002
2023-12-15 06:22:55 +00:00
Lain Soykaf
766011544a UserViewTest: Add basice service actor test. 2023-12-15 10:01:31 +04:00
Yonle
cb1b52d980 ap userview: add outbox field.
Signed-off-by: Yonle <yonle@lecturify.net>
2023-12-15 09:55:06 +04:00
lain
02acf7c0b3 Merge branch 'fix-develop-tests' into 'develop'
StatusViewTest: Fix tests.

See merge request pleroma/pleroma!3998
2023-12-13 10:05:18 +00:00
Lain Soykaf
1458de92f0 Gitlab CI: Switch to our own docker hub 2023-12-13 13:08:00 +04:00
Lain Soykaf
935dce9a0b Gitlab CI: Update postgres for rum tests. 2023-12-13 12:45:52 +04:00
Lain Soykaf
40fa1099bf StatusViewTest: Fix tests. 2023-12-13 11:19:08 +04:00
lain
29d202e1df Merge branch 'add-opengraph-rich-media-proxy' into 'develop'
Add media proxy to opengraph rich media cards

See merge request pleroma/pleroma!3997
2023-12-13 06:23:16 +00:00
lain
2c560266e9 Merge branch 'no-async-clear-config' into 'develop'
Various test improvements and refactors

See merge request pleroma/pleroma!3991
2023-12-12 15:54:55 +00:00
Lain Soykaf
cca6c20eb6 Revert "EmailTest: use config mock"
This reverts commit dca41cc4a3.
2023-12-12 19:35:19 +04:00
Lain Soykaf
a989b793de Revert "Tests: fix more tests"
This reverts commit 05352330bb.
2023-12-12 19:35:08 +04:00
Alexander Tumin
e7af2addd8 Add media proxy to opengraph rich media cards 2023-12-12 18:32:02 +03:00
Lain Soykaf
877552c6f8 Linting 2023-12-12 19:11:15 +04:00
Lain Soykaf
05352330bb Tests: fix more tests 2023-12-12 19:08:57 +04:00
Lain Soykaf
dca41cc4a3 EmailTest: use config mock 2023-12-12 15:25:52 +04:00
Lain Soykaf
b13820dcd0 Tests: Remove skip_on_mac tag 2023-12-12 14:09:22 +04:00
Lain Soykaf
190120fd79 Tests: More test fixes 2023-12-12 14:03:46 +04:00
Lain Soykaf
00def0875b RichMediaTest: Use mocked config 2023-12-12 13:28:11 +04:00
lain
31a524fb52 Merge branch 'docker-fix-22' into 'develop'
Fix dockerfile compilation.

See merge request pleroma/pleroma!3996
2023-12-12 09:06:11 +00:00
Lain Soykaf
da3d1157e5 Fix dockerfile compilation. 2023-12-12 13:04:53 +04:00
Lain Soykaf
650edb60dc ScheduledActivityControllerTest: Fix tests, make async. 2023-12-12 12:56:07 +04:00
Lain Soykaf
4ba03aa29b MastodonAPITest: Fix tests 2023-12-12 12:55:53 +04:00
Lain Soykaf
22c4d89dbb ScheduledActivity: Use config mocking 2023-12-12 12:48:55 +04:00
Lain Soykaf
8da1fd329d Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into no-async-clear-config 2023-12-12 12:29:22 +04:00
lain
e9d9caa77c Merge branch 'fix-dockerfile' into 'develop'
Dockerfile: Use platform libvips.

See merge request pleroma/pleroma!3995
2023-12-12 08:11:33 +00:00
Lain Soykaf
7371e72e6c Dockerfile: Use platform libvips. 2023-12-12 11:36:34 +04:00
Lain Soykaf
228966e6dd Exiftool.ReadDescription: Remove wrong spec. 2023-12-12 11:09:54 +04:00
Lain Soykaf
18ab36d70c Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into no-async-clear-config 2023-12-12 10:55:19 +04:00
lain
3c89f3cf15 Merge branch 'build-releases-with-provided-libvips-2' into 'develop'
Mix: Update vix.

See merge request pleroma/pleroma!3994
2023-12-12 05:23:24 +00:00
Lain Soykaf
6c5ebcded5 Mix: Update vix. 2023-12-12 08:59:47 +04:00
lain
1d51ae7570 Merge branch 'build-releases-with-provided-libvips-2' into 'develop'
Use version of vix that compiles correctly under arm32

See merge request pleroma/pleroma!3993
2023-12-11 14:40:01 +00:00
Lain Soykaf
8b4a786266 Use version of vix that compiles correctly under arm32 2023-12-11 18:38:27 +04:00
lain
41c02b3d16 Merge branch 'authorize-interaction' into 'develop'
Support /authorize-interaction route used by Mastodon

See merge request pleroma/pleroma!3957
2023-12-11 09:31:18 +00:00
lain
8d4a47bf9e Merge branch 'build-releases-with-provided-libvips-2' into 'develop'
Build releases with provided libvips 2

See merge request pleroma/pleroma!3992
2023-12-11 09:09:25 +00:00
Lain Soykaf
7cf65cfeea Changelog 2023-12-11 12:48:53 +04:00
Lain Soykaf
600364f4fd Gitlab CI: Build using system provided libvips 2023-12-11 12:47:59 +04:00
lain
e7974afd37 Merge branch 'optimistic-inbox' into 'develop'
Optimistic Inbox

See merge request pleroma/pleroma!3989
2023-12-11 07:32:42 +00:00
Lain Soykaf
6be3704bc4 Linting 2023-12-11 11:28:39 +04:00
Lain Soykaf
e4292c94d8 BackupTest: Fix tests 2023-12-11 11:12:02 +04:00
Lain Soykaf
d62b17eb60 UploadMediaPlugTest: Fix tests 2023-12-11 11:06:07 +04:00
Lain Soykaf
dd0cf0371a AttachmentValidatorTest: Fix tests 2023-12-11 11:02:33 +04:00
Lain Soykaf
54c0510d1f Push.ImplTest: Fix tests 2023-12-11 11:01:07 +04:00
Lain Soykaf
dec524e7da BackupViewTest: Fix Tests 2023-12-11 10:54:11 +04:00
Lain Soykaf
82beb4987a MascotControllerTest: Fix tests 2023-12-11 10:49:22 +04:00
Lain Soykaf
f5a2337b37 CommonAPITest: Fix tests 2023-12-11 10:46:26 +04:00
Lain Soykaf
6e448ef239 ActivityPubTest: Fix tests 2023-12-11 10:44:31 +04:00
Lain Soykaf
d19f5d18e9 UpdateCredentialsTest: Fix tests 2023-12-11 10:41:27 +04:00
Lain Soykaf
6a738720ec ChatControllerTest: Fix tests 2023-12-11 10:39:03 +04:00
Lain Soykaf
d3822269ca ObjectTest: Fix tests 2023-12-11 10:37:39 +04:00
Lain Soykaf
e8e74146e8 MastodonAPI.AccountViewTest: Fix tests 2023-12-11 10:33:33 +04:00
Lain Soykaf
50c31cb31b RemoteFollowControllerTest: Fix test 2023-12-11 10:24:44 +04:00
Lain Soykaf
844d0d3147 UploadTest: Fix test 2023-12-11 10:22:35 +04:00
Lain Soykaf
8c0b1fd1d9 MediaProxyControllerTest: Fix tests 2023-12-11 10:16:29 +04:00
Lain Soykaf
b9f135eaf3 FrontendStaticPlugTest: Fix test 2023-12-11 10:07:39 +04:00
Lain Soykaf
60800c0b2b ChatMessageReferenceView: Fix test 2023-12-11 10:05:47 +04:00
Lain Soykaf
42c11466cc MediaProxyWarmingPolicyTest: Fix tests 2023-12-11 10:04:01 +04:00
Lain Soykaf
305c76470f OpenGraphTest: Fix test 2023-12-11 10:01:55 +04:00
Lain Soykaf
5530c7dca4 MediaProxyTest: Fix test 2023-12-11 10:00:15 +04:00
Lain Soykaf
5a95847c5d MediaProxyCacheControllerTest: Fix tests. 2023-12-11 09:54:31 +04:00
Lain Soykaf
2c10843bc4 MediaControllerTest: Fix test. 2023-12-11 09:51:59 +04:00
Lain Soykaf
3cce929eec ChatValidationTest: Fix tests. 2023-12-11 09:43:49 +04:00
Lain Soykaf
90a47ca050 S3 Test: Remove global state dependencies 2023-12-11 09:25:05 +04:00
Mark Felder
c0a50b7c3e User.get_or_fetch_public_key_for_ap_id/1 is no longer required. 2023-12-10 13:24:25 -05:00
Mark Felder
18deea59b4 ActivityPub.make_user_from_ap_id/1 fetches the whole actor object including updating the public key for us 2023-12-10 13:22:55 -05:00
Mark Felder
223c1bac8d Cancel the job if the signature is still invalid after a refetch of the public key 2023-12-10 12:55:41 -05:00
Lain Soykaf
0e005acd44 CI: Use Elixir 1.13 for linting. 2023-12-10 21:00:11 +04:00
Lain Soykaf
0d83b6d177 Linting 2023-12-10 19:59:02 +04:00
Lain Soykaf
06fc196772 Backup: Fix config 2023-12-10 19:46:25 +04:00
Lain Soykaf
6e3267d1bd Tests: Fix all the tests. 2023-12-10 19:19:56 +04:00
Lain Soykaf
c068a218ea Backup Tests: Split out async tests, use mox. 2023-12-10 18:57:46 +04:00
Lain Soykaf
20b76acc08 ActivityPubTest: Swallow log 2023-12-10 17:20:39 +04:00
Lain Soykaf
e5beab7f16 Config/Test: Don't start promex during testing. 2023-12-10 17:18:18 +04:00
Lain Soykaf
68f7a79f28 Tests: Remove async from cases that use Mock 2023-12-10 17:10:18 +04:00
Lain Soykaf
b7ce2cf6a8 Add .rgignore for easier grepping 2023-12-10 17:06:28 +04:00
Lain Soykaf
075222525c TransmogrifierTest: Capture the log 2023-12-10 17:06:13 +04:00
Lain Soykaf
221f18dc33 Tests: Don't run tests that use clear_config asynchronously. 2023-12-10 16:27:23 +04:00
lain
a7f82ff82e Merge branch 'scrubbers-html4-GtS' into 'develop'
scrubbers/default: Add more formatting elements from HTML4 / GoToSocial

See merge request pleroma/pleroma!3979
2023-12-10 12:18:22 +00:00
Mark Felder
d417f73218 Process inbound Delete activities at lowest priority 2023-12-09 18:47:54 -05:00
Mark Felder
94daa3e8c1 Revert "Remove unnecessary forced refresh of user"
This reverts commit 97cf78f63d.
2023-12-09 18:21:00 -05:00
Mark Felder
82724f6664 Do not retry fetching deleted objects 2023-12-09 17:48:33 -05:00
feld
a67fc30d81 Merge branch 'kphrx-develop-patch-87655' into 'develop'
Remove checking ImageMagick's commands for AnalyzeMetadata filter

See merge request pleroma/pleroma!3987
2023-12-09 14:08:13 +00:00
lain
0e75315368 Merge branch 'migration-fix' into 'develop'
Permit the quoteUrl index creation to run concurrently

See merge request pleroma/pleroma!3988
2023-12-09 06:07:28 +00:00
lain
ee15939d33 Skip transaction to generate the index concurrently 2023-12-09 05:54:02 +00:00
Mark Felder
4039106500 Fix the req_headers formatting 2023-12-08 21:51:36 -05:00
Mark Felder
1d417d2a36 Our version of Oban only supports priorities 0-3 2023-12-08 21:49:25 -05:00
Mark Felder
97cf78f63d Remove unnecessary forced refresh of user 2023-12-08 18:24:30 -05:00
Mark Felder
1b5964979f Optimistic Inbox 2023-12-08 18:13:43 -05:00
Mark Felder
ce5acd4158 get_cached_by_ap_id/1 returns a single result, not a tuple 2023-12-08 18:10:22 -05:00
Mark Felder
0d3f1be230 Fix test; log message no longer emitted here 2023-12-08 17:46:10 -05:00
Mark Felder
074b31d9ab Optimistic Inbox
Rework inbound federation to accept requests optimistically. The HTTP Signatures Plug will not attempt to fetch the actor or key and will fail early.

If the signature cannot be validated we pass the required data into the Oban job with a reduced priority and increase the timeout to 20 seconds. The Oban job will handle the actor and key fetching before attempting to validate the activity again. This job will be retried 5 times by default.

Another welcome side effect is that actors who change their keys can federate to Pleroma instances immediately instead of needing to wait the default value of 86400s / 24 hours before the key will be fetched again.
2023-12-08 17:45:20 -05:00
Mark Felder
003d3312fd Permit the index creation to run concurrently 2023-12-08 15:48:00 -05:00
kPherox
0818a9136d
add changelog 2023-12-07 20:33:23 +09:00
kPherox
b70ca7d54e fix: AnalyzeMetadata filter no longer depends on ImageMagick's commands 2023-12-07 09:53:24 +00:00
lain
5f74aadaaf Merge branch 'last_status_at' into 'develop'
MastoAPI AccountView: Change last_status_at to be a date

See merge request pleroma/pleroma!3978
2023-12-07 08:08:27 +00:00
Lain Soykaf
ef8a2134bc AccountView: Add test, refactor 2023-12-07 11:25:18 +04:00
Lain Soykaf
6a191a91ab Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into last_status_at 2023-12-07 11:18:39 +04:00
lain
2656199dc7 Merge branch 'more-test-fixes' into 'develop'
More test fixes

See merge request pleroma/pleroma!3984
2023-12-07 05:26:06 +00:00
lain
6c10fd22a3 Merge branch 'reachable-upsert' into 'develop'
Change set_reachable/1 to an upsert

See merge request pleroma/pleroma!3986
2023-12-07 04:20:54 +00:00
Mark Felder
1ad0d94d6f Change set_reachable/1 to an upsert 2023-12-06 15:50:00 -05:00
Lain Soykaf
5dce39d17f Revert "CI: Remove test coverage"
This reverts commit d99e139c6b.
2023-12-03 10:17:24 +04:00
Lain Soykaf
d99e139c6b CI: Remove test coverage 2023-11-30 13:54:07 +04:00
Lain Soykaf
eb6be30602 Linting 2023-11-30 10:05:00 +04:00
Lain Soykaf
30084b7332 Add changelog. 2023-11-30 09:55:04 +04:00
Lain Soykaf
265d8749b1 Gitlab CI: Make it work for a local runner 2023-11-30 09:40:29 +04:00
Lain Soykaf
15a8acbd6c MRF, Docs.Generator: Ensure code is loaded before checking it 2023-11-30 09:40:17 +04:00
HJ
6a6a631c81 Merge branch 'neetzsche/add_url_to_scrobbles' into 'develop'
Add optional URL value for scrobbles

See merge request pleroma/pleroma!3977
2023-11-29 15:59:19 +00:00
lain
bc7fcc2dba Merge branch 'vips' into 'develop'
Docs: Remove rust references

See merge request pleroma/pleroma!3983
2023-11-29 15:43:09 +00:00
Lain Soykaf
cd6adef471 Add changelog 2023-11-29 19:42:40 +04:00
NEETzsche
e216603477 Change url to externalLink as requested by hj here: https://shigusegubu.club/notice/AcIjZjackKAt6e522a 2023-11-29 07:55:44 -07:00
lain
1955b3c557 Merge branch 'vips' into 'develop'
Replace ImageMagick with Vips

See merge request pleroma/pleroma!3771
2023-11-29 06:03:37 +00:00
lain
35774d44b2 Merge branch 'generate-unset-user-keys-migration' into 'develop'
Fix GenerateUnsetUserKeys migration

See merge request pleroma/pleroma!3976
2023-11-28 12:34:32 +00:00
Lain Soykaf
10525ac7f8 Docs: Remove rust references 2023-11-28 15:21:34 +04:00
Lain Soykaf
ccc2adee41 Linting 2023-11-28 13:13:43 +04:00
Lain Soykaf
da26964d2b Changelog: Adjust blurhash change 2023-11-28 12:39:22 +04:00
Lain Soykaf
b3214be32f AnayzeMetadata: Fix error case that would never match 2023-11-28 12:33:54 +04:00
Lain Soykaf
03db495e1d AnalyzeMetadata: Switch to rinpatch_blurhash 2023-11-28 12:23:41 +04:00
lain
ef7bda61ad Merge branch 'promex' into 'develop'
Switch to PromEx for prometheus metrics

See merge request pleroma/pleroma!3967
2023-11-28 07:50:16 +00:00
lain
2b839197a9 Merge branch 'strip-fix' into 'develop'
Strip fix

See merge request pleroma/pleroma!3981
2023-11-27 15:30:13 +00:00
Lain Soykaf
4ef56c5b65 ActivityPub.Utils: Only treat object ids as valid while stripping 2023-11-27 18:44:11 +04:00
HJ
9c57f17af3 Merge branch 'frontends-docs' into 'develop'
Front-ends management docs

See merge request pleroma/pleroma!3974
2023-11-27 14:00:12 +00:00
NEETzsche
27df2c0ce6 Fix #strip_report_status_data 2023-11-27 17:56:43 +04:00
Lain Soykaf
5a3b81d92e ActivityPub.UtilsTest: Add failing test for strip_report_status_data 2023-11-27 17:55:16 +04:00
Mark Felder
299c548b12 Prevent a blurhash failure from breaking all metadata collection 2023-11-23 16:15:53 -05:00
NEETzsche
510a7b64f1 Add optional URL value for scrobbles 2023-11-23 04:51:51 -07:00
HJ
4ebfc011fc Merge branch 'favicon' into 'develop'
Make favicon configurable, embed favicon and manifest in server-generated meta

See merge request pleroma/pleroma!3963
2023-11-19 08:52:37 +00:00
Henry Jameson
6513f54f73 changelog 2023-11-19 10:32:39 +02:00
Henry Jameson
2112e8b5e4 update, add images 2023-11-19 10:30:49 +02:00
feld
906b121a10 Merge branch 'develop' into 'vips'
# Conflicts:
#   mix.exs
2023-11-17 16:50:36 +00:00
Mark Felder
be39146ecc Update docs to include dependencies on rust and vips where appropriate 2023-11-17 11:44:33 -05:00
Mark Felder
cf5ef1d75f Vix has pre-built NIFs for the following triples:
aarch64-apple-darwin
aarch64-linux-gnu
aarch64-linux-musl
armv7l-linux-gnueabihf
x86_64-apple-darwin
x86_64-linux-gnu
x86_64-linux-musl
aarch64-apple-darwin
aarch64-linux-gnu
aarch64-linux-musl
armv7l-linux-gnueabihf
x86_64-apple-darwin
x86_64-linux-gnu
x86_64-linux-musl
2023-11-17 11:37:51 -05:00
Mark Felder
8208777b06 Rust is required for blurhash 2023-11-17 11:32:56 -05:00
Mark Felder
7988c62f6d Update changelogs 2023-11-17 11:21:46 -05:00
Mark Felder
9511212e32 Fetch the library from the Pleroma repository 2023-11-17 11:18:42 -05:00
Mark Felder
88cc7e6a04 Resize images to 100 pixels before hashing 2023-11-17 11:06:31 -05:00
Mark Felder
0c6a54b37c Upload.Filter.AnalyzeMetadata: Blurhash with a Rust NIF, and use Vix to retrieve image metadata 2023-11-17 10:26:00 -05:00
Haelwenn (lanodan) Monnier
06c58bce00 scrubbers/default: Add more formatting elements from HTML4 / GoToSocial
Added: acronym, bdo, big, cite, dfn, ins, kbd, q, samp, s, tt, var, wbr
2023-11-16 18:27:32 +01:00
Haelwenn (lanodan) Monnier
8ac7cc98c1 MastoAPI AccountView: Change last_status_at to be a date
Changed in Mastodon 3.1.0 with: https://github.com/tootsuite/mastodon/pull/12966
2023-11-16 15:52:01 +01:00
Haelwenn
ca1b18ba2d Merge branch 'federation_status-access' into 'develop'
router: Make /federation_status publicly available

See merge request pleroma/pleroma!3937
2023-11-15 08:20:37 +00:00
Haelwenn
50c896169c Merge branch 'cflags' into 'develop'
Make eblurhash and elixir-captcha use system CFLAGS

See merge request pleroma/pleroma!3943
2023-11-15 08:19:29 +00:00
Haelwenn (lanodan) Monnier
2a58596aef Fix tests for Add support for configuring a favicon and embed PWA manifest in server-generated-meta 2023-11-15 09:12:25 +01:00
Haelwenn (lanodan) Monnier
5d3e145dc4 RedirectController: Unify server-generated-meta insertion code 2023-11-14 11:06:36 +01:00
Henry Jameson
a5aa8ea796 Add support for configuring a favicon and embed PWA manifest in server-generated-meta 2023-11-14 11:05:23 +01:00
Haelwenn
6d708664b5 Merge branch 'docs/max-elixir-erlang' into 'develop'
docs: Put a max version on erlang and elixir

Closes #3194

See merge request pleroma/pleroma!3945
2023-11-14 09:49:49 +00:00
Haelwenn (lanodan) Monnier
66f5ae0c5a router: Make /federation_status publicly available 2023-11-14 10:48:30 +01:00
Haelwenn (lanodan) Monnier
19519d6c96 docs: clang is also supported 2023-11-14 10:47:34 +01:00
Haelwenn (lanodan) Monnier
3831d31009 docs: Put a max version on erlang and elixir
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3194
2023-11-14 10:47:33 +01:00
Haelwenn (lanodan) Monnier
4472ab1fe9 changelog.d/system-cflags.fix: New entry 2023-11-14 10:45:00 +01:00
Haelwenn (lanodan) Monnier
5f85067a95 mix: Bump elixir-captcha for system-CFLAGS 2023-11-14 10:44:59 +01:00
Haelwenn (lanodan) Monnier
2b6ae571bb mix: cherry-pick eblurhash latest git for system-CFLAGS 2023-11-14 10:44:57 +01:00
Haelwenn
bf2d6abaf2 Merge branch 'healthcheck-disabled-error' into 'develop'
TwitterAPI: Return proper error when healthcheck is disabled

See merge request pleroma/pleroma!3953
2023-11-14 09:41:26 +00:00
Mark Felder
ce42dac331 Change mediaproxy previews to use vips to generate thumbnails instead of ImageMagick 2023-11-13 15:41:39 -05:00
Mark Felder
a4b6e5613f Revert "Add Pleroma.Upload.Filter.HeifToJpeg based on vips"
This reverts commit 31d4448ee61b4afac6aa23f8c0287d13aed411a1.

This functionality is not reliably working with vips/vix due to codec patent junk
2023-11-13 15:41:39 -05:00
Mark Felder
577ade75cf Override elixir_make version 2023-11-13 15:41:39 -05:00
Mark Felder
481b6ac0d5 Add Pleroma.Upload.Filter.HeifToJpeg based on vips 2023-11-13 15:41:39 -05:00
Mark Felder
13baba90f6 Replace ImageMagick with Vips for Media Preview Proxy 2023-11-13 15:41:39 -05:00
Mark Felder
1db10744f7 Use the "change" type 2023-11-13 15:35:00 -05:00
Mark Felder
66cb3294ed Switch to PromEx for prometheus metrics
Recommending use of the separate HTTP server for exposing the metrics
and securing it externally on your firewall or reverse proxy. It will
listen on port 4021 by default.
2023-11-13 15:34:59 -05:00
marcin mikołajczak
fe776d8b33 Fix GenerateUnsetUserKeys migration
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-11-13 14:18:22 +01:00
lain
752bc168f6 Merge branch 'quotes-count' into 'develop'
Count and display post quotes

See merge request pleroma/pleroma!3956
2023-11-12 13:38:09 +00:00
marcin mikołajczak
9a063deacc Count and display post quotes 2023-11-12 13:38:08 +00:00
lain
5f19fbc5a9 Merge branch 'phoenix1.7' into 'develop'
Update to Phoenix 1.7

See merge request pleroma/pleroma!3900
2023-11-12 13:34:27 +00:00
lain
e902c7168d Merge branch 'meilisearch' into 'develop'
Different search backends, in particular meilisearch as an additional one

See merge request pleroma/pleroma!3529
2023-11-12 13:29:27 +00:00
Lain Soykaf
3d62c71edf Credo fixes. 2023-11-12 17:13:27 +04:00
Lain Soykaf
59018d73c3 B Meilisearch: Update to current API responses. 2023-11-12 16:43:50 +04:00
Lain Soykaf
a1a25029da B DatabaseSearch: Fix local-only search. 2023-11-12 16:19:54 +04:00
Lain Soykaf
5996bef7cd Fix most tests that call SearchIndexWorker. 2023-11-12 15:54:16 +04:00
Lain Soykaf
5208bd8a95 Add changelog. 2023-11-12 15:00:51 +04:00
Lain Soykaf
d3f8950588 B MeiliSearch, SearchIndexingWorker: Use Config.Getting, make tests async. 2023-11-12 14:49:50 +04:00
Lain Soykaf
c1402af293 B Getting: Add default implementation, delegate, prepare test support. 2023-11-12 14:49:15 +04:00
Lain Soykaf
0c5cc51983 Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into pleroma-meilisearch 2023-11-12 13:53:18 +04:00
Henry Jameson
637926dcbb Initial draft on frontends management 2023-11-10 13:58:25 +02:00
Marcin Mikołajczak
1e9333a9aa Merge remote-tracking branch 'origin/develop' into instance-v2 2023-11-08 20:46:57 +01:00
feld
a51f3937ee Merge branch 'benchee' into 'develop'
Ensure benchee doesn't run unless we are executing benchmarks

See merge request pleroma/pleroma!3972
2023-11-08 18:27:08 +00:00
Mark Felder
e23672d82f Ensure benchee doesn't run unless we are executing benchmarks 2023-11-08 12:44:57 -05:00
Mark Felder
ef6d3dddd4 Fix changelogd grep syntax error 2023-11-08 12:28:23 -05:00
feld
aef1a88dc6 Merge branch 'changelogd-fix' into 'develop'
Fix changelogd grep syntax error

See merge request pleroma/pleroma!3973
2023-11-08 17:28:14 +00:00
Mark Felder
addc5408ff Fix changelogd grep syntax error 2023-11-08 12:27:46 -05:00
feld
17524865e5 Merge branch 'update_mr_template' into 'develop'
Update MR template to include the type 'change'

See merge request pleroma/pleroma!3971
2023-11-08 14:39:00 +00:00
Mark Felder
1810b2f477 Update MR template to include the type 'change' 2023-11-08 09:37:08 -05:00
Mark Felder
0ab853cab8 Merge branch 'develop' into phoenix1.7 2023-11-08 09:18:08 -05:00
feld
0f56304f09 Merge branch 'bare_uri_test' into 'develop'
Activate test for object validator that has not been running

See merge request pleroma/pleroma!3968
2023-11-08 14:13:37 +00:00
feld
cfc01a660a Merge branch 'changelogd-change' into 'develop'
changelogd: Support a type called "change"

See merge request pleroma/pleroma!3970
2023-11-08 14:12:33 +00:00
Mark Felder
e1bc95ae6e Support a type called "change" 2023-11-08 09:11:41 -05:00
Haelwenn (lanodan) Monnier
76c070fe86 ObjectValidators.BareUriTest: Replace calls of SafeText to BareUri 2023-11-08 02:17:50 +01:00
Mark Felder
9fa6531109 Phoenix is no longer required in extra_applications 2023-11-07 16:14:05 -05:00
Mark Felder
a0e08c6ec2 Merge branch 'develop' into phoenix1.7 2023-11-07 16:05:04 -05:00
Mark Felder
8076deeeb4 Activate test for object validator that has not been running 2023-11-07 16:00:13 -05:00
feld
11c520607f Merge branch 'mailer-queue' into 'develop'
Fix digest email processing, consolidate Oban queues

See merge request pleroma/pleroma!3966
2023-11-07 20:45:48 +00:00
Mark Felder
bf426c53b4 Fix digest email processing, consolidate Oban queues
The email related jobs can all share a single Oban queue
2023-11-07 15:14:36 -05:00
marcin mikołajczak
c62696c8e7 Support /authorize-interaction route used by Mastodon
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-11-02 13:47:23 +01:00
marcin mikołajczak
6b9a347353 update changelog
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-11-02 13:31:59 +01:00
marcin mikołajczak
50e7706b26 Verify link ownership with rel="me"
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-11-02 13:30:46 +01:00
tusooa
4c5b45ed73 Merge branch 'mergeback/2.6.0' into 'develop'
mergeback: 2.6.0

Closes #3135

See merge request pleroma/pleroma!3964
2023-11-01 03:19:05 +00:00
tusooa
aaf53d9d77
Bump package version for mergeback 2023-10-31 20:49:31 -04:00
marcin mikołajczak
e5bd1ee801 Add entry to @context, tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-29 00:02:17 +02:00
marcin mikołajczak
93370b870a Expose nonAnonymous field from Smithereen polls
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-28 23:58:39 +02:00
marcin mikołajczak
b6a9d87f16 Display reposted replies with exclude_replies: true
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-28 00:10:13 +02:00
marcin mikołajczak
c6cedbb810 InstanceV2: skip auth
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-28 00:07:18 +02:00
marcin mikołajczak
6b8c5e12df Add contact account to InstanceView
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-26 23:32:08 +02:00
marcin mikołajczak
c03852fbc7 update tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-25 00:38:52 +02:00
marcin mikołajczak
5ff3783d01 Use correct domain for fqn and InstanceView
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-10-25 00:38:10 +02:00
Haelwenn (lanodan) Monnier
2f6fc6a7ab TwitterAPI: Return proper error when healthcheck is disabled 2023-09-24 23:32:17 +02:00
marcin mikołajczak
28ef5ebd3c Update InstanceView.features
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-09-07 15:00:24 +02:00
marcin mikołajczak
79e46ce73f InstanceView: Add common_information function
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-08-11 13:57:22 +02:00
marcin mikołajczak
9effa24f30 Implement api/v2/instance route
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-08-11 00:08:05 +02:00
tusooa
1ab4ab8d38
Extract translatable strings 2023-07-18 18:24:30 -04:00
Mark Felder
63ef1dcedc Phoenix.Router.routes/1 is the public function we are meant to be using here 2023-06-03 14:17:49 -04:00
Mark Felder
c665d53295 Update to Phoenix 1.7 2023-06-03 14:06:28 -04:00
Mark Felder
bcd7ccac11 Support a type called "change" 2023-06-03 14:06:28 -04:00
feld
86b38dd14b Merge branch 'develop' into 'phoenix1.7'
# Conflicts:
#   mix.exs
2023-06-02 15:41:40 +00:00
Mark Felder
2e45be2653 Add :phoenix to extra_applications to suppress a warning
Related to use of Phoenix.Flash.get/2
2023-06-02 11:34:04 -04:00
Mark Felder
f0e5f0e837 Fix compile warning
warning: doing a prefix match with globs is deprecated, invalid segment "pleroma*path"
2023-05-31 22:23:36 +00:00
Mark Felder
2b8bbb288c Phoenix.Socket.Transport.force_ssl/4 no longer exists 2023-05-31 22:11:17 +00:00
Mark Felder
d9f031c9da Bump minimum Elixir to 1.12 2023-05-31 21:12:13 +00:00
Mark Felder
ba988a9abc Fix test warnings
warning: the URI path used in plug tests must start with "/"
2023-05-31 16:30:31 -04:00
Mark Felder
62322f71e2 Clean up Plug.Parsers.MULTIPART deprecation warnings
There is no need to the length setting to :multipart. The length setting is global for all of the parsers.
2023-05-31 16:22:40 -04:00
Mark Felder
ffee478ed0 Move websocket config for Shoutbox to the Endpoint
This is the modern way of configuring it
2023-05-31 15:30:58 -04:00
Mark Felder
4dc2d4bf7b Remove locked version of plug
Required for Phoenix 1.7 websocket changes
2023-05-31 15:30:31 -04:00
Mark Felder
a7e7db4a29 Phoenix.Endpoint.Cowboy2Handler -> Plug.Cowboy.Handler 2023-05-31 13:48:16 -04:00
Mark Felder
f622f82c0e No user facing changes 2023-05-31 13:38:46 -04:00
Mark Felder
e3110cb34e Fix deprecated calls to get_flash/2 2023-05-31 13:36:21 -04:00
Mark Felder
6e1ea2eafc Remove unnecessary compilers as of Phoenix 1.7 2023-05-31 13:36:07 -04:00
Mark Felder
bed44f9f62 Update to Phoenix 1.7
Chase the other deps to match versions you get from a current "mix phx.new" project creation
2023-05-31 13:10:18 -04:00
marcin mikołajczak
9363ef53a3 Add test for 'status' notification type for NotificationView
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-05-14 15:02:58 +02:00
Haelwenn (lanodan) Monnier
197647a04e MastoAPI Attachment: Use "summary" for descriptions if present 2023-03-09 11:10:02 +01:00
Haelwenn (lanodan) Monnier
2ae1b802f2 AttachmentValidator: Add support for Honk "summary" + "name"
As used by Honk and supported by Mastodon
2023-03-09 10:26:33 +01:00
marcin mikołajczak
78d1105bff Fix down migration
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-02-19 22:02:38 +01:00
marcin mikołajczak
92592c25c2 Merge remote-tracking branch 'pleroma/develop' into status-notification-type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-02-19 22:02:03 +01:00
marcin mikołajczak
6e51845d44 Merge remote-tracking branch 'pleroma/develop' into secure-mode
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-12-27 16:41:16 +01:00
Ekaterina Vaartis
398141da68 Merge remote-tracking branch 'upstream/develop' into meilisearch 2022-12-20 21:00:07 +03:00
Ekaterina Vaartis
5a39866388 Specifically strip mentions for search indexing 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
6256822afd Check for updateId, not uid 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
5ac6763238 Make add_to_index and remove_from_index report errors 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
102ebb42bd Make search a callback 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
119b2b847b Instead of checking string length, explicitly check for "" and "." 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
e20f74c71b Remove duplicate function call 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
b150e6f15e Update meilisearch docs 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
84608be87e Change updateId to uid because apparently that's the new name 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
1e23f527e3 Change the meilisearch key auth to conform to 0.25.0 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
79225d9b0a Actually, unlisted posts are indexed 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
fd2cfc80d2 Change search_indexing = 10 and retries for indexing = 2 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
3387935e83 Don't try removing deleted users and such from index as posts 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
d89dc5518b Fix meilisearch tests and jobs for oban 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
2bc21c6f18 Use oban for search indexing 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
6f2f457751 Add a search backend behaviour 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
4f2637acc6 Add description for initial_indexing_chunk_size 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
571533ae26 Don't support meilisearch < 0.24.0, since it breaks things 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
3179ed0921 Make chunk size configurable 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
3412713c5b Update search.md documentation with meilisearch indexing steps 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
3a11e79de0 Add config description for meilisearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
a12f63bc81 Implement suggestions from the Meilisearch MR
- Index unlisted posts
- Move version check outside of the streaming and only do it once
- Use a PUT request instead of checking manually if there is need to insert
- Add error handling, sort of
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
a6946048fb Rename Activity.Search to Search.DatabaseSearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
0fae71f88d Rename search.ex to database_search.ex and add search/2 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
39e596a5b5 Style fixes 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
7009ef5672 Move the search.ex file so credo doesn't complain 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
8898b5e927 Fix a typo in search docs 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
9c1a930707 Support reindexing meilisearch >=0.24.0
It has has a different error code key
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
e928e307f3 Add a reindex option
Signed-off-by: Ekaterina Vaartis <vaartis@kotobank.ch>
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
4445421297 Only add local posts to index in activity_pub
Remote ones are already added in another place
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
0b4fd0d342 Set content-type to application/json 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
e4b7a3f51f Modify some meilisearch variables 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
cf558208c2 Use proper deleted object for removing from index 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
95cb2bb694 Don't try removing from index again in common_api
It's already removed in the side effects of the pipeline
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
c569ad05b3 Add more documentation about rum to meilisearch docs 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
6beef2d117 Move add_to_index / remove_from_index to Pleroma.Actitivy.Search 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
40280cc273 Reorder ranking rules for (maybe) better results 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
a5bb7f9345 Add private_key: nil to default meilisearch options 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
005947e9f7 Add tests for local post indexing for meilisearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
d9ef7e0758 Fix activity being passed to objec_to_search_data 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
07ccab9766 Add search/meilisearch documentation 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
09a1ae1b6e Add the meilisearch.stats command 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
a67f9da5cc Add a message with a count of posts to index 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
2c7d973af7 Implement meilisearch auth 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
410c8cb765 Make indexing logs rewrite themselves 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
35e9192ced Rework task indexing to share code with the main module
The code in the main module now scrubs new posts too
2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
3dedadf192 Adjust content indexing to skip more unneeded stuff 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
9f16ca80e0 Mark only content as searchable for meilisearch 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
2b2e409ad7 Also index incoming federated posts 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
e35d87ea54 Make the chunk size smaller 2022-10-10 20:19:09 +03:00
Ekaterina Vaartis
00c48a33ac Use content instead of source and scrub it 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
9beaebd97e Tweak search ordering to hopefully return newer results 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
38996f551a Make meilisearch sort on publish date converted to unix time 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
ea6a6a1287 Make the indexing batch differently and more, show number indexed 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
365024abec Ensure only indexing public posts and implement clearing and delete 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
0318e9a599 Add logging to milisiearch index and make it use desc(id) 2022-10-10 20:19:08 +03:00
Ekaterina Vaartis
e154ebbf79 Initial meilisearch implementation, doesn't delete posts yet 2022-10-10 20:19:08 +03:00
marcin mikołajczak
c899af1d6a Reject requests from specified instances if authorized_fetch_mode is enabled
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-08-05 11:06:30 +02:00
marcin mikołajczak
3ed39e3109 Add test
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-07-08 21:28:23 +02:00
Claudio Maradonna
21d9091f5e
ipfs: replacing single quotes with double quotes 2022-07-08 10:06:46 +02:00
Claudio Maradonna
5e097eb91d
ipfs: better tests with @ilja suggestions 2022-07-07 06:29:17 +02:00
Claudio Maradonna
254f2ea854
ipfs: remove unused alias
fix analysis job
2022-07-07 06:29:15 +02:00
Claudio Maradonna
98f268e5ec
ipfs: small refactor and more tests 2022-07-07 06:29:15 +02:00
Claudio Maradonna
7c1af86f97
ipfs: refactor final_url generation. add tests for final_url
fix lint
2022-07-07 06:29:13 +02:00
Claudio Maradonna
44659ecd65
ipfs: revert to String.replace for cid placeholder
ipfs: fix lint
2022-07-07 06:29:12 +02:00
Claudio Maradonna
43dfa58ebd
added tests for ipfs uploader. adapted changelog.md accordingly. improved ipfs uploader with external suggestions
fix lint description.exs
2022-07-07 06:29:10 +02:00
Claudio Maradonna
fa2a6d5d6b
feat: simple, but not stupid, uploader for IPFS
fix: format fix with credo
2022-07-07 06:29:01 +02:00
Mark Felder
6b74a55274 InstanceStatic should have reasonable caching
While here fix the naming convention of the old module attribute restricting caching and add a new one for the default cache value

All frontends should be shipped with versioned assets. There be dragons if you don't.
2022-07-01 15:40:40 -05:00
marcin mikołajczak
5846e7d5f6 Use Repo.exists?
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-01 16:03:22 +02:00
marcin mikołajczak
0ecd6ba35e AdminAPI: Allow filtering reports by rule_id
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-30 13:24:39 +02:00
marcin mikołajczak
b354d70e85 Apply, suggestions, use strings for actual Mastodon API compatibility
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-30 12:30:03 +02:00
marcin mikołajczak
5c383ada8a Correctly order rules by id/creation date
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:08:02 +02:00
marcin mikołajczak
d26aadb743 Add tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:06:53 +02:00
marcin mikołajczak
574db5b988 Allow submitting an array of rule_ids to /api/v1/reports
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:06:49 +02:00
marcin mikołajczak
bbf3bc2228 Add RuleTest
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:03:06 +02:00
marcin mikołajczak
384f8bfa78 Instance rules: Use render_many
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:02:40 +02:00
marcin mikołajczak
432599311d Add GET /api/v1/instance/rules
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:02:36 +02:00
marcin mikołajczak
bd52e2aec7 Instance rules
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-05-16 14:02:32 +02:00
marcin mikołajczak
9423052e92 Add "status" notification type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-04-25 14:08:31 +02:00
Alex Gleason
3a03d9b65f
Merge remote-tracking branch 'pleroma/develop' into nsfw-api-mrf 2021-06-17 15:38:10 -05:00
Alex Gleason
a704d5499c
NsfwApiPolicy: Fall back more generously when functions don't match 2021-06-17 15:32:42 -05:00
Alex Gleason
c802c3055e
NsfwApiPolicy: add systemd example file 2021-06-17 15:04:40 -05:00
Alex Gleason
b293c14a1b
NsfwApiPolicy: add describe/0 and config_description/0 2021-06-17 14:52:07 -05:00
Alex Gleason
2b3dfbb42f
NsfwApiPolicy: add tests 2021-06-17 14:36:51 -05:00
Alex Gleason
f15d419062
NsfwApiPolicy: raise if can't fetch user 2021-06-16 22:35:09 -05:00
Alex Gleason
718e8e1edb
Create NsfwApiPolicy 2021-06-16 22:35:04 -05:00
1021 changed files with 16857 additions and 5935 deletions

9
.dialyzer_ignore.exs Normal file
View File

@ -0,0 +1,9 @@
[
{"lib/cachex.ex", "Unknown type: Spec.cache/0."},
{"lib/pleroma/web/plugs/rate_limiter.ex", "The pattern can never match the type {:commit, _} | {:ignore, _}."},
{"lib/pleroma/web/plugs/rate_limiter.ex", "Function get_scale/2 will never be called."},
{"lib/pleroma/web/plugs/rate_limiter.ex", "Function initialize_buckets!/1 will never be called."},
{"lib/pleroma/workers/receiver_worker.ex", :call},
{"lib/pleroma/workers/receiver_worker.ex", :pattern_match},
{"lib/pleroma/workers/receiver_worker.ex", :pattern_match_cov},
]

10
.gitignore vendored
View File

@ -6,7 +6,7 @@
/test/instance /test/instance
/test/uploads /test/uploads
/.elixir_ls /.elixir_ls
/test/fixtures/DSCN0010_tmp.jpg /test/fixtures/DSCN0010_tmp*
/test/fixtures/test_tmp.txt /test/fixtures/test_tmp.txt
/test/fixtures/image_tmp.jpg /test/fixtures/image_tmp.jpg
/test/tmp/ /test/tmp/
@ -57,5 +57,9 @@ pleroma.iml
.tool-versions .tool-versions
# Editor temp files # Editor temp files
/*~ *~
/*# *#
*.swp
archive-*
.gitlab-ci-local

View File

@ -1,11 +1,13 @@
image: git.pleroma.social:5050/pleroma/pleroma/ci-base image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.13.4-otp-25
variables: &global_variables variables: &global_variables
# Only used for the release
ELIXIR_VER: 1.13.4
POSTGRES_DB: pleroma_test POSTGRES_DB: pleroma_test
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres POSTGRES_PASSWORD: postgres
DB_HOST: postgres DB_HOST: postgres
DB_PORT: 5432 DB_PORT: "5432"
MIX_ENV: test MIX_ENV: test
workflow: workflow:
@ -16,17 +18,16 @@ workflow:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
cache: &global_cache_policy cache: &global_cache_policy
key: key: $CI_JOB_IMAGE-$CI_COMMIT_SHORT_SHA
files:
- mix.lock
paths: paths:
- deps - deps
- _build - _build
stages: stages:
- check-changelog
- build - build
- lint
- test - test
- check-changelog
- benchmark - benchmark
- deploy - deploy
- release - release
@ -69,7 +70,7 @@ check-changelog:
tags: tags:
- amd64 - amd64
build: build-1.13.4-otp-25:
extends: extends:
- .build_changes_policy - .build_changes_policy
- .using-ci-base - .using-ci-base
@ -77,10 +78,19 @@ build:
script: script:
- mix compile --force - mix compile --force
build-1.17.1-otp-26:
extends:
- .build_changes_policy
- .using-ci-base
stage: build
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.17.1-otp-26
script:
- mix compile --force
spec-build: spec-build:
extends: extends:
- .using-ci-base - .using-ci-base
stage: test stage: build
rules: rules:
- changes: - changes:
- ".gitlab-ci.yml" - ".gitlab-ci.yml"
@ -100,7 +110,7 @@ benchmark:
variables: variables:
MIX_ENV: benchmark MIX_ENV: benchmark
services: services:
- name: postgres:9.6-alpine - name: postgres:11.22-alpine
alias: postgres alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script: script:
@ -108,7 +118,7 @@ benchmark:
- mix ecto.migrate - mix ecto.migrate
- mix pleroma.load_testing - mix pleroma.load_testing
unit-testing: unit-testing-1.13.4-otp-25:
extends: extends:
- .build_changes_policy - .build_changes_policy
- .using-ci-base - .using-ci-base
@ -116,15 +126,14 @@ unit-testing:
cache: &testing_cache_policy cache: &testing_cache_policy
<<: *global_cache_policy <<: *global_cache_policy
policy: pull policy: pull
services: &testing_services
services:
- name: postgres:13-alpine - name: postgres:13-alpine
alias: postgres alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script: script: &testing_script
- mix ecto.create - mix ecto.create
- mix ecto.migrate - mix ecto.migrate
- mix test --cover --preload-modules - mix pleroma.test_runner --cover --preload-modules
coverage: '/^Line total: ([^ ]*%)$/' coverage: '/^Line total: ([^ ]*%)$/'
artifacts: artifacts:
reports: reports:
@ -132,65 +141,20 @@ unit-testing:
coverage_format: cobertura coverage_format: cobertura
path: coverage.xml path: coverage.xml
unit-testing-erratic: unit-testing-1.17.1-otp-26:
extends:
- .build_changes_policy
- .using-ci-base
stage: test
retry: 2
allow_failure: true
cache: &testing_cache_policy
<<: *global_cache_policy
policy: pull
services:
- name: postgres:13-alpine
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script:
- mix ecto.create
- mix ecto.migrate
- mix test --only=erratic
# Removed to fix CI issue. In this early state it wasn't adding much value anyway.
# TODO Fix and reinstate federated testing
# federated-testing:
# stage: test
# cache: *testing_cache_policy
# services:
# - name: minibikini/postgres-with-rum:12
# alias: postgres
# command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
# script:
# - mix deps.get
# - mix ecto.create
# - mix ecto.migrate
# - epmd -daemon
# - mix test --trace --only federated
unit-testing-rum:
extends: extends:
- .build_changes_policy - .build_changes_policy
- .using-ci-base - .using-ci-base
stage: test stage: test
image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.17.1-otp-26
cache: *testing_cache_policy cache: *testing_cache_policy
services: services: *testing_services
- name: minibikini/postgres-with-rum:12 script: *testing_script
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
variables:
<<: *global_variables
RUM_ENABLED: "true"
script:
- mix ecto.create
- mix ecto.migrate
- "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
- mix test --preload-modules
lint: formatting-1.15:
extends: .build_changes_policy extends: .build_changes_policy
image: &current_elixir elixir:1.12-alpine image: &formatting_elixir elixir:1.15-alpine
stage: test stage: lint
cache: *testing_cache_policy cache: *testing_cache_policy
before_script: &current_bfr_script before_script: &current_bfr_script
- apk update - apk update
@ -201,25 +165,38 @@ lint:
script: script:
- mix format --check-formatted - mix format --check-formatted
analysis: cycles-1.15:
extends:
- .build_changes_policy
- .using-ci-base
stage: test
cache: *testing_cache_policy
script:
- mix credo --strict --only=warnings,todo,fixme,consistency,readability
cycles:
extends: .build_changes_policy extends: .build_changes_policy
image: *current_elixir image: *formatting_elixir
stage: test stage: lint
cache: {} cache: {}
before_script: *current_bfr_script before_script: *current_bfr_script
script: script:
- mix compile - mix compile
- mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}' - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
analysis:
extends:
- .build_changes_policy
- .using-ci-base
stage: lint
cache: *testing_cache_policy
script:
- mix credo --strict --only=warnings,todo,fixme,consistency,readability
dialyzer:
extends:
- .build_changes_policy
- .using-ci-base
stage: lint
allow_failure: true
when: manual
cache: *testing_cache_policy
tags:
- feld
script:
- mix dialyzer
docs-deploy: docs-deploy:
stage: deploy stage: deploy
cache: *testing_cache_policy cache: *testing_cache_policy
@ -294,7 +271,7 @@ stop_review_app:
amd64: amd64:
stage: release stage: release
image: elixir:1.11.4 image: elixir:$ELIXIR_VER
only: &release-only only: &release-only
- stable@pleroma/pleroma - stable@pleroma/pleroma
- develop@pleroma/pleroma - develop@pleroma/pleroma
@ -318,8 +295,9 @@ amd64:
- deps - deps
variables: &release-variables variables: &release-variables
MIX_ENV: prod MIX_ENV: prod
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
before_script: &before-release before_script: &before-release
- apt-get update && apt-get install -y cmake libmagic-dev - apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev
- echo "import Config" > config/prod.secret.exs - echo "import Config" > config/prod.secret.exs
- mix local.hex --force - mix local.hex --force
- mix local.rebar --force - mix local.rebar --force
@ -334,13 +312,13 @@ amd64-musl:
stage: release stage: release
artifacts: *release-artifacts artifacts: *release-artifacts
only: *release-only only: *release-only
image: elixir:1.11.4-alpine image: elixir:$ELIXIR_VER-alpine
tags: tags:
- amd64 - amd64
cache: *release-cache cache: *release-cache
variables: *release-variables variables: *release-variables
before_script: &before-release-musl before_script: &before-release-musl
- apk add git build-base cmake file-dev openssl - apk add git build-base cmake file-dev openssl vips-dev
- echo "import Config" > config/prod.secret.exs - echo "import Config" > config/prod.secret.exs
- mix local.hex --force - mix local.hex --force
- mix local.rebar --force - mix local.rebar --force
@ -352,7 +330,7 @@ arm:
only: *release-only only: *release-only
tags: tags:
- arm32-specified - arm32-specified
image: arm32v7/elixir:1.11.4 image: arm32v7/elixir:$ELIXIR_VER
cache: *release-cache cache: *release-cache
variables: *release-variables variables: *release-variables
before_script: *before-release before_script: *before-release
@ -364,7 +342,7 @@ arm-musl:
only: *release-only only: *release-only
tags: tags:
- arm32-specified - arm32-specified
image: arm32v7/elixir:1.11.4-alpine image: arm32v7/elixir:$ELIXIR_VER-alpine
cache: *release-cache cache: *release-cache
variables: *release-variables variables: *release-variables
before_script: *before-release-musl before_script: *before-release-musl
@ -376,7 +354,7 @@ arm64:
only: *release-only only: *release-only
tags: tags:
- arm - arm
image: arm64v8/elixir:1.11.4 image: arm64v8/elixir:$ELIXIR_VER
cache: *release-cache cache: *release-cache
variables: *release-variables variables: *release-variables
before_script: *before-release before_script: *before-release
@ -388,7 +366,7 @@ arm64-musl:
only: *release-only only: *release-only
tags: tags:
- arm - arm
image: arm64v8/elixir:1.11.4-alpine image: arm64v8/elixir:$ELIXIR_VER-alpine
cache: *release-cache cache: *release-cache
variables: *release-variables variables: *release-variables
before_script: *before-release-musl before_script: *before-release-musl

View File

@ -3,7 +3,7 @@
`<code>` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name. `<code>` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name.
`<type>` can be `add`, `remove`, `fix`, `security` or `skip`. `skip` is only used if there is no user-visible change in the MR (for example, only editing comments in the code). Otherwise, choose a type that corresponds to your change. `<type>` can be `add`, `change`, `remove`, `fix`, `security` or `skip`. `skip` is only used if there is no user-visible change in the MR (for example, only editing comments in the code). Otherwise, choose a type that corresponds to your change.
In the file, write the changelog entry. For example, if an MR adds group functionality, we can create a file named `group.add` and write `Add group functionality` in it. In the file, write the changelog entry. For example, if an MR adds group functionality, we can create a file named `group.add` and write `Add group functionality` in it.

1
.rgignore Normal file
View File

@ -0,0 +1 @@
priv/static

View File

@ -4,10 +4,158 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 2.6.3 ## 2.7.0
### Security ### Security
- HTTP Security: By default, don't allow unsafe-eval. The setting needs to be changed to allow Flash emulation.
- Fix webfinger spoofing. - Fix webfinger spoofing.
- Use proper workers for fetching pins instead of an ad-hoc task, fixing a potential fetch loop
### Changed
- Update to Phoenix 1.7
- Elixir Logger configuration is now longer permitted through AdminFE and ConfigDB
- Refactor the user backups code and improve test coverage
- Invalid activities delivered to the inbox will be rejected with a 400 Bad Request
- Support Bandit as an alternative to Cowboy for the HTTP server.
- Update Bandit to 1.5.2
- Replace eblurhash with rinpatch_blurhash. This also removes a dependency on ImageMagick.
- Elixir 1.13 is the minimum required version.
- Document maximum supported version of Erlang & Elixir
- Update and extend NetBSD installation docs
- Make `/api/v1/pleroma/federation_status` publicly available
- Increase outgoing federation parallelism
- Change Hackney connection pool timeouts to align with the values Gun uses
- Transmogrifier: handle non-validate errors on incoming Delete activities
- Remote object fetch failures will prevent the object fetch job from retrying if the object request returns 401, 403, 404, 410, or exceeds the maximum thread depth.
- - Change AccountView `last_status_at` from a datetime to a date (as done in Mastodon 3.1.0)
- Improve error logging when LDAP authentication fails.
- Publisher jobs will not retry if the error received is a 400
- PollWorker jobs will not retry if the activity no longer exists.
- Improved detecting unrecoverable errors for incoming federation jobs
- Changed some jobs to return :cancel on unrecoverable errors that should not be retried
- Discard Remote Fetcher jobs which errored due to an MRF rejection.
- Oban queues have refactored to simplify the queue design
- Ensure all Oban jobs have timeouts defined
- Optimistic Inbox reduces the processing overhead of incoming activities without instantly verifiable signatures.
- HTTP connection pool adjustments
- Disable jit by default for PostgreSQL
- Update the documentation for configuring Prometheus metrics.
- Change the prometheus library to PromEx.
- Publisher jobs now store the the activity id instead of inserting duplicate JSON data in the Oban queue for each delivery.
- Activity publishing failures will prevent the job from retrying if the publishing request returns a 403 or 410
- Publisher errors will now emit logs indicating the inbox that was not available for delivery.
- Reduce the reachability timestamp update to a single upsert query
- A 422 error is returned when attempting to reply to a deleted status
- Rich Media backfilling is now an Oban job
- Refactored Rich Media to cache the content in the database. Fetching operations that could block status rendering have been eliminated.
- Set default values on validators for transient objects (attachment, poll options)
- User profile refreshes are now asynchronous
- Change mediaproxy previews to use vips to generate thumbnails instead of ImageMagick
- Render nice web push notifications for polls
- Refactor the Mastodon /api/v1/streaming websocket handler to use Phoenix.Socket.Transport
### Added
- Uploader: Add support for uploading attachments using IPFS
- Add NSFW-detecting MRF
- Add DNSRBL MRF
- Add options to the mix prune_objects task
- Add Anti-mention Spam MRF backported from Rebased
- HTTPSignaturePlug: Add :authorized_fetch_mode_exceptions configuration
- Support /authorize-interaction route used by Mastodon
- Add an option to reject certain domains when authorized fetch is enabled.
- Include following/followers in backups
- Allow to group bookmarks in folders
- Include image description in status media cards
- Implement `/api/v1/accounts/familiar_followers`
- Add support for configuring favicon, embed favicon and PWA manifest in server-generated meta
- Implement FEP-2c59, add "webfinger" to user actor
- Framegrabs with ffmpeg will execute with a 5 second timeout and cache the URLs of failures with a TTL of 15 minutes to prevent excessive retries.
- Added a Mix task "pleroma.config fix_mrf_policies" which will remove erroneous MRF policies from ConfigDB.
- Add ForceMention MRF
- [docs] add frontends management documentation
- Implement group actors
- Add contact account to InstanceView
- Add instance rules
- Implement /api/v2/instance route
- Verify profile link ownership with rel="me"
- Logger metadata is now attached to some logs to help with troubleshooting and analysis
- Add new parameters to /api/v2/instance: configuration[accounts][max_pinned_statuses] and configuration[statuses][characters_reserved_per_url]
- Add meilisearch, make search engines pluggable
- Add missing indexes on foreign key relationships
- Startup detection for configured MRF modules that are missing or incorrectly defined
- Permit passing --chunk and --step values to the Pleroma.Search.Indexer Mix task
- Deleting, Unfavoriting, Unrepeating, or Unreacting will cancel undelivered publishing jobs for the original activity.
- Oban jobs can now be viewed in the Live Dashboard
- Add media proxy to opengraph rich media cards
- Support for Erlang OTP 26
- Prioritize mentioned recipients (i.e., those that are not just followers) when federating.
- PromEx documentation
- Expose nonAnonymous field from Smithereen polls
- Add Qdrant/OpenAI embedding search
- Adds the capability to add a URL to a scrobble (optional field)
- scrubbers/default: Add more formatting elements from HTML4 / GoToSocial (acronym, bdo, big, cite, dfn, ins, kbd, q, samp, s, tt, var, wbr)
- Monitoring of search backend health to control the processing of jobs in the search indexing Oban queue
- Display reposted replies with exclude_replies: true
- Add "status" notification type
- Support honk-style attachment summaries as alt-text.
### Fixed
- Fix Emoji object IDs not always being valid
- Remove checking ImageMagick's commands for Pleroma.Upload.Filter.AnalyzeMetadata
- Ensure that StripLocation actually removes everything resembling GPS data from PNGs
- Fix authentication check on account rendering when bio is defined
- ap userview: add outbox field.
- Fix #strip_report_status_data
- Fix federation with Convergence AP Bridge
- ChatMessage: Tolerate attachment field set to an empty array
- Config: Check the permissions of the linked file instead of the symlink
- MediaProxy was setting the content-length header which is not permitted by RFC9112§6.2 when we are chunking the reply as it conflicts with the existence of the transfer-encoding header.
- Restore Cowboy's ability to stream MediaProxy responses without Chunked encoding.
- Fix the processing of email digest jobs.
- Client application data was always missing from the status
- Elixir 1.15 compatibility
- When downloading remote emojis packs, account for pagination
- Make remote emoji packs API use specifically the V1 URL. Akkoma does not understand it without V1, and it works either way with normal pleroma, so no reason to not do this
- Following HTTP Redirects when the HTTP Adapter is Finch
- Video framegrabs were not working correctly after the change to use Exile to execute ffmpeg
- Deactivated groups would still try to repeat a post.
- Fix logic error in Gun connection pooling which prevented retries even when the worker was launched with retry = true
- Connection pool errors when publishing an activity is a soft-error that will be retried shortly.
- Gun Connection Pool was not retrying to acquire a connection if the pool was full and stale connections were reclaimed
- TwitterAPI: Return proper error when healthcheck is disabled
- Handle cases when users.inbox is nil.
- Fix LDAP support
- Use correct domain for fqn and InstanceView
- The query for marking notifications as read has been simplified
- Mastodon API /api/v1/directory: Fix listing directory contents when not authenticated
- Ensure MediaProxy HTTP requests obey all the defined connection settings
- Fix a memory leak caused by Websocket connections that would not enter a state where a full garbage collection run could be triggered.
- Fix OpenGraph and Twitter metadata providers when parsing objects with no content or summary fields.
- MRF: Log sensible error for subdomains_regex
- MRF.StealEmojiPolicy: Properly add fallback extension to filenames missing one
- Federated timeline removal of hashtags via MRF HashtagPolicy
- Support objects with a null contentMap (firefish)
- Fix notifications query which was not using the index properly
- Notifications: improve performance by filtering on users table instead of activities table
- Prevent Rich Media backfill jobs from retrying in cases where it is likely they will fail again.
- Oban Jobs for refreshing users were not respecting the uniqueness setting
- Fix Optimistic Inbox for failed signatures
- MediaProxy Preview failures prevented when encountering certain video files
- pleroma_ctl: Use realpath(1) instead of readlink(1)
- ReceiverWorker: Make sure non-{:ok, _} is returned as {:error, …}
- Harden Rich Media parsing against very slow or malicious URLs
- Rich Media Preview cache eviction when the activity is updated.
- Parsing of RichMedia TTLs for Amazon URLs when query parameters are nil
- End of poll notifications were not streamed over websockets or web push
- Fix eblurhash and elixir-captcha not using system cflags
- Video thumbnails were not being generated due to a negative cache lookup logic error
- Fix web push notifications not successfully delivering
- Web Push notifications are no longer generated for muted/blocked threads and users.
- Fix validate_webfinger when running a different domain for Webfinger
### Removed
- Mastodon API: Remove deprecated GET /api/v1/statuses/:id/card endpoint https://github.com/mastodon/mastodon/pull/11213
- Removed support for multiple federator modules as we only support ActivityPub
## 2.6.2 ## 2.6.2
@ -72,7 +220,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 2.5.4 ## 2.5.4
## Security ## Security
- Fix XML External Entity (XXE) loading vulnerability allowing to fetch arbitary files from the server's filesystem - Fix XML External Entity (XXE) loading vulnerability allowing to fetch arbitrary files from the server's filesystem
## 2.5.3 ## 2.5.3
@ -88,7 +236,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 2.5.4 ## 2.5.4
## Security ## Security
- Fix XML External Entity (XXE) loading vulnerability allowing to fetch arbitary files from the server's filesystem - Fix XML External Entity (XXE) loading vulnerability allowing to fetch arbitrary files from the server's filesystem
## 2.5.3 ## 2.5.3
@ -128,7 +276,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix `block_from_stranger` setting - Fix `block_from_stranger` setting
- Fix rel="me" - Fix rel="me"
- Docker images will now run properly - Docker images will now run properly
- Fix inproper content being cached in report content - Fix improper content being cached in report content
- Notification filter on object content will not operate on the ones that inherently have no content - Notification filter on object content will not operate on the ones that inherently have no content
- ZWNJ and double dots in links are parsed properly for Plain-text posts - ZWNJ and double dots in links are parsed properly for Plain-text posts
- OTP releases will work on systems with a newer libcrypt - OTP releases will work on systems with a newer libcrypt
@ -794,7 +942,7 @@ switched to a new configuration mechanism, however it was not officially removed
- Rate limiter crashes when there is no explicitly specified ip in the config - Rate limiter crashes when there is no explicitly specified ip in the config
- 500 errors when no `Accept` header is present if Static-FE is enabled - 500 errors when no `Accept` header is present if Static-FE is enabled
- Instance panel not being updated immediately due to wrong `Cache-Control` headers - Instance panel not being updated immediately due to wrong `Cache-Control` headers
- Statuses posted with BBCode/Markdown having unncessary newlines in Pleroma-FE - Statuses posted with BBCode/Markdown having unnecessary newlines in Pleroma-FE
- OTP: Fix some settings not being migrated to in-database config properly - OTP: Fix some settings not being migrated to in-database config properly
- No `Cache-Control` headers on attachment/media proxy requests - No `Cache-Control` headers on attachment/media proxy requests
- Character limit enforcement being off by 1 - Character limit enforcement being off by 1
@ -1114,10 +1262,10 @@ curl -Lo ./bin/pleroma_ctl 'https://git.pleroma.social/pleroma/pleroma/raw/devel
- Reverse Proxy limiting `max_body_length` was incorrectly defined and only checked `Content-Length` headers which may not be sufficient in some circumstances - Reverse Proxy limiting `max_body_length` was incorrectly defined and only checked `Content-Length` headers which may not be sufficient in some circumstances
### Added ### Added
- Expiring/ephemeral activites. All activities can have expires_at value set, which controls when they should be deleted automatically. - Expiring/ephemeral activities. All activities can have expires_at value set, which controls when they should be deleted automatically.
- Mastodon API: in post_status, the expires_in parameter lets you set the number of seconds until an activity expires. It must be at least one hour. - Mastodon API: in post_status, the expires_in parameter lets you set the number of seconds until an activity expires. It must be at least one hour.
- Mastodon API: all status JSON responses contain a `pleroma.expires_at` item which states when an activity will expire. The value is only shown to the user who created the activity. To everyone else it's empty. - Mastodon API: all status JSON responses contain a `pleroma.expires_at` item which states when an activity will expire. The value is only shown to the user who created the activity. To everyone else it's empty.
- Configuration: `ActivityExpiration.enabled` controls whether expired activites will get deleted at the appropriate time. Enabled by default. - Configuration: `ActivityExpiration.enabled` controls whether expired activities will get deleted at the appropriate time. Enabled by default.
- Conversations: Add Pleroma-specific conversation endpoints and status posting extensions. Run the `bump_all_conversations` task again to create the necessary data. - Conversations: Add Pleroma-specific conversation endpoints and status posting extensions. Run the `bump_all_conversations` task again to create the necessary data.
- MRF: Support for priming the mediaproxy cache (`Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy`) - MRF: Support for priming the mediaproxy cache (`Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy`)
- MRF: Support for excluding specific domains from Transparency. - MRF: Support for excluding specific domains from Transparency.

View File

@ -1,15 +1,16 @@
ARG ELIXIR_IMG=hexpm/elixir ARG ELIXIR_IMG=hexpm/elixir
ARG ELIXIR_VER=1.11.4 ARG ELIXIR_VER=1.13.4
ARG ERLANG_VER=24.2.1 ARG ERLANG_VER=24.3.4.15
ARG ALPINE_VER=3.17.0 ARG ALPINE_VER=3.17.5
FROM ${ELIXIR_IMG}:${ELIXIR_VER}-erlang-${ERLANG_VER}-alpine-${ALPINE_VER} as build FROM ${ELIXIR_IMG}:${ELIXIR_VER}-erlang-${ERLANG_VER}-alpine-${ALPINE_VER} as build
COPY . . COPY . .
ENV MIX_ENV=prod ENV MIX_ENV=prod
ENV VIX_COMPILATION_MODE=PLATFORM_PROVIDED_LIBVIPS
RUN apk add git gcc g++ musl-dev make cmake file-dev &&\ RUN apk add git gcc g++ musl-dev make cmake file-dev vips-dev &&\
echo "import Config" > config/prod.secret.exs &&\ echo "import Config" > config/prod.secret.exs &&\
mix local.hex --force &&\ mix local.hex --force &&\
mix local.rebar --force &&\ mix local.rebar --force &&\
@ -37,7 +38,7 @@ ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma ARG DATA=/var/lib/pleroma
RUN apk update &&\ RUN apk update &&\
apk add exiftool ffmpeg imagemagick libmagic ncurses postgresql-client &&\ apk add exiftool ffmpeg vips libmagic ncurses postgresql-client &&\
adduser --system --shell /bin/false --home ${HOME} pleroma &&\ adduser --system --shell /bin/false --home ${HOME} pleroma &&\
mkdir -p ${DATA}/uploads &&\ mkdir -p ${DATA}/uploads &&\
mkdir -p ${DATA}/static &&\ mkdir -p ${DATA}/static &&\

View File

@ -3,8 +3,20 @@
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Benchmark do defmodule Mix.Tasks.Pleroma.Benchmark do
import Mix.Pleroma @shortdoc "Benchmarks"
@moduledoc """
Benchmark tasks available:
adapters
render_timeline
search
tag
MIX_ENV=benchmark mix pleroma.benchmark adapters
"""
use Mix.Task use Mix.Task
import Mix.Pleroma
def run(["search"]) do def run(["search"]) do
start_pleroma() start_pleroma()
@ -63,7 +75,7 @@ defmodule Mix.Tasks.Pleroma.Benchmark do
Benchee.run( Benchee.run(
%{ %{
"Standart rendering" => fn activities -> "Standard rendering" => fn activities ->
Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{ Pleroma.Web.MastodonAPI.StatusView.render("index.json", %{
activities: activities, activities: activities,
for: user, for: user,

View File

@ -1 +0,0 @@
Fix validate_webfinger when running a different domain for Webfinger

View File

@ -1 +0,0 @@
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:latest --push .

View File

@ -1,4 +1,4 @@
FROM elixir:1.11.4 FROM elixir:1.12.3
# Single RUN statement, otherwise intermediate images are created # Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run # https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.12 --push .

View File

@ -0,0 +1,8 @@
FROM elixir:1.13.4-otp-25
# Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt-get update &&\
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
mix local.hex --force &&\
mix local.rebar --force

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.13.4-otp-25 --push .

View File

@ -0,0 +1,8 @@
FROM elixir:1.15.8-otp-26
# Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt-get update &&\
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
mix local.hex --force &&\
mix local.rebar --force

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15.8-otp-26 --push .

View File

@ -0,0 +1,8 @@
FROM elixir:1.16.3-otp-26
# Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt-get update &&\
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
mix local.hex --force &&\
mix local.rebar --force

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.16.3-otp-26 --push .

View File

@ -0,0 +1,8 @@
FROM elixir:1.17.1-otp-26
# Single RUN statement, otherwise intermediate images are created
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run
RUN apt-get update &&\
apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\
mix local.hex --force &&\
mix local.rebar --force

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.17.1-otp-26 --push .

View File

@ -0,0 +1,3 @@
FROM postgres:13-bullseye
RUN apt-get update && apt-get install -y postgresql-13-rum/bullseye-pgdg

View File

@ -0,0 +1 @@
docker buildx build --platform linux/amd64,linux/arm64 -t git.pleroma.social:5050/pleroma/pleroma/postgres-with-rum-13:latest --push .

View File

@ -14,7 +14,7 @@ config :pleroma, Pleroma.Captcha,
method: Pleroma.Captcha.Mock method: Pleroma.Captcha.Mock
# Print only warnings and errors during test # Print only warnings and errors during test
config :logger, level: :warn config :logger, level: :warning
config :pleroma, :auth, oauth_consumer_strategies: [] config :pleroma, :auth, oauth_consumer_strategies: []
@ -79,6 +79,10 @@ IO.puts("RUM enabled: #{rum_enabled}")
config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock config :pleroma, Pleroma.ReverseProxy.Client, Pleroma.ReverseProxy.ClientMock
config :pleroma, Pleroma.Application,
background_migrators: false,
streamer_registry: false
if File.exists?("./config/benchmark.secret.exs") do if File.exists?("./config/benchmark.secret.exs") do
import_config "benchmark.secret.exs" import_config "benchmark.secret.exs"
else else

View File

@ -82,6 +82,10 @@ config :ex_aws, :s3,
# region: "us-east-1", # may be required for Amazon AWS # region: "us-east-1", # may be required for Amazon AWS
scheme: "https://" scheme: "https://"
config :pleroma, Pleroma.Uploaders.IPFS,
post_gateway_url: "http://localhost:5001",
get_gateway_url: "http://localhost:8080"
config :pleroma, :emoji, config :pleroma, :emoji,
shortcode_globs: ["/emoji/custom/**/*.png"], shortcode_globs: ["/emoji/custom/**/*.png"],
pack_extensions: [".png", ".gif"], pack_extensions: [".png", ".gif"],
@ -110,32 +114,11 @@ config :pleroma, :uri_schemes,
"xmpp" "xmpp"
] ]
websocket_config = [
path: "/websocket",
serializer: [
{Phoenix.Socket.V1.JSONSerializer, "~> 1.0.0"},
{Phoenix.Socket.V2.JSONSerializer, "~> 2.0.0"}
],
timeout: 60_000,
transport_log: false,
compress: false
]
# Configures the endpoint # Configures the endpoint
config :pleroma, Pleroma.Web.Endpoint, config :pleroma, Pleroma.Web.Endpoint,
url: [host: "localhost"], url: [host: "localhost"],
http: [ http: [
ip: {127, 0, 0, 1}, ip: {127, 0, 0, 1}
dispatch: [
{:_,
[
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
{Phoenix.Transports.WebSocket,
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, websocket_config}}},
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
]}
]
], ],
protocol: "https", protocol: "https",
secret_key_base: "aK4Abxf29xU9TTDKre9coZPUgevcVCFQJe/5xP/7Lt4BEif6idBIbjupVbOrbKxl", secret_key_base: "aK4Abxf29xU9TTDKre9coZPUgevcVCFQJe/5xP/7Lt4BEif6idBIbjupVbOrbKxl",
@ -149,16 +132,18 @@ config :pleroma, Pleroma.Web.Endpoint,
] ]
# Configures Elixir's Logger # Configures Elixir's Logger
config :logger, backends: [:console]
config :logger, :console, config :logger, :console,
level: :debug, level: :debug,
format: "\n$time $metadata[$level] $message\n", format: "\n$time $metadata[$level] $message\n",
metadata: [:request_id] metadata: [:actor, :path, :type, :user]
config :logger, :ex_syslogger, config :logger, :ex_syslogger,
level: :debug, level: :debug,
ident: "pleroma", ident: "pleroma",
format: "$metadata[$level] $message", format: "$metadata[$level] $message",
metadata: [:request_id] metadata: [:actor, :path, :type, :user]
config :mime, :types, %{ config :mime, :types, %{
"application/xml" => ["xml"], "application/xml" => ["xml"],
@ -185,6 +170,7 @@ config :pleroma, :instance,
short_description: "", short_description: "",
background_image: "/images/city.jpg", background_image: "/images/city.jpg",
instance_thumbnail: "/instance/thumbnail.jpeg", instance_thumbnail: "/instance/thumbnail.jpeg",
favicon: "/favicon.png",
limit: 5_000, limit: 5_000,
description_limit: 5_000, description_limit: 5_000,
remote_limit: 100_000, remote_limit: 100_000,
@ -205,12 +191,10 @@ config :pleroma, :instance,
federating: true, federating: true,
federation_incoming_replies_max_depth: 100, federation_incoming_replies_max_depth: 100,
federation_reachability_timeout_days: 7, federation_reachability_timeout_days: 7,
federation_publisher_modules: [
Pleroma.Web.ActivityPub.Publisher
],
allow_relay: true, allow_relay: true,
public: true, public: true,
quarantined_instances: [], quarantined_instances: [],
rejected_instances: [],
static_dir: "instance/static/", static_dir: "instance/static/",
allowed_post_formats: [ allowed_post_formats: [
"text/plain", "text/plain",
@ -360,6 +344,8 @@ config :pleroma, :manifest,
icons: [ icons: [
%{ %{
src: "/static/logo.svg", src: "/static/logo.svg",
sizes: "144x144",
purpose: "any",
type: "image/svg+xml" type: "image/svg+xml"
} }
], ],
@ -427,15 +413,33 @@ config :pleroma, :mrf_vocabulary,
accept: [], accept: [],
reject: [] reject: []
config :pleroma, :mrf_dnsrbl,
nameserver: "127.0.0.1",
port: 53,
zone: "bl.pleroma.com"
# threshold of 7 days # threshold of 7 days
config :pleroma, :mrf_object_age, config :pleroma, :mrf_object_age,
threshold: 604_800, threshold: 604_800,
actions: [:delist, :strip_followers] actions: [:delist, :strip_followers]
config :pleroma, :mrf_nsfw_api,
url: "http://127.0.0.1:5000/",
threshold: 0.7,
mark_sensitive: true,
unlist: false,
reject: false
config :pleroma, :mrf_follow_bot, follower_nickname: nil config :pleroma, :mrf_follow_bot, follower_nickname: nil
config :pleroma, :mrf_inline_quote, template: "<bdi>RT:</bdi> {url}" config :pleroma, :mrf_inline_quote, template: "<bdi>RT:</bdi> {url}"
config :pleroma, :mrf_force_mention,
mention_parent: true,
mention_quoted: true
config :pleroma, :mrf_antimentionspam, user_age_limit: 30_000
config :pleroma, :rich_media, config :pleroma, :rich_media,
enabled: true, enabled: true,
ignore_hosts: [], ignore_hosts: [],
@ -444,8 +448,12 @@ config :pleroma, :rich_media,
Pleroma.Web.RichMedia.Parsers.TwitterCard, Pleroma.Web.RichMedia.Parsers.TwitterCard,
Pleroma.Web.RichMedia.Parsers.OEmbed Pleroma.Web.RichMedia.Parsers.OEmbed
], ],
failure_backoff: 60_000, timeout: 5_000,
ttl_setters: [Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl] ttl_setters: [
Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl,
Pleroma.Web.RichMedia.Parser.TTL.Opengraph
],
max_body: 5_000_000
config :pleroma, :media_proxy, config :pleroma, :media_proxy,
enabled: false, enabled: false,
@ -514,7 +522,8 @@ config :pleroma, :http_security,
sts: false, sts: false,
sts_max_age: 31_536_000, sts_max_age: 31_536_000,
ct_max_age: 2_592_000, ct_max_age: 2_592_000,
referrer_policy: "same-origin" referrer_policy: "same-origin",
allow_unsafe_eval: false
config :cors_plug, config :cors_plug,
max_age: 86_400, max_age: 86_400,
@ -571,29 +580,21 @@ config :pleroma, Pleroma.User,
], ],
email_blacklist: [] email_blacklist: []
# The Pruner :max_age must be longer than Worker :unique
# value or it cannot enforce uniqueness.
config :pleroma, Oban, config :pleroma, Oban,
repo: Pleroma.Repo, repo: Pleroma.Repo,
log: false, log: false,
queues: [ queues: [
activity_expiration: 10, activity_expiration: 10,
token_expiration: 5,
filter_expiration: 1,
backup: 1,
federator_incoming: 5, federator_incoming: 5,
federator_outgoing: 5, federator_outgoing: 25,
ingestion_queue: 50,
web_push: 50, web_push: 50,
mailer: 10, background: 20,
transmogrifier: 20, search_indexing: [limit: 10, paused: true],
scheduled_activities: 10, slow: 5
poll_notifications: 10,
background: 5,
remote_fetcher: 2,
attachments_cleanup: 1,
new_users_digest: 1,
mute_expire: 5
], ],
plugins: [Oban.Plugins.Pruner], plugins: [{Oban.Plugins.Pruner, max_age: 900}],
crontab: [ crontab: [
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker} {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}
@ -602,7 +603,8 @@ config :pleroma, Oban,
config :pleroma, :workers, config :pleroma, :workers,
retries: [ retries: [
federator_incoming: 5, federator_incoming: 5,
federator_outgoing: 5 federator_outgoing: 5,
search_indexing: 2
] ]
config :pleroma, Pleroma.Formatter, config :pleroma, Pleroma.Formatter,
@ -660,12 +662,26 @@ config :pleroma, Pleroma.Emails.UserEmail,
config :pleroma, Pleroma.Emails.NewUsersDigestEmail, enabled: false config :pleroma, Pleroma.Emails.NewUsersDigestEmail, enabled: false
config :prometheus, Pleroma.Web.Endpoint.MetricsExporter, config :pleroma, Pleroma.PromEx,
enabled: false, disabled: false,
auth: false, manual_metrics_start_delay: :no_delay,
ip_whitelist: [], drop_metrics_groups: [],
path: "/api/pleroma/app_metrics", grafana: [
format: :text host: System.get_env("GRAFANA_HOST", "http://localhost:3000"),
auth_token: System.get_env("GRAFANA_TOKEN"),
upload_dashboards_on_start: false,
folder_name: "BEAM",
annotate_app_lifecycle: true
],
metrics_server: [
port: 4021,
path: "/metrics",
protocol: :http,
pool_size: 5,
cowboy_opts: [],
auth_strategy: :none
],
datasource: "Prometheus"
config :pleroma, Pleroma.ScheduledActivity, config :pleroma, Pleroma.ScheduledActivity,
daily_user_limit: 25, daily_user_limit: 25,
@ -800,7 +816,7 @@ config :pleroma, :modules, runtime_dir: "instance/modules"
config :pleroma, configurable_from_database: false config :pleroma, configurable_from_database: false
config :pleroma, Pleroma.Repo, config :pleroma, Pleroma.Repo,
parameters: [gin_fuzzy_search_limit: "500"], parameters: [gin_fuzzy_search_limit: "500", jit: "off"],
prepare: :unnamed prepare: :unnamed
config :pleroma, :connections_pool, config :pleroma, :connections_pool,
@ -814,22 +830,27 @@ config :pleroma, :connections_pool,
config :pleroma, :pools, config :pleroma, :pools,
federation: [ federation: [
size: 50, size: 75,
max_waiting: 10, max_waiting: 20,
recv_timeout: 10_000 recv_timeout: 10_000
], ],
media: [ media: [
size: 50, size: 75,
max_waiting: 20,
recv_timeout: 15_000
],
rich_media: [
size: 25,
max_waiting: 20, max_waiting: 20,
recv_timeout: 15_000 recv_timeout: 15_000
], ],
upload: [ upload: [
size: 25, size: 25,
max_waiting: 5, max_waiting: 20,
recv_timeout: 15_000 recv_timeout: 15_000
], ],
default: [ default: [
size: 10, size: 50,
max_waiting: 2, max_waiting: 2,
recv_timeout: 5_000 recv_timeout: 5_000
] ]
@ -837,15 +858,19 @@ config :pleroma, :pools,
config :pleroma, :hackney_pools, config :pleroma, :hackney_pools,
federation: [ federation: [
max_connections: 50, max_connections: 50,
timeout: 150_000 timeout: 10_000
], ],
media: [ media: [
max_connections: 50, max_connections: 50,
timeout: 150_000 timeout: 15_000
],
rich_media: [
max_connections: 50,
timeout: 15_000
], ],
upload: [ upload: [
max_connections: 25, max_connections: 25,
timeout: 300_000 timeout: 15_000
] ]
config :pleroma, :majic_pool, size: 2 config :pleroma, :majic_pool, size: 2
@ -884,16 +909,44 @@ config :pleroma, Pleroma.User.Backup,
purge_after_days: 30, purge_after_days: 30,
limit_days: 7, limit_days: 7,
dir: nil, dir: nil,
process_wait_time: 30_000, process_chunk_size: 100,
process_chunk_size: 100 timeout: :timer.minutes(30)
config :pleroma, ConcurrentLimiter, [ config :pleroma, ConcurrentLimiter, [
{Pleroma.Web.RichMedia.Helpers, [max_running: 5, max_waiting: 5]}, {Pleroma.Search, [max_running: 30, max_waiting: 50]}
{Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy, [max_running: 5, max_waiting: 5]}
] ]
config :pleroma, Pleroma.Web.WebFinger, domain: nil, update_nickname_on_user_fetch: true config :pleroma, Pleroma.Web.WebFinger, domain: nil, update_nickname_on_user_fetch: true
config :pleroma, Pleroma.Search, module: Pleroma.Search.DatabaseSearch
config :pleroma, Pleroma.Search.Meilisearch,
url: "http://127.0.0.1:7700/",
private_key: nil,
initial_indexing_chunk_size: 100_000
config :pleroma, Pleroma.Application,
background_migrators: true,
internal_fetch: true,
load_custom_modules: true,
max_restarts: 3,
streamer_registry: true
config :pleroma, Pleroma.Uploaders.Uploader, timeout: 30_000
config :pleroma, Pleroma.Search.QdrantSearch,
qdrant_url: "http://127.0.0.1:6333/",
qdrant_api_key: "",
openai_url: "http://127.0.0.1:11345",
# The healthcheck url has to be set to nil when used with the real openai
# API, as it doesn't have a healthcheck endpoint.
openai_healthcheck_url: "http://127.0.0.1:11345/health",
openai_model: "snowflake/snowflake-arctic-embed-xs",
openai_api_key: "",
qdrant_index_configuration: %{
vectors: %{size: 384, distance: "Cosine"}
}
# Import environment specific config. This must remain at the bottom # Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above. # of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs" import_config "#{Mix.env()}.exs"

View File

@ -136,6 +136,31 @@ config :pleroma, :config_description, [
} }
] ]
}, },
%{
group: :pleroma,
key: Pleroma.Uploaders.IPFS,
type: :group,
description: "IPFS uploader-related settings",
children: [
%{
key: :get_gateway_url,
type: :string,
description: "GET Gateway URL",
suggestions: [
"https://ipfs.mydomain.com/{CID}",
"https://{CID}.ipfs.mydomain.com/"
]
},
%{
key: :post_gateway_url,
type: :string,
description: "POST Gateway URL",
suggestions: [
"http://localhost:5001/"
]
}
]
},
%{ %{
group: :pleroma, group: :pleroma,
key: Pleroma.Uploaders.S3, key: Pleroma.Uploaders.S3,
@ -566,6 +591,20 @@ config :pleroma, :config_description, [
"Cool instance" "Cool instance"
] ]
}, },
%{
key: :status_page,
type: :string,
description: "A page where people can see the status of the server during an outage",
suggestions: [
"https://status.pleroma.example.org"
]
},
%{
key: :contact_username,
type: :string,
description: "Instance owner username",
suggestions: ["admin"]
},
%{ %{
key: :limit, key: :limit,
type: :integer, type: :integer,
@ -735,6 +774,18 @@ config :pleroma, :config_description, [
{"*.quarantined.com", "Reason"} {"*.quarantined.com", "Reason"}
] ]
}, },
%{
key: :rejected_instances,
type: {:list, :tuple},
key_placeholder: "instance",
value_placeholder: "reason",
description:
"List of ActivityPub instances to reject requests from if authorized_fetch_mode is enabled",
suggestions: [
{"rejected.com", "Reason"},
{"*.rejected.com", "Reason"}
]
},
%{ %{
key: :static_dir, key: :static_dir,
type: :string, type: :string,
@ -987,6 +1038,12 @@ config :pleroma, :config_description, [
"The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.", "The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.",
suggestions: ["/instance/thumbnail.jpeg"] suggestions: ["/instance/thumbnail.jpeg"]
}, },
%{
key: :favicon,
type: {:string, :image},
description: "Favicon of the instance",
suggestions: ["/favicon.png"]
},
%{ %{
key: :show_reactions, key: :show_reactions,
type: :boolean, type: :boolean,
@ -1171,79 +1228,6 @@ config :pleroma, :config_description, [
} }
] ]
}, },
%{
group: :logger,
type: :group,
description: "Logger-related settings",
children: [
%{
key: :backends,
type: [:atom, :tuple, :module],
description:
"Where logs will be sent, :console - send logs to stdout, { ExSyslogger, :ex_syslogger } - to syslog, Quack.Logger - to Slack.",
suggestions: [:console, {ExSyslogger, :ex_syslogger}, Quack.Logger]
}
]
},
%{
group: :logger,
type: :group,
key: :ex_syslogger,
label: "ExSyslogger",
description: "ExSyslogger-related settings",
children: [
%{
key: :level,
type: {:dropdown, :atom},
description: "Log level",
suggestions: [:debug, :info, :warn, :error]
},
%{
key: :ident,
type: :string,
description:
"A string that's prepended to every message, and is typically set to the app name",
suggestions: ["pleroma"]
},
%{
key: :format,
type: :string,
description: "Default: \"$date $time [$level] $levelpad$node $metadata $message\"",
suggestions: ["$metadata[$level] $message"]
},
%{
key: :metadata,
type: {:list, :atom},
suggestions: [:request_id]
}
]
},
%{
group: :logger,
type: :group,
key: :console,
label: "Console Logger",
description: "Console logger settings",
children: [
%{
key: :level,
type: {:dropdown, :atom},
description: "Log level",
suggestions: [:debug, :info, :warn, :error]
},
%{
key: :format,
type: :string,
description: "Default: \"$date $time [$level] $levelpad$node $metadata $message\"",
suggestions: ["$metadata[$level] $message"]
},
%{
key: :metadata,
type: {:list, :atom},
suggestions: [:request_id]
}
]
},
%{ %{
group: :pleroma, group: :pleroma,
key: :frontend_configurations, key: :frontend_configurations,
@ -1438,7 +1422,7 @@ config :pleroma, :config_description, [
label: "Subject line behavior", label: "Subject line behavior",
type: :string, type: :string,
description: "Allows changing the default behaviour of subject lines in replies. description: "Allows changing the default behaviour of subject lines in replies.
`email`: copy and preprend re:, as in email, `email`: copy and prepend re:, as in email,
`masto`: copy verbatim, as in Mastodon, `masto`: copy verbatim, as in Mastodon,
`noop`: don't copy the subject.", `noop`: don't copy the subject.",
suggestions: ["email", "masto", "noop"] suggestions: ["email", "masto", "noop"]
@ -1771,6 +1755,12 @@ config :pleroma, :config_description, [
type: :boolean, type: :boolean,
description: "Require HTTP signatures for AP fetches" description: "Require HTTP signatures for AP fetches"
}, },
%{
key: :authorized_fetch_mode_exceptions,
type: {:list, :string},
description:
"List of IPs (CIDR format accepted) to exempt from HTTP Signatures requirement (for example to allow debugging, you shouldn't otherwise need this)"
},
%{ %{
key: :note_replies_output_limit, key: :note_replies_output_limit,
type: :integer, type: :integer,
@ -1931,7 +1921,7 @@ config :pleroma, :config_description, [
key: :log, key: :log,
type: {:dropdown, :atom}, type: {:dropdown, :atom},
description: "Logs verbose mode", description: "Logs verbose mode",
suggestions: [false, :error, :warn, :info, :debug] suggestions: [false, :error, :warning, :info, :debug]
}, },
%{ %{
key: :queues, key: :queues,
@ -2111,11 +2101,11 @@ config :pleroma, :config_description, [
] ]
}, },
%{ %{
key: :failure_backoff, key: :timeout,
type: :integer, type: :integer,
description: description:
"Amount of milliseconds after request failure, during which the request will not be retried.", "Amount of milliseconds after which the HTTP request is forcibly terminated.",
suggestions: [60_000] suggestions: [5_000]
} }
] ]
}, },
@ -3090,7 +3080,7 @@ config :pleroma, :config_description, [
key: :max_waiting, key: :max_waiting,
type: :integer, type: :integer,
description: description:
"Maximum number of requests waiting for other requests to finish. After this number is reached, the pool will start returning errrors when a new request is made", "Maximum number of requests waiting for other requests to finish. After this number is reached, the pool will start returning errors when a new request is made",
suggestions: [10] suggestions: [10]
}, },
%{ %{
@ -3356,7 +3346,7 @@ config :pleroma, :config_description, [
%{ %{
key: :purge_after_days, key: :purge_after_days,
type: :integer, type: :integer,
description: "Remove backup achives after N days", description: "Remove backup archives after N days",
suggestions: [30] suggestions: [30]
}, },
%{ %{
@ -3365,20 +3355,19 @@ config :pleroma, :config_description, [
description: "Limit user to export not more often than once per N days", description: "Limit user to export not more often than once per N days",
suggestions: [7] suggestions: [7]
}, },
%{
key: :process_wait_time,
type: :integer,
label: "Process Wait Time",
description:
"The amount of time to wait for backup to report progress, in milliseconds. If no progress is received from the backup job for that much time, terminate it and deem it failed.",
suggestions: [30_000]
},
%{ %{
key: :process_chunk_size, key: :process_chunk_size,
type: :integer, type: :integer,
label: "Process Chunk Size", label: "Process Chunk Size",
description: "The number of activities to fetch in the backup job for each chunk.", description: "The number of activities to fetch in the backup job for each chunk.",
suggestions: [100] suggestions: [100]
},
%{
key: :timeout,
type: :integer,
label: "Timeout",
description: "The amount of time to wait for backup to complete in seconds.",
suggestions: [1_800]
} }
] ]
}, },
@ -3466,5 +3455,48 @@ config :pleroma, :config_description, [
] ]
} }
] ]
},
%{
group: :pleroma,
key: Pleroma.Search,
type: :group,
description: "General search settings.",
children: [
%{
key: :module,
type: :keyword,
description: "Selected search module.",
suggestion: [Pleroma.Search.DatabaseSearch, Pleroma.Search.Meilisearch]
}
]
},
%{
group: :pleroma,
key: Pleroma.Search.Meilisearch,
type: :group,
description: "Meilisearch settings.",
children: [
%{
key: :url,
type: :string,
description: "Meilisearch URL.",
suggestion: ["http://127.0.0.1:7700/"]
},
%{
key: :private_key,
type: :string,
description:
"Private key for meilisearch authentication, or `nil` to disable private key authentication.",
suggestion: [nil]
},
%{
key: :initial_indexing_chunk_size,
type: :integer,
description:
"Amount of posts in a batch when running the initial indexing operation. Should probably not be more than 100000" <>
" since there's a limit on maximum insert size",
suggestion: [100_000]
}
]
} }
] ]

View File

@ -8,8 +8,7 @@ import Config
# with brunch.io to recompile .js and .css sources. # with brunch.io to recompile .js and .css sources.
config :pleroma, Pleroma.Web.Endpoint, config :pleroma, Pleroma.Web.Endpoint,
http: [ http: [
port: 4000, port: 4000
protocol_options: [max_request_line_length: 8192, max_header_value_length: 8192]
], ],
protocol: "http", protocol: "http",
debug_errors: true, debug_errors: true,
@ -36,8 +35,8 @@ config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Local
# configured to run both http and https servers on # configured to run both http and https servers on
# different ports. # different ports.
# Do not include metadata nor timestamps in development logs # Do not include timestamps in development logs
config :logger, :console, format: "[$level] $message\n" config :logger, Logger.Backends.Console, format: "$metadata[$level] $message\n"
# Set a higher stacktrace during development. Avoid configuring such # Set a higher stacktrace during development. Avoid configuring such
# in production as building large stacktraces may be expensive. # in production as building large stacktraces may be expensive.

View File

@ -20,6 +20,7 @@ config :pleroma, Pleroma.Web.Endpoint,
config :phoenix, serve_endpoints: true config :phoenix, serve_endpoints: true
# Do not print debug messages in production # Do not print debug messages in production
config :logger, Logger.Backends.Console, level: :info
config :logger, :console, level: :info config :logger, :console, level: :info
config :logger, :ex_syslogger, level: :info config :logger, :ex_syslogger, level: :info

View File

@ -16,7 +16,7 @@ config :pleroma, Pleroma.Captcha,
# Print only warnings and errors during test # Print only warnings and errors during test
config :logger, :console, config :logger, :console,
level: :warn, level: :warning,
format: "\n[$level] $message\n" format: "\n[$level] $message\n"
config :pleroma, :auth, oauth_consumer_strategies: [] config :pleroma, :auth, oauth_consumer_strategies: []
@ -49,7 +49,8 @@ config :pleroma, Pleroma.Repo,
hostname: System.get_env("DB_HOST") || "localhost", hostname: System.get_env("DB_HOST") || "localhost",
port: System.get_env("DB_PORT") || "5432", port: System.get_env("DB_PORT") || "5432",
pool: Ecto.Adapters.SQL.Sandbox, pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 50 pool_size: System.schedulers_online() * 2,
log: false
config :pleroma, :dangerzone, override_repo_pool_size: true config :pleroma, :dangerzone, override_repo_pool_size: true
@ -61,7 +62,8 @@ config :tesla, adapter: Tesla.Mock
config :pleroma, :rich_media, config :pleroma, :rich_media,
enabled: false, enabled: false,
ignore_hosts: [], ignore_hosts: [],
ignore_tld: ["local", "localdomain", "lan"] ignore_tld: ["local", "localdomain", "lan"],
max_body: 2_000_000
config :pleroma, :instance, config :pleroma, :instance,
multi_factor_authentication: [ multi_factor_authentication: [
@ -133,10 +135,61 @@ config :pleroma, :side_effects,
ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock, ap_streamer: Pleroma.Web.ActivityPub.ActivityPubMock,
logger: Pleroma.LoggerMock logger: Pleroma.LoggerMock
config :pleroma, Pleroma.Search, module: Pleroma.Search.DatabaseSearch
config :pleroma, Pleroma.Search.Meilisearch, url: "http://127.0.0.1:7700/", private_key: nil
# Reduce recompilation time # Reduce recompilation time
# https://dashbit.co/blog/speeding-up-re-compilation-of-elixir-projects # https://dashbit.co/blog/speeding-up-re-compilation-of-elixir-projects
config :phoenix, :plug_init_mode, :runtime config :phoenix, :plug_init_mode, :runtime
config :pleroma, :config_impl, Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.PromEx, disabled: true
# Mox definitions. Only read during compile time.
config :pleroma, Pleroma.User.Backup, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Uploaders.S3, ex_aws_impl: Pleroma.Uploaders.S3.ExAwsMock
config :pleroma, Pleroma.Uploaders.S3, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Upload, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.ScheduledActivity, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Web.RichMedia.Helpers, config_impl: Pleroma.StaticStubbedConfigMock
config :pleroma, Pleroma.Uploaders.IPFS, config_impl: Pleroma.UnstubbedConfigMock
config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, config_impl: Pleroma.StaticStubbedConfigMock
config :pleroma, Pleroma.Web.Plugs.HTTPSignaturePlug, config_impl: Pleroma.StaticStubbedConfigMock
config :pleroma, Pleroma.Signature, http_signatures_impl: Pleroma.StubbedHTTPSignaturesMock
peer_module =
if String.to_integer(System.otp_release()) >= 25 do
:peer
else
:slave
end
config :pleroma, Pleroma.Cluster, peer_module: peer_module
config :pleroma, Pleroma.Application,
background_migrators: false,
internal_fetch: false,
load_custom_modules: false,
max_restarts: 100,
streamer_registry: false,
test_http_pools: true
config :pleroma, Pleroma.Web.Streaming, sync_streaming: true
config :pleroma, Pleroma.Uploaders.Uploader, timeout: 1_000
config :pleroma, Pleroma.Emoji.Loader, test_emoji: true
config :pleroma, Pleroma.Web.RichMedia.Backfill,
stream_out: Pleroma.Web.ActivityPub.ActivityPubMock
config :pleroma, Pleroma.Web.Plugs.HTTPSecurityPlug, enable: false
config :pleroma, Pleroma.User.Backup, tempdir: "test/tmp"
if File.exists?("./config/test.secret.exs") do if File.exists?("./config/test.secret.exs") do
import_config "test.secret.exs" import_config "test.secret.exs"
else else

View File

@ -1,4 +1,4 @@
# Transfering the config to/from the database # Transferring the config to/from the database
{! backend/administration/CLI_tasks/general_cli_task_info.include !} {! backend/administration/CLI_tasks/general_cli_task_info.include !}
@ -34,7 +34,7 @@
Options: Options:
- `<path>` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non standart folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/pleroma`. For installation from source - `config` directory in the pleroma folder. - `<path>` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non-standard folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/pleroma`. For installation from source - `config` directory in the pleroma folder.
- `<env>` - environment, for which is migrated config. By default is `prod`. - `<env>` - environment, for which is migrated config. By default is `prod`.
- To delete transferred settings from database optional flag `-d` can be used - To delete transferred settings from database optional flag `-d` can be used
@ -154,4 +154,19 @@ This forcibly removes all saved values in the database.
```sh ```sh
mix pleroma.config [--force] reset mix pleroma.config [--force] reset
```
## Remove invalid MRF modules from the database
This forcibly removes any enabled MRF that does not exist and will fix the ability of the instance to start.
=== "OTP"
```sh
./bin/pleroma_ctl config fix_mrf_policies
```
=== "From Source"
```sh
mix pleroma.config fix_mrf_policies
``` ```

View File

@ -21,16 +21,18 @@ Replaces embedded objects with references to them in the `objects` table. Only n
mix pleroma.database remove_embedded_objects [option ...] mix pleroma.database remove_embedded_objects [option ...]
``` ```
### Options ### Options
- `--vacuum` - run `VACUUM FULL` after the embedded objects are replaced with their references - `--vacuum` - run `VACUUM FULL` after the embedded objects are replaced with their references
## Prune old remote posts from the database ## Prune old remote posts from the database
This will prune remote posts older than 90 days (configurable with [`config :pleroma, :instance, remote_post_retention_days`](../../configuration/cheatsheet.md#instance)) from the database, they will be refetched from source when accessed. This will prune remote posts older than 90 days (configurable with [`config :pleroma, :instance, remote_post_retention_days`](../../configuration/cheatsheet.md#instance)) from the database. Pruned posts may be refetched in some cases.
!!! note
The disk space will only be reclaimed after a proper vacuum. By default Postgresql does this for you on a regular basis, but if your instance has been running for a long time and there are many rows deleted, it may be advantageous to use `VACUUM FULL` (e.g. by using the `--vacuum` option).
!!! danger !!! danger
The disk space will only be reclaimed after `VACUUM FULL`. You may run out of disk space during the execution of the task or vacuuming if you don't have about 1/3rds of the database size free. You may run out of disk space during the execution of the task or vacuuming if you don't have about 1/3rds of the database size free. Vacuum causes a substantial increase in I/O traffic, and may lead to a degraded experience while it is running.
=== "OTP" === "OTP"
@ -45,7 +47,11 @@ This will prune remote posts older than 90 days (configurable with [`config :ple
``` ```
### Options ### Options
- `--vacuum` - run `VACUUM FULL` after the objects are pruned
- `--keep-threads` - Don't prune posts when they are part of a thread where at least one post has seen local interaction (e.g. one of the posts is a local post, or is favourited by a local user, or has been repeated by a local user...). It also won't delete posts when at least one of the posts in that thread is kept (e.g. because one of the posts has seen recent activity).
- `--keep-non-public` - Keep non-public posts like DM's and followers-only, even if they are remote.
- `--prune-orphaned-activities` - Also prune orphaned activities afterwards. Activities are things like Like, Create, Announce, Flag (aka reports). They can significantly help reduce the database size. Note: this can take a very long time.
- `--vacuum` - Run `VACUUM FULL` after the objects are pruned. This should not be used on a regular basis, but is useful if your instance has been running for a long time before pruning.
## Create a conversation for all existing DMs ## Create a conversation for all existing DMs
@ -93,6 +99,9 @@ Can be safely re-run
## Vacuum the database ## Vacuum the database
!!! note
By default Postgresql has an autovacuum deamon running. While the tasks described here can help in some cases, they shouldn't be needed on a regular basis. See [the Postgresql docs on vacuuming](https://www.postgresql.org/docs/current/sql-vacuum.html) for more information on this.
### Analyze ### Analyze
Running an `analyze` vacuum job can improve performance by updating statistics used by the query planner. **It is safe to cancel this.** Running an `analyze` vacuum job can improve performance by updating statistics used by the query planner. **It is safe to cancel this.**

View File

@ -31,7 +31,7 @@
1. Optionally you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse. 1. Optionally you can remove the users of your instance. This will trigger delete requests for their accounts and posts. Note that this is 'best effort' and doesn't mean that all traces of your instance will be gone from the fediverse.
* You can do this from the admin-FE where you can select all local users and delete the accounts using the *Moderate multiple users* dropdown. * You can do this from the admin-FE where you can select all local users and delete the accounts using the *Moderate multiple users* dropdown.
* You can also list local users and delete them individualy using the CLI tasks for [Managing users](./CLI_tasks/user.md). * You can also list local users and delete them individually using the CLI tasks for [Managing users](./CLI_tasks/user.md).
2. Stop the Pleroma service `systemctl stop pleroma` 2. Stop the Pleroma service `systemctl stop pleroma`
3. Disable pleroma from systemd `systemctl disable pleroma` 3. Disable pleroma from systemd `systemctl disable pleroma`
4. Remove the files and folders you created during installation (see installation guide). This includes the pleroma, nginx and systemd files and folders. 4. Remove the files and folders you created during installation (see installation guide). This includes the pleroma, nginx and systemd files and folders.

View File

@ -41,6 +41,7 @@ To add configuration to your config file, you can copy it from the base config.
* `allow_relay`: Permits remote instances to subscribe to all public posts of your instance. This may increase the visibility of your instance. * `allow_relay`: Permits remote instances to subscribe to all public posts of your instance. This may increase the visibility of your instance.
* `public`: Makes the client API in authenticated mode-only except for user-profiles. Useful for disabling the Local Timeline and The Whole Known Network. Note that there is a dependent setting restricting or allowing unauthenticated access to specific resources, see `restrict_unauthenticated` for more details. * `public`: Makes the client API in authenticated mode-only except for user-profiles. Useful for disabling the Local Timeline and The Whole Known Network. Note that there is a dependent setting restricting or allowing unauthenticated access to specific resources, see `restrict_unauthenticated` for more details.
* `quarantined_instances`: ActivityPub instances where private (DMs, followers-only) activities will not be send. * `quarantined_instances`: ActivityPub instances where private (DMs, followers-only) activities will not be send.
* `rejected_instances`: ActivityPub instances to reject requests from if authorized_fetch_mode is enabled.
* `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML). * `allowed_post_formats`: MIME-type list of formats allowed to be posted (transformed into HTML).
* `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with * `extended_nickname_format`: Set to `true` to use extended local nicknames format (allows underscores/dashes). This will break federation with
older software for theses nicknames. older software for theses nicknames.
@ -154,14 +155,15 @@ To add configuration to your config file, you can copy it from the base config.
* `Pleroma.Web.ActivityPub.MRF.MentionPolicy`: Drops posts mentioning configurable users. (See [`:mrf_mention`](#mrf_mention)). * `Pleroma.Web.ActivityPub.MRF.MentionPolicy`: Drops posts mentioning configurable users. (See [`:mrf_mention`](#mrf_mention)).
* `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)). * `Pleroma.Web.ActivityPub.MRF.VocabularyPolicy`: Restricts activities to a configured set of vocabulary. (See [`:mrf_vocabulary`](#mrf_vocabulary)).
* `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)). * `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)).
* `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.Workers.PurgeExpiredActivity` to be enabled for processing the scheduled delections. * `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.Workers.PurgeExpiredActivity` to be enabled for processing the scheduled deletions.
* `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines. * `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines.
* `Pleroma.Web.ActivityPub.MRF.FollowBotPolicy`: Automatically follows newly discovered users from the specified bot account. Local accounts, locked accounts, and users with "#nobot" in their bio are respected and excluded from being followed. * `Pleroma.Web.ActivityPub.MRF.FollowBotPolicy`: Automatically follows newly discovered users from the specified bot account. Local accounts, locked accounts, and users with "#nobot" in their bio are respected and excluded from being followed.
* `Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy`: Drops follow requests from followbots. Users can still allow bots to follow them by first following the bot. * `Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy`: Drops follow requests from followbots. Users can still allow bots to follow them by first following the bot.
* `Pleroma.Web.ActivityPub.MRF.KeywordPolicy`: Rejects or removes from the federated timeline or replaces keywords. (See [`:mrf_keyword`](#mrf_keyword)). * `Pleroma.Web.ActivityPub.MRF.KeywordPolicy`: Rejects or removes from the federated timeline or replaces keywords. (See [`:mrf_keyword`](#mrf_keyword)).
* `Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent`: Forces every mentioned user to be reflected in the post content. * `Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent`: Forces every mentioned user to be reflected in the post content.
* `Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy`: Forces quote post URLs to be reflected in the message content inline. * `Pleroma.Web.ActivityPub.MRF.InlineQuotePolicy`: Forces quote post URLs to be reflected in the message content inline.
* `Pleroma.Web.ActivityPub.MRF.QuoteToLinkTagPolicy`: Force a Link tag for posts quoting another post. (may break outgoing federation of quote posts with older Pleroma versions) * `Pleroma.Web.ActivityPub.MRF.QuoteToLinkTagPolicy`: Force a Link tag for posts quoting another post. (may break outgoing federation of quote posts with older Pleroma versions).
* `Pleroma.Web.ActivityPub.MRF.ForceMention`: Forces posts to include a mention of the author of parent post or the author of quoted post.
* `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo). * `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo).
* `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value. * `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value.
@ -272,6 +274,10 @@ Notes:
#### :mrf_inline_quote #### :mrf_inline_quote
* `template`: The template to append to the post. `{url}` will be replaced with the actual link to the quoted post. Default: `<bdi>RT:</bdi> {url}` * `template`: The template to append to the post. `{url}` will be replaced with the actual link to the quoted post. Default: `<bdi>RT:</bdi> {url}`
#### :mrf_force_mention
* `mention_parent`: Whether to append mention of parent post author
* `mention_quoted`: Whether to append mention of parent quoted author
### :activitypub ### :activitypub
* `unfollow_blocked`: Whether blocks result in people getting unfollowed * `unfollow_blocked`: Whether blocks result in people getting unfollowed
* `outgoing_blocks`: Whether to federate blocks to other instances * `outgoing_blocks`: Whether to federate blocks to other instances
@ -279,6 +285,7 @@ Notes:
* `deny_follow_blocked`: Whether to disallow following an account that has blocked the user in question * `deny_follow_blocked`: Whether to disallow following an account that has blocked the user in question
* `sign_object_fetches`: Sign object fetches with HTTP signatures * `sign_object_fetches`: Sign object fetches with HTTP signatures
* `authorized_fetch_mode`: Require HTTP signatures for AP fetches * `authorized_fetch_mode`: Require HTTP signatures for AP fetches
* `authorized_fetch_mode_exceptions`: List of IPs (CIDR format accepted) to exempt from HTTP Signatures requirement (for example to allow debugging, you shouldn't otherwise need this)
## Pleroma.User ## Pleroma.User
@ -429,7 +436,7 @@ config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Http,
* `ignore_hosts`: list of hosts which will be ignored by the metadata parser. For example `["accounts.google.com", "xss.website"]`, defaults to `[]`. * `ignore_hosts`: list of hosts which will be ignored by the metadata parser. For example `["accounts.google.com", "xss.website"]`, defaults to `[]`.
* `ignore_tld`: list TLDs (top-level domains) which will ignore for parse metadata. default is ["local", "localdomain", "lan"]. * `ignore_tld`: list TLDs (top-level domains) which will ignore for parse metadata. default is ["local", "localdomain", "lan"].
* `parsers`: list of Rich Media parsers. * `parsers`: list of Rich Media parsers.
* `failure_backoff`: Amount of milliseconds after request failure, during which the request will not be retried. * `timeout`: Amount of milliseconds after which the HTTP request is forcibly terminated.
## HTTP server ## HTTP server
@ -467,6 +474,7 @@ This will make Pleroma listen on `127.0.0.1` port `8080` and generate urls start
* ``ct_max_age``: The maximum age for the `Expect-CT` header if sent. * ``ct_max_age``: The maximum age for the `Expect-CT` header if sent.
* ``referrer_policy``: The referrer policy to use, either `"same-origin"` or `"no-referrer"`. * ``referrer_policy``: The referrer policy to use, either `"same-origin"` or `"no-referrer"`.
* ``report_uri``: Adds the specified url to `report-uri` and `report-to` group in CSP header. * ``report_uri``: Adds the specified url to `report-uri` and `report-to` group in CSP header.
* `allow_unsafe_eval`: Adds `wasm-unsafe-eval` to the CSP header. Needed for some non-essential frontend features like Flash emulation.
### Pleroma.Web.Plugs.RemoteIp ### Pleroma.Web.Plugs.RemoteIp
@ -506,7 +514,7 @@ config :pleroma, :rate_limit,
Means that: Means that:
1. In 60 seconds, 15 authentication attempts can be performed from the same IP address. 1. In 60 seconds, 15 authentication attempts can be performed from the same IP address.
2. In 1 second, 10 search requests can be performed from the same IP adress by unauthenticated users, while authenticated users can perform 30 search requests per second. 2. In 1 second, 10 search requests can be performed from the same IP address by unauthenticated users, while authenticated users can perform 30 search requests per second.
Supported rate limiters: Supported rate limiters:
@ -656,6 +664,19 @@ config :ex_aws, :s3,
host: "s3.eu-central-1.amazonaws.com" host: "s3.eu-central-1.amazonaws.com"
``` ```
#### Pleroma.Uploaders.IPFS
* `post_gateway_url`: URL with port of POST Gateway (unauthenticated)
* `get_gateway_url`: URL of public GET Gateway
Example:
```elixir
config :pleroma, Pleroma.Uploaders.IPFS,
post_gateway_url: "http://localhost:5001",
get_gateway_url: "http://{CID}.ipfs.mydomain.com"
```
### Upload filters ### Upload filters
#### Pleroma.Upload.Filter.AnonymizeFilename #### Pleroma.Upload.Filter.AnonymizeFilename
@ -832,7 +853,7 @@ config :logger,
backends: [{ExSyslogger, :ex_syslogger}] backends: [{ExSyslogger, :ex_syslogger}]
config :logger, :ex_syslogger, config :logger, :ex_syslogger,
level: :warn level: :warning
``` ```
Another example, keeping console output and adding the pid to syslog output: Another example, keeping console output and adding the pid to syslog output:
@ -841,7 +862,7 @@ config :logger,
backends: [:console, {ExSyslogger, :ex_syslogger}] backends: [:console, {ExSyslogger, :ex_syslogger}]
config :logger, :ex_syslogger, config :logger, :ex_syslogger,
level: :warn, level: :warning,
option: [:pid, :ndelay] option: [:pid, :ndelay]
``` ```
@ -1081,7 +1102,7 @@ config :pleroma, Pleroma.Formatter,
## :configurable_from_database ## :configurable_from_database
Boolean, enables/disables in-database configuration. Read [Transfering the config to/from the database](../administration/CLI_tasks/config.md) for more information. Boolean, enables/disables in-database configuration. Read [Transferring the config to/from the database](../administration/CLI_tasks/config.md) for more information.
## :database_config_whitelist ## :database_config_whitelist
@ -1142,7 +1163,7 @@ Control favicons for instances.
!!! note !!! note
Requires enabled email Requires enabled email
* `:purge_after_days` an integer, remove backup achives after N days. * `:purge_after_days` an integer, remove backup achieves after N days.
* `:limit_days` an integer, limit user to export not more often than once per N days. * `:limit_days` an integer, limit user to export not more often than once per N days.
* `:dir` a string with a path to backup temporary directory or `nil` to let Pleroma choose temporary directory in the following order: * `:dir` a string with a path to backup temporary directory or `nil` to let Pleroma choose temporary directory in the following order:
1. the directory named by the TMPDIR environment variable 1. the directory named by the TMPDIR environment variable
@ -1150,6 +1171,7 @@ Control favicons for instances.
3. the directory named by the TMP environment variable 3. the directory named by the TMP environment variable
4. C:\TMP on Windows or /tmp on Unix-like operating systems 4. C:\TMP on Windows or /tmp on Unix-like operating systems
5. as a last resort, the current working directory 5. as a last resort, the current working directory
* `:timeout` an integer representing seconds
## Frontend management ## Frontend management

View File

@ -29,7 +29,7 @@ foo, /emoji/custom/foo.png
The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon. The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon.
Default file extentions and locations for emojis are set in `config.exs`. To use different locations or file-extentions, add the `shortcode_globs` to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it. Note that not all fediverse-software will show emojis with other file extentions: Default file extensions and locations for emojis are set in `config.exs`. To use different locations or file-extensions, add the `shortcode_globs` to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it. Note that not all fediverse-software will show emojis with other file extensions:
```elixir ```elixir
config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png", "/emoji/custom/**/*.gif"] config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png", "/emoji/custom/**/*.gif"]
``` ```

View File

@ -1,4 +1,4 @@
# I2P Federation and Accessability # I2P Federation and Accessibility
This guide is going to focus on the Pleroma federation aspect. The actual installation is neatly explained in the official documentation, and more likely to remain up-to-date. This guide is going to focus on the Pleroma federation aspect. The actual installation is neatly explained in the official documentation, and more likely to remain up-to-date.
It might be added to this guide if there will be a need for that. It might be added to this guide if there will be a need for that.

View File

@ -29,7 +29,7 @@ HiddenServiceDir /var/lib/tor/pleroma_hidden_service/
HiddenServicePort 80 127.0.0.1:8099 HiddenServicePort 80 127.0.0.1:8099
HiddenServiceVersion 3 # Remove if Tor version is below 0.3 ( tor --version ) HiddenServiceVersion 3 # Remove if Tor version is below 0.3 ( tor --version )
``` ```
Restart Tor to generate an adress: Restart Tor to generate an address:
``` ```
systemctl restart tor@default.service systemctl restart tor@default.service
``` ```

View File

@ -1,6 +1,6 @@
# Optimizing the BEAM # Optimizing the BEAM
Pleroma is built upon the Erlang/OTP VM known as BEAM. The BEAM VM is highly optimized for latency, but this has drawbacks in environments without dedicated hardware. One of the tricks used by the BEAM VM is [busy waiting](https://en.wikipedia.org/wiki/Busy_waiting). This allows the application to pretend to be busy working so the OS kernel does not pause the application process and switch to another process waiting for the CPU to execute its workload. It does this by spinning for a period of time which inflates the apparent CPU usage of the application so it is immediately ready to execute another task. This can be observed with utilities like **top(1)** which will show consistently high CPU usage for the process. Switching between procesess is a rather expensive operation and also clears CPU caches further affecting latency and performance. The goal of busy waiting is to avoid this penalty. Pleroma is built upon the Erlang/OTP VM known as BEAM. The BEAM VM is highly optimized for latency, but this has drawbacks in environments without dedicated hardware. One of the tricks used by the BEAM VM is [busy waiting](https://en.wikipedia.org/wiki/Busy_waiting). This allows the application to pretend to be busy working so the OS kernel does not pause the application process and switch to another process waiting for the CPU to execute its workload. It does this by spinning for a period of time which inflates the apparent CPU usage of the application so it is immediately ready to execute another task. This can be observed with utilities like **top(1)** which will show consistently high CPU usage for the process. Switching between processes is a rather expensive operation and also clears CPU caches further affecting latency and performance. The goal of busy waiting is to avoid this penalty.
This strategy is very successful in making a performant and responsive application, but is not desirable on Virtual Machines or hardware with few CPU cores. Pleroma instances are often deployed on the same server as the required PostgreSQL database which can lead to situations where the Pleroma application is holding the CPU in a busy-wait loop and as a result the database cannot process requests in a timely manner. The fewer CPUs available, the more this problem is exacerbated. The latency is further amplified by the OS being installed on a Virtual Machine as the Hypervisor uses CPU time-slicing to pause the entire OS and switch between other tasks. This strategy is very successful in making a performant and responsive application, but is not desirable on Virtual Machines or hardware with few CPU cores. Pleroma instances are often deployed on the same server as the required PostgreSQL database which can lead to situations where the Pleroma application is holding the CPU in a busy-wait loop and as a result the database cannot process requests in a timely manner. The fewer CPUs available, the more this problem is exacerbated. The latency is further amplified by the OS being installed on a Virtual Machine as the Hypervisor uses CPU time-slicing to pause the entire OS and switch between other tasks.

View File

@ -22,7 +22,7 @@ config :pleroma, Pleroma.Repo,
] ]
``` ```
A more detailed explaination of the issue can be found at <https://blog.soykaf.com/post/postgresql-elixir-troubles/>. A more detailed explanation of the issue can be found at <https://blog.soykaf.com/post/postgresql-elixir-troubles/>.
## Example configurations ## Example configurations

View File

@ -0,0 +1,147 @@
# Configuring search
{! backend/administration/CLI_tasks/general_cli_task_info.include !}
## Built-in search
To use built-in search that has no external dependencies, set the search module to `Pleroma.Activity`:
> config :pleroma, Pleroma.Search, module: Pleroma.Search.DatabaseSearch
While it has no external dependencies, it has problems with performance and relevancy.
## QdrantSearch
This uses the vector search engine [Qdrant](https://qdrant.tech) to search the posts in a vector space. This needs a way to generate embeddings and uses the [OpenAI API](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings). This is implemented by several project besides OpenAI itself, including the python-based fastembed-server found in `supplemental/search/fastembed-api`.
The default settings will support a setup where both the fastembed server and Qdrant run on the same system as pleroma. To use it, set the search provider and run the fastembed server, see the README in `supplemental/search/fastembed-api`:
> config :pleroma, Pleroma.Search, module: Pleroma.Search.QdrantSearch
Then, start the Qdrant server, see [here](https://qdrant.tech/documentation/quick-start/) for instructions.
You will also need to create the Qdrant index once by running `mix pleroma.search.indexer create_index`. Running `mix pleroma.search.indexer index` will retroactively index the last 100_000 activities.
### Indexing and model options
To see the available configuration options, check out the QdrantSearch section in `config/config.exs`.
The default indexing option work for the default model (`snowflake-arctic-embed-xs`). To optimize for a low memory footprint, adjust the index configuration as described in the [Qdrant docs](https://qdrant.tech/documentation/guides/optimize/). See also [this blog post](https://qdrant.tech/articles/memory-consumption/) that goes into detail.
Different embedding models will need different vector size settings. You can see a list of the models supported by the fastembed server [here](https://qdrant.github.io/fastembed/examples/Supported_Models), including their vector dimensions. These vector dimensions need to be set in the `qdrant_index_configuration`.
E.g, If you want to use `sentence-transformers/all-MiniLM-L6-v2` as a model, you will not need to adjust things, because it and `snowflake-arctic-embed-xs` are both 384 dimensional models. If you want to use `snowflake/snowflake-arctic-embed-l`, you will need to adjust the `size` parameter in the `qdrant_index_configuration` to 1024, as it has a dimension of 1024.
When using a different model, you will need do drop the index and recreate it (`mix pleroma.search.indexer drop_index` and `mix pleroma.search.indexer create_index`), as the different embeddings are not compatible with each other.
## Meilisearch
Note that it's quite a bit more memory hungry than PostgreSQL (around 4-5G for ~1.2 million
posts while idle and up to 7G while indexing initially). The disk usage for this additional index is also
around 4 gigabytes. Like [RUM](./cheatsheet.md#rum-indexing-for-full-text-search) indexes, it offers considerably
higher performance and ordering by timestamp in a reasonable amount of time.
Additionally, the search results seem to be more accurate.
Due to high memory usage, it may be best to set it up on a different machine, if running pleroma on a low-resource
computer, and use private key authentication to secure the remote search instance.
To use [meilisearch](https://www.meilisearch.com/), set the search module to `Pleroma.Search.Meilisearch`:
> config :pleroma, Pleroma.Search, module: Pleroma.Search.Meilisearch
You then need to set the address of the meilisearch instance, and optionally the private key for authentication. You might
also want to change the `initial_indexing_chunk_size` to be smaller if you're server is not very powerful, but not higher than `100_000`,
because meilisearch will refuse to process it if it's too big. However, in general you want this to be as big as possible, because meilisearch
indexes faster when it can process many posts in a single batch.
> config :pleroma, Pleroma.Search.Meilisearch,
> url: "http://127.0.0.1:7700/",
> private_key: "private key",
> initial_indexing_chunk_size: 100_000
Information about setting up meilisearch can be found in the
[official documentation](https://docs.meilisearch.com/learn/getting_started/installation.html).
You probably want to start it with `MEILI_NO_ANALYTICS=true` environment variable to disable analytics.
At least version 0.25.0 is required, but you are strongly advised to use at least 0.26.0, as it introduces
the `--enable-auto-batching` option which drastically improves performance. Without this option, the search
is hardly usable on a somewhat big instance.
### Private key authentication (optional)
To set the private key, use the `MEILI_MASTER_KEY` environment variable when starting. After setting the _master key_,
you have to get the _private key_, which is actually used for authentication.
=== "OTP"
```sh
./bin/pleroma_ctl search.meilisearch show-keys <your master key here>
```
=== "From Source"
```sh
mix pleroma.search.meilisearch show-keys <your master key here>
```
You will see a "Default Admin API Key", this is the key you actually put into your configuration file.
### Initial indexing
After setting up the configuration, you'll want to index all of your already existing posts. Only public posts are indexed. You'll only
have to do it one time, but it might take a while, depending on the amount of posts your instance has seen. This is also a fairly RAM
consuming process for `meilisearch`, and it will take a lot of RAM when running if you have a lot of posts (seems to be around 5G for ~1.2
million posts while idle and up to 7G while indexing initially, but your experience may be different).
The sequence of actions is as follows:
1. First, change the configuration to use `Pleroma.Search.Meilisearch` as the search backend
2. Restart your instance, at this point it can be used while the search indexing is running, though search won't return anything
3. Start the initial indexing process (as described below with `index`),
and wait until the task says it sent everything from the database to index
4. Wait until everything is actually indexed (by checking with `stats` as described below),
at this point you don't have to do anything, just wait a while.
To start the initial indexing, run the `index` command:
=== "OTP"
```sh
./bin/pleroma_ctl search.meilisearch index
```
=== "From Source"
```sh
mix pleroma.search.meilisearch index
```
This will show you the total amount of posts to index, and then show you the amount of posts indexed currently, until the numbers eventually
become the same. The posts are indexed in big batches and meilisearch will take some time to actually index them, even after you have
inserted all the posts into it. Depending on the amount of posts, this may be as long as several hours. To get information about the status
of indexing and how many posts have actually been indexed, use the `stats` command:
=== "OTP"
```sh
./bin/pleroma_ctl search.meilisearch stats
```
=== "From Source"
```sh
mix pleroma.search.meilisearch stats
```
### Clearing the index
In case you need to clear the index (for example, to re-index from scratch, if that needs to happen for some reason), you can
use the `clear` command:
=== "OTP"
```sh
./bin/pleroma_ctl search.meilisearch clear
```
=== "From Source"
```sh
mix pleroma.search.meilisearch clear
```
This will clear **all** the posts from the search index. Note, that deleted posts are also removed from index by the instance itself, so
there is no need to actually clear the whole index, unless you want **all** of it gone. That said, the index does not hold any information
that cannot be re-created from the database, it should also generally be a lot smaller than the size of your database. Still, the size
depends on the amount of text in posts.

View File

@ -303,7 +303,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/users/:nickname_or_id` ## `GET /api/v1/pleroma/admin/users/:nickname_or_id`
### Retrive the details of a user ### Retrieve the details of a user
- Params: - Params:
- `nickname` or `id` - `nickname` or `id`
@ -313,7 +313,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses` ## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses`
### Retrive user's latest statuses ### Retrieve user's latest statuses
- Params: - Params:
- `nickname` or `id` - `nickname` or `id`
@ -337,7 +337,7 @@ Removes the user(s) from follower recommendations.
## `GET /api/v1/pleroma/admin/instances/:instance/statuses` ## `GET /api/v1/pleroma/admin/instances/:instance/statuses`
### Retrive instance's latest statuses ### Retrieve instance's latest statuses
- Params: - Params:
- `instance`: instance name - `instance`: instance name
@ -377,7 +377,7 @@ It may take some time.
## `GET /api/v1/pleroma/admin/statuses` ## `GET /api/v1/pleroma/admin/statuses`
### Retrives all latest statuses ### Retrieves all latest statuses
- Params: - Params:
- *optional* `page_size`: number of statuses to return (default is `20`) - *optional* `page_size`: number of statuses to return (default is `20`)
@ -541,7 +541,7 @@ Response:
## `PATCH /api/v1/pleroma/admin/users/force_password_reset` ## `PATCH /api/v1/pleroma/admin/users/force_password_reset`
### Force passord reset for a user with a given nickname ### Force password reset for a user with a given nickname
- Params: - Params:
- `nicknames` - `nicknames`
@ -1751,3 +1751,53 @@ Note that this differs from the Mastodon API variant: Mastodon API only returns
```json ```json
{} {}
``` ```
## `GET /api/v1/pleroma/admin/rules`
### List rules
- Response: JSON, list of rules
```json
[
{
"id": "1",
"priority": 1,
"text": "There are no rules",
"hint": null
}
]
```
## `POST /api/v1/pleroma/admin/rules`
### Create a rule
- Params:
- `text`: string, required, rule content
- `hint`: string, optional, rule description
- `priority`: integer, optional, rule ordering priority
- Response: JSON, a single rule
## `PATCH /api/v1/pleroma/admin/rules/:id`
### Update a rule
- Params:
- `text`: string, optional, rule content
- `hint`: string, optional, rule description
- `priority`: integer, optional, rule ordering priority
- Response: JSON, a single rule
## `DELETE /api/v1/pleroma/admin/rules/:id`
### Delete a rule
- Response: JSON, empty object
```json
{}
```

View File

@ -1,6 +1,6 @@
# Differences in Mastodon API responses from vanilla Mastodon # Differences in Mastodon API responses from vanilla Mastodon
A Pleroma instance can be identified by "<Mastodon version> (compatible; Pleroma <version>)" present in `version` field in response from `/api/v1/instance` A Pleroma instance can be identified by "<Mastodon version> (compatible; Pleroma <version>)" present in `version` field in response from `/api/v1/instance` and `/api/v2/instance`
## Flake IDs ## Flake IDs
@ -39,6 +39,9 @@ Has these additional fields under the `pleroma` object:
- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint. - `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint.
- `parent_visible`: If the parent of this post is visible to the user or not. - `parent_visible`: If the parent of this post is visible to the user or not.
- `pinned_at`: a datetime (iso8601) when status was pinned, `null` otherwise. - `pinned_at`: a datetime (iso8601) when status was pinned, `null` otherwise.
- `quotes_count`: the count of status quotes.
- `non_anonymous`: true if the source post specifies the poll results are not anonymous. Currently only implemented by Smithereen.
- `bookmark_folder`: the ID of the folder bookmark is stored within (if any).
The `GET /api/v1/statuses/:id/source` endpoint additionally has the following attributes: The `GET /api/v1/statuses/:id/source` endpoint additionally has the following attributes:
@ -64,6 +67,12 @@ Some apps operate under the assumption that no more than 4 attachments can be re
Pleroma does not process remote images and therefore cannot include fields such as `meta` and `blurhash`. It does not support focal points or aspect ratios. The frontend is expected to handle it. Pleroma does not process remote images and therefore cannot include fields such as `meta` and `blurhash`. It does not support focal points or aspect ratios. The frontend is expected to handle it.
## Bookmarks
The `GET /api/v1/bookmarks` endpoint accepts optional parameter `folder_id` for bookmark folder ID.
The `POST /api/v1/statuses/:id/bookmark` endpoint accepts optional parameter `folder_id` for bookmark folder ID.
## Accounts ## Accounts
The `id` parameter can also be the `nickname` of the user. This only works in these endpoints, not the deeper nested ones for following etc. The `id` parameter can also be the `nickname` of the user. This only works in these endpoints, not the deeper nested ones for following etc.
@ -304,19 +313,27 @@ Has these additional parameters (which are the same as in Pleroma-API):
`GET /api/v1/instance` has additional fields `GET /api/v1/instance` has additional fields
- `max_toot_chars`: The maximum characters per post - `max_toot_chars`: The maximum characters per post
- `max_media_attachments`: Maximum number of post media attachments
- `chat_limit`: The maximum characters per chat message - `chat_limit`: The maximum characters per chat message
- `description_limit`: The maximum characters per image description - `description_limit`: The maximum characters per image description
- `poll_limits`: The limits of polls - `poll_limits`: The limits of polls
- `shout_limit`: The maximum characters per Shoutbox message
- `upload_limit`: The maximum upload file size - `upload_limit`: The maximum upload file size
- `avatar_upload_limit`: The same for avatars - `avatar_upload_limit`: The same for avatars
- `background_upload_limit`: The same for backgrounds - `background_upload_limit`: The same for backgrounds
- `banner_upload_limit`: The same for banners - `banner_upload_limit`: The same for banners
- `background_image`: A background image that frontends can use - `background_image`: A background image that frontends can use
- `pleroma.metadata.account_activation_required`: Whether users are required to confirm their emails before signing in
- `pleroma.metadata.birthday_required`: Whether users are required to provide their birth day when signing in
- `pleroma.metadata.birthday_min_age`: The minimum user age (in days)
- `pleroma.metadata.features`: A list of supported features - `pleroma.metadata.features`: A list of supported features
- `pleroma.metadata.federation`: The federation restrictions of this instance - `pleroma.metadata.federation`: The federation restrictions of this instance
- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields. - `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields.
- `pleroma.metadata.post_formats`: A list of the allowed post format types - `pleroma.metadata.post_formats`: A list of the allowed post format types
- `vapid_public_key`: The public key needed for push messages - `pleroma.stats.mau`: Monthly active user count
- `pleroma.vapid_public_key`: The public key needed for push messages
In, `GET /api/v2/instance` Pleroma-specific fields are all moved into `pleroma` object. `max_toot_chars`, `poll_limits` and `upload_limit` are replaced with their MastoAPI counterparts.
## Push Subscription ## Push Subscription

View File

@ -129,7 +129,7 @@ The `/api/v1/pleroma/*` path is backwards compatible with `/api/pleroma/*` (`/ap
* method: `GET` * method: `GET`
* Authentication: required * Authentication: required
* OAuth scope: `write:security` * OAuth scope: `write:security`
* Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}` * Response: JSON. Returns `{"codes": codes}` when successful, otherwise HTTP 422 `{"error": "[error message]"}`
## `/api/v1/pleroma/admin/` ## `/api/v1/pleroma/admin/`
See [Admin-API](admin_api.md) See [Admin-API](admin_api.md)
@ -251,6 +251,15 @@ See [Admin-API](admin_api.md)
] ]
``` ```
## `/api/v1/pleroma/accounts/:id/endorsements`
### Returns users endorsed by a user
* Method `GET`
* Authentication: not required
* Params:
* `id`: the id of the account for whom to return results
* Response: JSON, returns a list of Mastodon Account entities
## `/api/v1/pleroma/accounts/update_*` ## `/api/v1/pleroma/accounts/update_*`
### Set and clear account avatar, banner, and background ### Set and clear account avatar, banner, and background
@ -266,6 +275,58 @@ See [Admin-API](admin_api.md)
* Authentication: not required * Authentication: not required
* Response: 204 No Content * Response: 204 No Content
## `/api/v1/pleroma/statuses/:id/quotes`
### Gets quotes for a given status
* Method `GET`
* Authentication: not required
* Params:
* `id`: the id of the status
* Response: JSON, returns a list of Mastodon Status entities
## `GET /api/v1/pleroma/bookmark_folders`
### Gets user bookmark folders
* Authentication: required
* Response: JSON. Returns a list of bookmark folders.
* Example response:
```json
[
{
"id": "9umDrYheeY451cQnEe",
"name": "Read later",
"emoji": "🕓",
"emoji_url": null
}
]
```
## `POST /api/v1/pleroma/bookmark_folders`
### Creates a bookmark folder
* Authentication: required
* Params:
* `name`: folder name
* `emoji`: folder emoji (optional)
* Response: JSON. Returns a single bookmark folder.
## `PATCH /api/v1/pleroma/bookmark_folders/:id`
### Updates a bookmark folder
* Authentication: required
* Params:
* `id`: folder id
* `name`: folder name (optional)
* `emoji`: folder emoji (optional)
* Response: JSON. Returns a single bookmark folder.
## `DELETE /api/v1/pleroma/bookmark_folders/:id`
### Deletes a bookmark folder
* Authentication: required
* Params:
* `id`: folder id
* Response: JSON. Returns a single bookmark folder.
## `/api/v1/pleroma/mascot` ## `/api/v1/pleroma/mascot`
### Gets user mascot image ### Gets user mascot image
* Method `GET` * Method `GET`
@ -372,6 +433,15 @@ See [Admin-API](admin_api.md)
* `alias`: the nickname of the alias to delete, e.g. `foo@example.org`. * `alias`: the nickname of the alias to delete, e.g. `foo@example.org`.
* Response: JSON. Returns `{"status": "success"}` if the change was successful, `{"error": "[error message]"}` otherwise * Response: JSON. Returns `{"status": "success"}` if the change was successful, `{"error": "[error message]"}` otherwise
## `/api/v1/pleroma/remote_interaction`
## Interact with profile or status from remote account
* Metod `POST`
* Authentication: not required
* Params:
* `ap_id`: Profile or status ActivityPub ID
* `profile`: Remote profile webfinger
* Response: JSON. Returns `{"url": "[redirect url]"}` on success, `{"error": "[error message]"}` otherwise
# Pleroma Conversations # Pleroma Conversations
Pleroma Conversations have the same general structure that Mastodon Conversations have. The behavior differs in the following ways when using these endpoints: Pleroma Conversations have the same general structure that Mastodon Conversations have. The behavior differs in the following ways when using these endpoints:
@ -382,7 +452,7 @@ Pleroma Conversations have the same general structure that Mastodon Conversation
Conversations have the additional field `recipients` under the `pleroma` key. This holds a list of all the accounts that will receive a message in this conversation. Conversations have the additional field `recipients` under the `pleroma` key. This holds a list of all the accounts that will receive a message in this conversation.
The status posting endpoint takes an additional parameter, `in_reply_to_conversation_id`, which, when set, will set the visiblity to direct and address only the people who are the recipients of that Conversation. The status posting endpoint takes an additional parameter, `in_reply_to_conversation_id`, which, when set, will set the visibility to direct and address only the people who are the recipients of that Conversation.
⚠ Conversation IDs can be found in direct messages with the `pleroma.direct_conversation_id` key, do not confuse it with `pleroma.conversation_id`. ⚠ Conversation IDs can be found in direct messages with the `pleroma.direct_conversation_id` key, do not confuse it with `pleroma.conversation_id`.

View File

@ -1,44 +1,47 @@
# Prometheus Metrics # Prometheus / OpenTelemetry Metrics
Pleroma includes support for exporting metrics via the [prometheus_ex](https://github.com/deadtrickster/prometheus.ex) library. Pleroma includes support for exporting metrics via the [prom_ex](https://github.com/akoutmos/prom_ex) library.
The metrics are exposed by a dedicated webserver/port to improve privacy and security.
Config example: Config example:
``` ```
config :prometheus, Pleroma.Web.Endpoint.MetricsExporter, config :pleroma, Pleroma.PromEx,
enabled: true, disabled: false,
auth: {:basic, "myusername", "mypassword"}, manual_metrics_start_delay: :no_delay,
ip_whitelist: ["127.0.0.1"], drop_metrics_groups: [],
path: "/api/pleroma/app_metrics", grafana: [
format: :text host: System.get_env("GRAFANA_HOST", "http://localhost:3000"),
``` auth_token: System.get_env("GRAFANA_TOKEN"),
upload_dashboards_on_start: false,
* `enabled` (Pleroma extension) enables the endpoint folder_name: "BEAM",
* `ip_whitelist` (Pleroma extension) could be used to restrict access only to specified IPs annotate_app_lifecycle: true
* `auth` sets the authentication (`false` for no auth; configurable to HTTP Basic Auth, see [prometheus-plugs](https://github.com/deadtrickster/prometheus-plugs#exporting) documentation) ],
* `format` sets the output format (`:text` or `:protobuf`) metrics_server: [
* `path` sets the path to app metrics page port: 4021,
path: "/metrics",
protocol: :http,
## `/api/pleroma/app_metrics` pool_size: 5,
cowboy_opts: [],
### Exports Prometheus application metrics auth_strategy: :none
],
* Method: `GET` datasource: "Prometheus"
* Authentication: not required by default (see configuration options above)
* Params: none
* Response: text
## Grafana
### Config example
The following is a config example to use with [Grafana](https://grafana.com)
``` ```
- job_name: 'beam'
metrics_path: /api/pleroma/app_metrics PromEx supports the ability to automatically publish dashboards to your Grafana server as well as register Annotations. If you do not wish to configure this capability you must generate the dashboard JSON files and import them directly. You can find the mix commands in the upstream [documentation](https://hexdocs.pm/prom_ex/Mix.Tasks.PromEx.Dashboard.Export.html). You can find the list of modules enabled in Pleroma for which you should generate dashboards for by examining the contents of the `lib/pleroma/prom_ex.ex` module.
scheme: https
## prometheus.yml
The following is a bare minimum config example to use with [Prometheus](https://prometheus.io) or Prometheus-compatible software like [VictoriaMetrics](https://victoriametrics.com).
```
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'pleroma'
scheme: http
static_configs: static_configs:
- targets: ['pleroma.soykaf.com'] - targets: ['pleroma.soykaf.com:4021']
``` ```

View File

@ -20,16 +20,16 @@ Content-Type: multipart/form-data
Parameters: Parameters:
- (required) `file`: The file being uploaded - (required) `file`: The file being uploaded
- (optionnal) `description`: A plain-text description of the media, for accessibility purposes. - (optional) `description`: A plain-text description of the media, for accessibility purposes.
Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id` Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id`
The object given in the reponse should then be inserted into an Object's `attachment` field. The object given in the response should then be inserted into an Object's `attachment` field.
## ChatMessages ## ChatMessages
`ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to `ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to
`Note`s, but the addresing is done by having a single AP actor in the `to` `Note`s, but the addressing is done by having a single AP actor in the `to`
field. Addressing multiple actors is not allowed. These messages are always field. Addressing multiple actors is not allowed. These messages are always
private, there is no public version of them. They are created with a `Create` private, there is no public version of them. They are created with a `Create`
activity. activity.

View File

@ -15,7 +15,7 @@ Pleroma requires some adjustments from the defaults for running the instance loc
2. Change the dev.secret.exs 2. Change the dev.secret.exs
* Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below) * Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below)
* If you want to change other settings, you can do that too * If you want to change other settings, you can do that too
3. You can now start the server `mix phx.server`. Once it's build and started, you can access the instance on `http://<host>:<port>` (e.g.http://localhost:4000 ) and should be able to do everything locally you normaly can. 3. You can now start the server `mix phx.server`. Once it's build and started, you can access the instance on `http://<host>:<port>` (e.g.http://localhost:4000 ) and should be able to do everything locally you normally can.
Example config to change the scheme to http. Change the port if you want to run on another port. Example config to change the scheme to http. Change the port if you want to run on another port.
```elixir ```elixir
@ -38,7 +38,7 @@ config :logger, :console,
## Testing ## Testing
1. Create a `test.secret.exs` file with the content as shown below 1. Create a `config/test.secret.exs` file with the content as shown below
2. Create the database user and test database. 2. Create the database user and test database.
1. You can use the `config/setup_db.psql` as a template. Copy the file if you want and change the database name, user and password to the values for the test-database (e.g. 'pleroma_local_test' for database and user). Then run this file like you did during installation. 1. You can use the `config/setup_db.psql` as a template. Copy the file if you want and change the database name, user and password to the values for the test-database (e.g. 'pleroma_local_test' for database and user). Then run this file like you did during installation.
2. The tests will try to create the Database, so we'll have to allow our test-database user to create databases, `sudo -Hu postgres psql -c "ALTER USER pleroma_local_test WITH CREATEDB;"` 2. The tests will try to create the Database, so we'll have to allow our test-database user to create databases, `sudo -Hu postgres psql -c "ALTER USER pleroma_local_test WITH CREATEDB;"`

View File

@ -12,9 +12,9 @@ Note: This article is potentially outdated because at this time we may not have
### 必要なソフトウェア ### 必要なソフトウェア
- PostgreSQL 9.6以上 (Ubuntu16.04では9.5しか提供されていないので,[](https://www.postgresql.org/download/linux/ubuntu/)こちらから新しいバージョンを入手してください) - PostgreSQL 11.0以上 (Ubuntu16.04では9.5しか提供されていないので,[](https://www.postgresql.org/download/linux/ubuntu/)こちらから新しいバージョンを入手してください)
- `postgresql-contrib` 9.6以上 (同上) - `postgresql-contrib` 11.0以上 (同上)
- Elixir 1.8 以上 ([Debianのリポジトリからインストールしないこと ここからインストールすること!](https://elixir-lang.org/install.html#unix-and-unix-like)。または [asdf](https://github.com/asdf-vm/asdf) をpleromaユーザーでインストールしてください) - Elixir 1.13 以上 ([Debianのリポジトリからインストールしないこと ここからインストールすること!](https://elixir-lang.org/install.html#unix-and-unix-like)。または [asdf](https://github.com/asdf-vm/asdf) をpleromaユーザーでインストールしてください)
- `erlang-dev` - `erlang-dev`
- `erlang-nox` - `erlang-nox`
- `git` - `git`

View File

@ -9,7 +9,7 @@ This document was written for FreeBSD 12.1, but should be work on future release
This assumes the target system has `pkg(8)`. This assumes the target system has `pkg(8)`.
``` ```
# pkg install elixir postgresql12-server postgresql12-client postgresql12-contrib git-lite sudo nginx gmake acme.sh cmake # pkg install elixir postgresql12-server postgresql12-client postgresql12-contrib git-lite sudo nginx gmake acme.sh cmake vips
``` ```
Copy the rc.d scripts to the right directory: Copy the rc.d scripts to the right directory:
@ -41,6 +41,7 @@ Create a user for Pleroma:
``` ```
# pw add user pleroma -m # pw add user pleroma -m
# echo 'export LC_ALL="en_US.UTF-8"' >> /home/pleroma/.profile # echo 'export LC_ALL="en_US.UTF-8"' >> /home/pleroma/.profile
# echo 'export VIX_COMPILATION_MODE=PLATFORM_PROVIDED_LIBVIPS' >> /home/pleroma/.profile
# su -l pleroma # su -l pleroma
``` ```

View File

@ -1,8 +1,8 @@
## Required dependencies ## Required dependencies
* PostgreSQL >=9.6 * PostgreSQL >=11.0
* Elixir >=1.11.0 <1.15 * Elixir >=1.13.0 <1.17
* Erlang OTP >=22.2.0 <26 * Erlang OTP >=22.2.0 (supported: <27)
* git * git
* file / libmagic * file / libmagic
* gcc or clang * gcc or clang

View File

@ -59,7 +59,7 @@ Gentoo quite pointedly does not come with a cron daemon installed, and as such i
If you would not like to install the optional packages, remove them from this line. If you would not like to install the optional packages, remove them from this line.
If you're running this from a low-powered virtual machine, it should work though it will take some time. There were no issues on a VPS with a single core and 1GB of RAM; if you are using an even more limited device and run into issues, you can try creating a swapfile or use a more powerful machine running Gentoo to [cross build](https://wiki.gentoo.org/wiki/Cross_build_environment). If you have a wait ahead of you, now would be a good time to take a break, strech a bit, refresh your beverage of choice and/or get a snack, and reply to Arch users' posts with "I use Gentoo btw" as we do. If you're running this from a low-powered virtual machine, it should work though it will take some time. There were no issues on a VPS with a single core and 1GB of RAM; if you are using an even more limited device and run into issues, you can try creating a swapfile or use a more powerful machine running Gentoo to [cross build](https://wiki.gentoo.org/wiki/Cross_build_environment). If you have a wait ahead of you, now would be a good time to take a break, stretch a bit, refresh your beverage of choice and/or get a snack, and reply to Arch users' posts with "I use Gentoo btw" as we do.
### Install PostgreSQL ### Install PostgreSQL
@ -104,7 +104,7 @@ Not only does this make it much easier to deploy changes you make, as you can co
* Add a new system user for the Pleroma service and set up default directories: * Add a new system user for the Pleroma service and set up default directories:
Remove `,wheel` if you do not want this user to be able to use `sudo`, however note that being able to `sudo` as the `pleroma` user will make finishing the insallation and common maintenence tasks somewhat easier: Remove `,wheel` if you do not want this user to be able to use `sudo`, however note that being able to `sudo` as the `pleroma` user will make finishing the installation and common maintenance tasks somewhat easier:
```shell ```shell
# useradd -m -G users,wheel -s /bin/bash pleroma # useradd -m -G users,wheel -s /bin/bash pleroma

View File

@ -49,7 +49,7 @@ Gentoo quite pointedly does not come with a cron daemon installed, and as such i
If you would not like to install the optional packages, remove them from this line. If you would not like to install the optional packages, remove them from this line.
If you're running this from a low-powered virtual machine, it should work though it will take some time. There were no issues on a VPS with a single core and 1GB of RAM; if you are using an even more limited device and run into issues, you can try creating a swapfile or use a more powerful machine running Gentoo to [cross build](https://wiki.gentoo.org/wiki/Cross_build_environment). If you have a wait ahead of you, now would be a good time to take a break, strech a bit, refresh your beverage of choice and/or get a snack, and reply to Arch users' posts with "I use Gentoo btw" as we do. If you're running this from a low-powered virtual machine, it should work though it will take some time. There were no issues on a VPS with a single core and 1GB of RAM; if you are using an even more limited device and run into issues, you can try creating a swapfile or use a more powerful machine running Gentoo to [cross build](https://wiki.gentoo.org/wiki/Cross_build_environment). If you have a wait ahead of you, now would be a good time to take a break, stretch a bit, refresh your beverage of choice and/or get a snack, and reply to Arch users' posts with "I use Gentoo btw" as we do.
### Setup PostgreSQL ### Setup PostgreSQL

View File

@ -2,14 +2,41 @@
{! backend/installation/generic_dependencies.include !} {! backend/installation/generic_dependencies.include !}
## Installing software used in this guide # Installation options
Currently there are two options available for NetBSD: manual installation (from source) or using experimental package from [pkgsrc-wip](https://github.com/NetBSD/pkgsrc-wip/tree/master/pleroma).
WIP package can be installed via pkgsrc and can be crosscompiled for easier binary distribution. Source installation most probably will be restricted to a single machine.
## pkgsrc installation
WIP package creates Mix.Release (similar to how Docker images are built) but doesn't bundle Erlang runtime, listing it as a dependency instead. This allows for easier and more modular installations, especially on weaker machines. Currently this method also does not support all features of `pleroma_ctl` command (like changing installation type or managing frontends) as NetBSD is not yet a supported binary flavour of Pleroma's CI.
In any case, you can install it the same way as any other `pkgsrc-wip` package:
```
cd /usr/pkgsrc
git clone --depth 1 git://wip.pkgsrc.org/pkgsrc-wip.git wip
cp -rf wip/pleroma www
cp -rf wip/libvips graphics
cd /usr/pkgsrc/www/pleroma
bmake && bmake install
```
Use `bmake package` to create a binary package. This can come especially handy if you're targeting embedded or low-power systems and are crosscompiling on a more powerful machine.
> Note: Elixir has [endianness bug](https://github.com/elixir-lang/elixir/issues/2785) which requires it to be compiled on a machine with the same endianness. In other words, package crosscompiled on amd64 (little endian) won't work on powerpc or sparc machines (big endian). While _in theory™_ nothing catastrophic should happen, one can see that for example regexes won't work properly. Some distributions just strip this warning away, so it doesn't bother the users... anyway, you've been warned.
## Source installation
pkgin should have been installed by the NetBSD installer if you selected pkgin should have been installed by the NetBSD installer if you selected
the right options. If it isn't installed, install it using pkg_add. the right options. If it isn't installed, install it using `pkg_add`.
Note that `postgresql11-contrib` is needed for the Postgres extensions Note that `postgresql11-contrib` is needed for the Postgres extensions
Pleroma uses. Pleroma uses.
> Note: you can use modern versions of PostgreSQL. In this case, just use `postgresql16-contrib` and so on.
The `mksh` shell is needed to run the Elixir `mix` script. The `mksh` shell is needed to run the Elixir `mix` script.
`# pkgin install acmesh elixir git-base git-docs mksh nginx postgresql11-server postgresql11-client postgresql11-contrib sudo ffmpeg4 ImageMagick` `# pkgin install acmesh elixir git-base git-docs mksh nginx postgresql11-server postgresql11-client postgresql11-contrib sudo ffmpeg4 ImageMagick`
@ -29,29 +56,6 @@ shells/mksh
www/nginx www/nginx
``` ```
Copy the rc.d scripts to the right directory:
```
# cp /usr/pkg/share/examples/rc.d/nginx /usr/pkg/share/examples/rc.d/pgsql /etc/rc.d
```
Add nginx and Postgres to `/etc/rc.conf`:
```
nginx=YES
pgsql=YES
```
## Configuring postgres
First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
`# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
## Configuring Pleroma
Create a user for Pleroma: Create a user for Pleroma:
``` ```
@ -68,41 +72,98 @@ $ cd /home/pleroma
$ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git $ git clone -b stable https://git.pleroma.social/pleroma/pleroma.git
``` ```
Configure Pleroma. Note that you need a domain name at this point: Get deps and compile:
``` ```
$ cd /home/pleroma/pleroma $ cd /home/pleroma/pleroma
$ export MIX_ENV=prod
$ mix deps.get $ mix deps.get
$ MIX_ENV=prod mix pleroma.instance gen # You will be asked a few questions here. $ mix compile
``` ```
Since Postgres is configured, we can now initialize the database. There should ## Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
now be a file in `config/setup_db.psql` that makes this easier. Edit it, and
*change the password* to a password of your choice. Make sure it is secure, since `# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool`
or via pkgsrc:
```
graphics/p5-Image-ExifTool
graphics/ImageMagick
multimedia/ffmpeg4
```
# Configuration
## Understanding $PREFIX
From now on, you may encounter `$PREFIX` variable in the paths. This variable indicates your current local pkgsrc prefix. Usually it's `/usr/pkg` unless you configured it otherwise. Translating to pkgsrc's lingo, it's called `LOCALBASE`, which essentially means the same this. You may want to set it up for your local shell session (this uses `mksh` which should already be installed as one of the required dependencies):
```
$ export PREFIX=$(pkg_info -Q LOCALBASE mksh)
$ echo $PREFIX
/usr/pkg
```
## Setting up your instance
Now, you need to configure your instance. During this initial configuration, you will be asked some questions about your server. You will need a domain name at this point; it doesn't have to be deployed, but changing it later will be very cumbersome.
If you've installed via pkgsrc, `pleroma_ctl` should already be in your `PATH`; if you've installed from source, it's located at `/home/pleroma/pleroma/release/bin/pleroma_ctl`.
```
$ su -l pleroma
$ pleroma_ctl instance gen --output $PREFIX/etc/pleroma/config.exs --output-psql /tmp/setup_db.psql
```
During installation, you will be asked about static and upload directories. Don't forget to create them and update permissions:
```
mkdir -p /var/lib/pleroma/uploads
chown -R pleroma:pleroma /var/lib/pleroma
```
## Setting up the database
First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`.
We can now initialize the database. You'll need to edit generated SQL file from the previous step. It's located at `/tmp/setup_db.psql`.
Edit this file, and *change the password* to a password of your choice. Make sure it is secure, since
it'll be protecting your database. Now initialize the database: it'll be protecting your database. Now initialize the database:
``` ```
$ sudo -Hu pgsql -g pgsql psql -f config/setup_db.psql $ sudo -Hu pgsql -g pgsql psql -f /tmp/setup_db.psql
``` ```
Postgres allows connections from all users without a password by default. To Postgres allows connections from all users without a password by default. To
fix this, edit `/usr/pkg/pgsql/data/pg_hba.conf`. Change every `trust` to fix this, edit `$PREFIX/pgsql/data/pg_hba.conf`. Change every `trust` to
`password`. `password`.
Once this is done, restart Postgres with `# /etc/rc.d/pgsql restart`. Once this is done, restart Postgres with `# /etc/rc.d/pgsql restart`.
Run the database migrations. Run the database migrations.
### pkgsrc installation
```
pleroma_ctl migrate
```
### Source installation
You will need to do this whenever you update with `git pull`: You will need to do this whenever you update with `git pull`:
``` ```
$ cd /home/pleroma/pleroma
$ MIX_ENV=prod mix ecto.migrate $ MIX_ENV=prod mix ecto.migrate
``` ```
## Configuring nginx ## Configuring nginx
Install the example configuration file Install the example configuration file
`/home/pleroma/pleroma/installation/pleroma.nginx` to (`$PREFIX/share/examples/pleroma/pleroma.nginx` or `/home/pleroma/pleroma/installation/pleroma.nginx`) to
`/usr/pkg/etc/nginx.conf`. `$PREFIX/etc/nginx.conf`.
Note that it will need to be wrapped in a `http {}` block. You should add Note that it will need to be wrapped in a `http {}` block. You should add
settings for the nginx daemon outside of the http block, for example: settings for the nginx daemon outside of the http block, for example:
@ -176,27 +237,45 @@ Let's add auto-renewal to `/etc/daily.local`
--stateless --stateless
``` ```
## Creating a startup script for Pleroma ## Autostart
Copy the startup script to the correct location and make sure it's executable: For properly functioning instance, you will need pleroma (backend service), nginx (reverse proxy) and postgresql (database) services running. There's no requirement for them to reside on the same machine, but you have to provide autostart for each of them.
### nginx
```
# cp $PREFIX/share/examples/rc.d/nginx /etc/rc.d
# echo "nginx=YES" >> /etc/rc.conf
```
### postgresql
```
# cp $PREFIX/share/examples/rc.d/pgsql /etc/rc.d
# echo "pgsql=YES" >> /etc/rc.conf
```
### pleroma
First, copy the script (pkgsrc variant)
```
# cp $PREFIX/share/examples/pleroma/pleroma.rc /etc/rc.d/pleroma
```
or source variant
``` ```
# cp /home/pleroma/pleroma/installation/netbsd/rc.d/pleroma /etc/rc.d/pleroma # cp /home/pleroma/pleroma/installation/netbsd/rc.d/pleroma /etc/rc.d/pleroma
# chmod +x /etc/rc.d/pleroma # chmod +x /etc/rc.d/pleroma
``` ```
Add the following to `/etc/rc.conf`: Then, add the following to `/etc/rc.conf`:
``` ```
pleroma=YES pleroma=YES
pleroma_home="/home/pleroma"
pleroma_user="pleroma"
``` ```
Run `# /etc/rc.d/pleroma start` to start Pleroma.
## Conclusion ## Conclusion
Run `# /etc/rc.d/pleroma start` to start Pleroma.
Restart nginx with `# /etc/rc.d/nginx restart` and you should be up and running. Restart nginx with `# /etc/rc.d/nginx restart` and you should be up and running.
Make sure your time is in sync, or other instances will receive your posts with Make sure your time is in sync, or other instances will receive your posts with

View File

@ -62,7 +62,7 @@ rcctl start postgresql
To check that it started properly and didn't fail right after starting, you can run `ps aux | grep postgres`, there should be multiple lines of output. To check that it started properly and didn't fail right after starting, you can run `ps aux | grep postgres`, there should be multiple lines of output.
#### httpd #### httpd
httpd will have three fuctions: httpd will have three functions:
* redirect requests trying to reach the instance over http to the https URL * redirect requests trying to reach the instance over http to the https URL
* serve a robots.txt file * serve a robots.txt file
@ -225,7 +225,7 @@ pass in quick on $if inet6 proto icmp6 to ($if) icmp6-type { echoreq unreach par
pass in quick on $if proto tcp to ($if) port { http https } # relayd/httpd pass in quick on $if proto tcp to ($if) port { http https } # relayd/httpd
pass in quick on $if proto tcp from $authorized_ssh_clients to ($if) port ssh pass in quick on $if proto tcp from $authorized_ssh_clients to ($if) port ssh
``` ```
Replace *<network interface\>* by your server's network interface name (which you can get with ifconfig). Consider replacing the content of the authorized\_ssh\_clients macro by, for exemple, your home IP address, to avoid SSH connection attempts from bots. Replace *<network interface\>* by your server's network interface name (which you can get with ifconfig). Consider replacing the content of the authorized\_ssh\_clients macro by, for example, your home IP address, to avoid SSH connection attempts from bots.
Check pf's configuration by running `pfctl -nf /etc/pf.conf`, load it with `pfctl -f /etc/pf.conf` and enable pf at boot with `rcctl enable pf`. Check pf's configuration by running `pfctl -nf /etc/pf.conf`, load it with `pfctl -f /etc/pf.conf` and enable pf at boot with `rcctl enable pf`.

View File

@ -238,7 +238,7 @@ At this point if you open your (sub)domain in a browser you should see a 502 err
systemctl enable pleroma systemctl enable pleroma
``` ```
If everything worked, you should see Pleroma-FE when visiting your domain. If that didn't happen, try reviewing the installation steps, starting Pleroma in the foreground and seeing if there are any errrors. If everything worked, you should see Pleroma-FE when visiting your domain. If that didn't happen, try reviewing the installation steps, starting Pleroma in the foreground and seeing if there are any errors.
Questions about the installation or didnt it work as it should be, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC, you can also [file an issue on our Gitlab](https://git.pleroma.social/pleroma/pleroma-support/issues/new). Questions about the installation or didnt it work as it should be, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC, you can also [file an issue on our Gitlab](https://git.pleroma.social/pleroma/pleroma-support/issues/new).

View File

@ -1,11 +1,14 @@
#!/bin/sh #!/bin/sh
# PROVIDE: pleroma # PROVIDE: pleroma
# REQUIRE: DAEMON pgsql # REQUIRE: DAEMON pgsql nginx
if [ -f /etc/rc.subr ]; then if [ -f /etc/rc.subr ]; then
. /etc/rc.subr . /etc/rc.subr
fi fi
pleroma_home="/home/pleroma"
pleroma_user="pleroma"
name="pleroma" name="pleroma"
rcvar=${name} rcvar=${name}
command="/usr/pkg/bin/elixir" command="/usr/pkg/bin/elixir"
@ -19,10 +22,10 @@ pleroma_env="HOME=${pleroma_home} MIX_ENV=prod"
check_pidfile() check_pidfile()
{ {
pid=$(pgrep -U "${pleroma_user}" /bin/beam.smp$) pid=$(pgrep -U "${pleroma_user}" /bin/beam.smp$)
echo -n "${pid}" printf '%s' "${pid}"
} }
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then if [ -f /etc/rc.subr ] && [ -d /etc/rc.d ] && [ -f /etc/rc.d/DAEMON ]; then
# newer NetBSD # newer NetBSD
load_rc_config ${name} load_rc_config ${name}
run_rc_command "$1" run_rc_command "$1"
@ -39,7 +42,7 @@ else
stop) stop)
echo "Stopping ${name}." echo "Stopping ${name}."
check_pidfile check_pidfile
! [ -n ${pid} ] && kill ${pid} ! [ -n "${pid}" ] && kill "${pid}"
;; ;;
restart) restart)

View File

@ -0,0 +1,15 @@
[Unit]
Description=NSFW API
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull eugencepoi/nsfw_api:latest
ExecStart=/usr/bin/docker run --rm -p 127.0.0.1:5000:5000/tcp --env PORT=5000 --name %n eugencepoi/nsfw_api:latest
[Install]
WantedBy=multi-user.target

View File

@ -204,7 +204,7 @@
]} ]}
]}, ]},
%% Following HTTP API is deprected, the new one abouve should be used instead %% Following HTTP API is deprecated, the new one above should be used instead
{ {5288, "127.0.0.1"} , ejabberd_cowboy, [ { {5288, "127.0.0.1"} , ejabberd_cowboy, [
{num_acceptors, 10}, {num_acceptors, 10},
@ -824,7 +824,7 @@
%% Enable archivization for private messages (default) %% Enable archivization for private messages (default)
% {pm, [ % {pm, [
%% Top-level options can be overriden here if needed, for example: %% Top-level options can be overridden here if needed, for example:
% {async_writer, false} % {async_writer, false}
% ]}, % ]},
@ -834,7 +834,7 @@
%% %%
% {muc, [ % {muc, [
% {host, "muc.@HOST@"} % {host, "muc.@HOST@"}
%% As with pm, top-level options can be overriden for MUC archive %% As with pm, top-level options can be overridden for MUC archive
% ]}, % ]},
% %
%% Do not use a <stanza-id/> element (by default stanzaid is used) %% Do not use a <stanza-id/> element (by default stanzaid is used)

View File

@ -14,7 +14,8 @@ defmodule Mix.Pleroma do
:swoosh, :swoosh,
:timex, :timex,
:fast_html, :fast_html,
:oban :oban,
:logger_backends
] ]
@cachex_children ["object", "user", "scrubber", "web_resp"] @cachex_children ["object", "user", "scrubber", "web_resp"]
@doc "Common functions to be reused in mix tasks" @doc "Common functions to be reused in mix tasks"

View File

@ -205,6 +205,35 @@ defmodule Mix.Tasks.Pleroma.Config do
end end
end end
# Removes any policies that are not a real module
# as they will prevent the server from starting
def run(["fix_mrf_policies"]) do
check_configdb(fn ->
start_pleroma()
group = :pleroma
key = :mrf
%{value: value} =
group
|> ConfigDB.get_by_group_and_key(key)
policies =
Keyword.get(value, :policies, [])
|> Enum.filter(&is_atom(&1))
|> Enum.filter(fn mrf ->
case Code.ensure_compiled(mrf) do
{:module, _} -> true
{:error, _} -> false
end
end)
value = Keyword.put(value, :policies, policies)
ConfigDB.update_or_create(%{group: group, key: key, value: value})
end)
end
@spec migrate_to_db(Path.t() | nil) :: any() @spec migrate_to_db(Path.t() | nil) :: any()
def migrate_to_db(file_path \\ nil) do def migrate_to_db(file_path \\ nil) do
with :ok <- Pleroma.Config.DeprecationWarnings.warn() do with :ok <- Pleroma.Config.DeprecationWarnings.warn() do

View File

@ -67,43 +67,168 @@ defmodule Mix.Tasks.Pleroma.Database do
OptionParser.parse( OptionParser.parse(
args, args,
strict: [ strict: [
vacuum: :boolean vacuum: :boolean,
keep_threads: :boolean,
keep_non_public: :boolean,
prune_orphaned_activities: :boolean
] ]
) )
start_pleroma() start_pleroma()
deadline = Pleroma.Config.get([:instance, :remote_post_retention_days]) deadline = Pleroma.Config.get([:instance, :remote_post_retention_days])
time_deadline = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(deadline * 86_400))
Logger.info("Pruning objects older than #{deadline} days") log_message = "Pruning objects older than #{deadline} days"
time_deadline = log_message =
NaiveDateTime.utc_now() if Keyword.get(options, :keep_non_public) do
|> NaiveDateTime.add(-(deadline * 86_400)) log_message <> ", keeping non public posts"
else
log_message
end
from(o in Object, log_message =
where: if Keyword.get(options, :keep_threads) do
fragment( log_message <> ", keeping threads intact"
"?->'to' \\? ? OR ?->'cc' \\? ?", else
o.data, log_message
^Pleroma.Constants.as_public(), end
o.data,
^Pleroma.Constants.as_public() log_message =
), if Keyword.get(options, :prune_orphaned_activities) do
where: o.inserted_at < ^time_deadline, log_message <> ", pruning orphaned activities"
where: else
log_message
end
log_message =
if Keyword.get(options, :vacuum) do
log_message <>
", doing a full vacuum (you shouldn't do this as a recurring maintanance task)"
else
log_message
end
Logger.info(log_message)
if Keyword.get(options, :keep_threads) do
# We want to delete objects from threads where
# 1. the newest post is still old
# 2. none of the activities is local
# 3. none of the activities is bookmarked
# 4. optionally none of the posts is non-public
deletable_context =
if Keyword.get(options, :keep_non_public) do
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
|> having(
[a],
not fragment(
# Posts (checked on Create Activity) is non-public
"bool_or((not(?->'to' \\? ? OR ?->'cc' \\? ?)) and ? ->> 'type' = 'Create')",
a.data,
^Pleroma.Constants.as_public(),
a.data,
^Pleroma.Constants.as_public(),
a.data
)
)
else
Pleroma.Activity
|> join(:left, [a], b in Pleroma.Bookmark, on: a.id == b.activity_id)
|> group_by([a], fragment("? ->> 'context'::text", a.data))
end
|> having([a], max(a.updated_at) < ^time_deadline)
|> having([a], not fragment("bool_or(?)", a.local))
|> having([_, b], fragment("max(?::text) is null", b.id))
|> select([a], fragment("? ->> 'context'::text", a.data))
Pleroma.Object
|> where([o], fragment("? ->> 'context'::text", o.data) in subquery(deletable_context))
else
if Keyword.get(options, :keep_non_public) do
Pleroma.Object
|> where(
[o],
fragment(
"?->'to' \\? ? OR ?->'cc' \\? ?",
o.data,
^Pleroma.Constants.as_public(),
o.data,
^Pleroma.Constants.as_public()
)
)
else
Pleroma.Object
end
|> where([o], o.updated_at < ^time_deadline)
|> where(
[o],
fragment("split_part(?->>'actor', '/', 3) != ?", o.data, ^Pleroma.Web.Endpoint.host()) fragment("split_part(?->>'actor', '/', 3) != ?", o.data, ^Pleroma.Web.Endpoint.host())
) )
end
|> Repo.delete_all(timeout: :infinity) |> Repo.delete_all(timeout: :infinity)
prune_hashtags_query = """ if !Keyword.get(options, :keep_threads) do
# Without the --keep-threads option, it's possible that bookmarked
# objects have been deleted. We remove the corresponding bookmarks.
"""
delete from public.bookmarks
where id in (
select b.id from public.bookmarks b
left join public.activities a on b.activity_id = a.id
left join public.objects o on a."data" ->> 'object' = o.data ->> 'id'
where o.id is null
)
"""
|> Repo.query([], timeout: :infinity)
end
if Keyword.get(options, :prune_orphaned_activities) do
# Prune activities who link to a single object
"""
delete from public.activities
where id in (
select a.id from public.activities a
left join public.objects o on a.data ->> 'object' = o.data ->> 'id'
left join public.activities a2 on a.data ->> 'object' = a2.data ->> 'id'
left join public.users u on a.data ->> 'object' = u.ap_id
where not a.local
and jsonb_typeof(a."data" -> 'object') = 'string'
and o.id is null
and a2.id is null
and u.id is null
)
"""
|> Repo.query([], timeout: :infinity)
# Prune activities who link to an array of objects
"""
delete from public.activities
where id in (
select a.id from public.activities a
join json_array_elements_text((a."data" -> 'object')::json) as j on jsonb_typeof(a."data" -> 'object') = 'array'
left join public.objects o on j.value = o.data ->> 'id'
left join public.activities a2 on j.value = a2.data ->> 'id'
left join public.users u on j.value = u.ap_id
group by a.id
having max(o.data ->> 'id') is null
and max(a2.data ->> 'id') is null
and max(u.ap_id) is null
)
"""
|> Repo.query([], timeout: :infinity)
end
"""
DELETE FROM hashtags AS ht DELETE FROM hashtags AS ht
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM hashtags_objects hto SELECT 1 FROM hashtags_objects hto
WHERE ht.id = hto.hashtag_id) WHERE ht.id = hto.hashtag_id)
""" """
|> Repo.query()
Repo.query(prune_hashtags_query)
if Keyword.get(options, :vacuum) do if Keyword.get(options, :vacuum) do
Maintenance.vacuum("full") Maintenance.vacuum("full")
@ -193,7 +318,7 @@ defmodule Mix.Tasks.Pleroma.Database do
"ALTER DATABASE #{db} SET default_text_search_config = '#{tsconfig}';" "ALTER DATABASE #{db} SET default_text_search_config = '#{tsconfig}';"
) )
# non-exist config will not raise excpetion but only give >0 messages # non-exist config will not raise exception but only give >0 messages
if length(msg) > 0 do if length(msg) > 0 do
shell_info("Error: #{inspect(msg, pretty: true)}") shell_info("Error: #{inspect(msg, pretty: true)}")
else else
@ -226,7 +351,7 @@ defmodule Mix.Tasks.Pleroma.Database do
) )
end end
shell_info('Done.') shell_info(~c"Done.")
end end
end end

View File

@ -30,7 +30,7 @@ defmodule Mix.Tasks.Pleroma.Digest do
shell_info("Digest email have been sent to #{nickname} (#{user.email})") shell_info("Digest email have been sent to #{nickname} (#{user.email})")
else else
_ -> _ ->
shell_info("Cound't find any mentions for #{nickname} since #{last_digest_emailed_at}") shell_info("Couldn't find any mentions for #{nickname} since #{last_digest_emailed_at}")
end end
end end
end end

View File

@ -61,7 +61,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
Logger.configure(level: :info) Logger.configure(level: :info)
if opts[:env] == "test" do if opts[:env] == "test" do
Logger.info("Rollback succesfully") Logger.info("Rollback successfully")
else else
{:ok, _, _} = {:ok, _, _} =
Ecto.Migrator.with_repo(Pleroma.Repo, &Ecto.Migrator.run(&1, path, :down, opts)) Ecto.Migrator.with_repo(Pleroma.Repo, &Ecto.Migrator.run(&1, path, :down, opts))

View File

@ -111,7 +111,7 @@ defmodule Mix.Tasks.Pleroma.Emoji do
{:ok, _} = {:ok, _} =
:zip.unzip(binary_archive, :zip.unzip(binary_archive,
cwd: pack_path, cwd: String.to_charlist(pack_path),
file_list: files_to_unzip file_list: files_to_unzip
) )

View File

@ -292,7 +292,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
if db_configurable? do if db_configurable? do
shell_info( shell_info(
" Please transfer your config to the database after running database migrations. Refer to \"Transfering the config to/from the database\" section of the docs for more information." " Please transfer your config to the database after running database migrations. Refer to \"Transferring the config to/from the database\" section of the docs for more information."
) )
end end
else else
@ -352,6 +352,4 @@ defmodule Mix.Tasks.Pleroma.Instance do
enabled_filters enabled_filters
end end
defp upload_filters(_), do: []
end end

View File

@ -0,0 +1,83 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Search.Indexer do
import Mix.Pleroma
import Ecto.Query
alias Pleroma.Workers.SearchIndexingWorker
def run(["create_index"]) do
start_pleroma()
with :ok <- Pleroma.Config.get([Pleroma.Search, :module]).create_index() do
IO.puts("Index created")
else
e -> IO.puts("Could not create index: #{inspect(e)}")
end
end
def run(["drop_index"]) do
start_pleroma()
with :ok <- Pleroma.Config.get([Pleroma.Search, :module]).drop_index() do
IO.puts("Index dropped")
else
e -> IO.puts("Could not drop index: #{inspect(e)}")
end
end
def run(["index" | options]) do
{options, [], []} =
OptionParser.parse(
options,
strict: [
chunk: :integer,
limit: :integer,
step: :integer
]
)
start_pleroma()
chunk_size = Keyword.get(options, :chunk, 100)
limit = Keyword.get(options, :limit, 100_000)
per_step = Keyword.get(options, :step, 1000)
chunks = max(div(limit, per_step), 1)
1..chunks
|> Enum.each(fn step ->
q =
from(a in Pleroma.Activity,
limit: ^per_step,
offset: ^per_step * (^step - 1),
select: [:id],
order_by: [desc: :id]
)
{:ok, ids} =
Pleroma.Repo.transaction(fn ->
Pleroma.Repo.stream(q, timeout: :infinity)
|> Enum.map(fn a ->
a.id
end)
end)
IO.puts("Got #{length(ids)} activities, adding to indexer")
ids
|> Enum.chunk_every(chunk_size)
|> Enum.each(fn chunk ->
IO.puts("Adding #{length(chunk)} activities to indexing queue")
chunk
|> Enum.map(fn id ->
SearchIndexingWorker.new(%{"op" => "add_to_index", "activity" => id})
end)
|> Oban.insert_all()
end)
end)
end
end

View File

@ -0,0 +1,145 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Search.Meilisearch do
require Pleroma.Constants
import Mix.Pleroma
import Ecto.Query
import Pleroma.Search.Meilisearch,
only: [meili_post: 2, meili_put: 2, meili_get: 1, meili_delete: 1]
def run(["index"]) do
start_pleroma()
Pleroma.HTML.compile_scrubbers()
meili_version =
(
{:ok, result} = meili_get("/version")
result["pkgVersion"]
)
# The ranking rule syntax was changed but nothing about that is mentioned in the changelog
if not Version.match?(meili_version, ">= 0.25.0") do
raise "Meilisearch <0.24.0 not supported"
end
{:ok, _} =
meili_post(
"/indexes/objects/settings/ranking-rules",
[
"published:desc",
"words",
"exactness",
"proximity",
"typo",
"attribute",
"sort"
]
)
{:ok, _} =
meili_post(
"/indexes/objects/settings/searchable-attributes",
[
"content"
]
)
IO.puts("Created indices. Starting to insert posts.")
chunk_size = Pleroma.Config.get([Pleroma.Search.Meilisearch, :initial_indexing_chunk_size])
Pleroma.Repo.transaction(
fn ->
query =
from(Pleroma.Object,
# Only index public and unlisted posts which are notes and have some text
where:
fragment("data->>'type' = 'Note'") and
(fragment("data->'to' \\? ?", ^Pleroma.Constants.as_public()) or
fragment("data->'cc' \\? ?", ^Pleroma.Constants.as_public())),
order_by: [desc: fragment("data->'published'")]
)
count = query |> Pleroma.Repo.aggregate(:count, :data)
IO.puts("Entries to index: #{count}")
Pleroma.Repo.stream(
query,
timeout: :infinity
)
|> Stream.map(&Pleroma.Search.Meilisearch.object_to_search_data/1)
|> Stream.filter(fn o -> not is_nil(o) end)
|> Stream.chunk_every(chunk_size)
|> Stream.transform(0, fn objects, acc ->
new_acc = acc + Enum.count(objects)
# Reset to the beginning of the line and rewrite it
IO.write("\r")
IO.write("Indexed #{new_acc} entries")
{[objects], new_acc}
end)
|> Stream.each(fn objects ->
result =
meili_put(
"/indexes/objects/documents",
objects
)
with {:ok, res} <- result do
if not Map.has_key?(res, "uid") do
IO.puts("\nFailed to index: #{inspect(result)}")
end
else
e -> IO.puts("\nFailed to index due to network error: #{inspect(e)}")
end
end)
|> Stream.run()
end,
timeout: :infinity
)
IO.write("\n")
end
def run(["clear"]) do
start_pleroma()
meili_delete("/indexes/objects/documents")
end
def run(["show-keys", master_key]) do
start_pleroma()
endpoint = Pleroma.Config.get([Pleroma.Search.Meilisearch, :url])
{:ok, result} =
Pleroma.HTTP.get(
Path.join(endpoint, "/keys"),
[{"Authorization", "Bearer #{master_key}"}]
)
decoded = Jason.decode!(result.body)
if decoded["results"] do
Enum.each(decoded["results"], fn %{"description" => desc, "key" => key} ->
IO.puts("#{desc}: #{key}")
end)
else
IO.puts("Error fetching the keys, check the master key is correct: #{inspect(decoded)}")
end
end
def run(["stats"]) do
start_pleroma()
{:ok, result} = meili_get("/indexes/objects/stats")
IO.puts("Number of entries: #{result["numberOfDocuments"]}")
IO.puts("Indexing? #{result["isIndexing"]}")
end
end

View File

@ -0,0 +1,25 @@
defmodule Mix.Tasks.Pleroma.TestRunner do
@shortdoc "Retries tests once if they fail"
use Mix.Task
def run(args \\ []) do
case System.cmd("mix", ["test"] ++ args, into: IO.stream(:stdio, :line)) do
{_, 0} ->
:ok
_ ->
retry(args)
end
end
def retry(args) do
case System.cmd("mix", ["test", "--failed"] ++ args, into: IO.stream(:stdio, :line)) do
{_, 0} ->
:ok
_ ->
exit(1)
end
end
end

View File

@ -1,94 +0,0 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Phoenix.Transports.WebSocket.Raw do
import Plug.Conn,
only: [
fetch_query_params: 1,
send_resp: 3
]
alias Phoenix.Socket.Transport
def default_config do
[
timeout: 60_000,
transport_log: false,
cowboy: Phoenix.Endpoint.CowboyWebSocket
]
end
def init(%Plug.Conn{method: "GET"} = conn, {endpoint, handler, transport}) do
{_, opts} = handler.__transport__(transport)
conn =
conn
|> fetch_query_params
|> Transport.transport_log(opts[:transport_log])
|> Transport.force_ssl(handler, endpoint, opts)
|> Transport.check_origin(handler, endpoint, opts)
case conn do
%{halted: false} = conn ->
case handler.connect(%{
endpoint: endpoint,
transport: transport,
options: [serializer: nil],
params: conn.params
}) do
{:ok, socket} ->
{:ok, conn, {__MODULE__, {socket, opts}}}
:error ->
send_resp(conn, :forbidden, "")
{:error, conn}
end
_ ->
{:error, conn}
end
end
def init(conn, _) do
send_resp(conn, :bad_request, "")
{:error, conn}
end
def ws_init({socket, config}) do
Process.flag(:trap_exit, true)
{:ok, %{socket: socket}, config[:timeout]}
end
def ws_handle(op, data, state) do
state.socket.handler
|> apply(:handle, [op, data, state])
|> case do
{op, data} ->
{:reply, {op, data}, state}
{op, data, state} ->
{:reply, {op, data}, state}
%{} = state ->
{:ok, state}
_ ->
{:ok, state}
end
end
def ws_info({_, _} = tuple, state) do
{:reply, tuple, state}
end
def ws_info(_tuple, state), do: {:ok, state}
def ws_close(state) do
ws_handle(:closed, :normal, state)
end
def ws_terminate(reason, state) do
ws_handle(:closed, reason, state)
end
end

View File

@ -368,7 +368,7 @@ defmodule Pleroma.Activity do
) )
end end
defdelegate search(user, query, options \\ []), to: Pleroma.Activity.Search defdelegate search(user, query, options \\ []), to: Pleroma.Search.DatabaseSearch
def direct_conversation_id(activity, for_user) do def direct_conversation_id(activity, for_user) do
alias Pleroma.Conversation.Participation alias Pleroma.Conversation.Participation

View File

@ -28,7 +28,7 @@ defmodule Pleroma.Activity.HTML do
end end
end end
defp add_cache_key_for(activity_id, additional_key) do def add_cache_key_for(activity_id, additional_key) do
current = get_cache_keys_for(activity_id) current = get_cache_keys_for(activity_id)
unless additional_key in current do unless additional_key in current do

View File

@ -9,7 +9,7 @@ defmodule Pleroma.Activity.Queries do
import Ecto.Query, only: [from: 2, where: 3] import Ecto.Query, only: [from: 2, where: 3]
@type query :: Ecto.Queryable.t() | Activity.t() @type query :: Ecto.Queryable.t() | Pleroma.Activity.t()
alias Pleroma.Activity alias Pleroma.Activity
alias Pleroma.User alias Pleroma.User

View File

@ -23,19 +23,21 @@ defmodule Pleroma.Announcement do
timestamps(type: :utc_datetime) timestamps(type: :utc_datetime)
end end
def change(struct, params \\ %{}) do @doc "Generates changeset for %Pleroma.Announcement{}"
struct @spec changeset(%__MODULE__{}, map()) :: %Ecto.Changeset{}
|> cast(validate_params(struct, params), [:data, :starts_at, :ends_at, :rendered]) def changeset(announcement \\ %__MODULE__{}, params \\ %{data: %{}}) do
announcement
|> cast(validate_params(announcement, params), [:data, :starts_at, :ends_at, :rendered])
|> validate_required([:data]) |> validate_required([:data])
end end
defp validate_params(struct, params) do defp validate_params(announcement, params) do
base_data = base_data =
%{ %{
"content" => "", "content" => "",
"all_day" => false "all_day" => false
} }
|> Map.merge((struct && struct.data) || %{}) |> Map.merge((announcement && announcement.data) || %{})
merged_data = merged_data =
Map.merge(base_data, params.data) Map.merge(base_data, params.data)
@ -61,13 +63,13 @@ defmodule Pleroma.Announcement do
end end
def add(params) do def add(params) do
changeset = change(%__MODULE__{}, params) changeset = changeset(%__MODULE__{}, params)
Repo.insert(changeset) Repo.insert(changeset)
end end
def update(announcement, params) do def update(announcement, params) do
changeset = change(announcement, params) changeset = changeset(announcement, params)
Repo.update(changeset) Repo.update(changeset)
end end

View File

@ -14,7 +14,6 @@ defmodule Pleroma.Application do
@name Mix.Project.config()[:name] @name Mix.Project.config()[:name]
@version Mix.Project.config()[:version] @version Mix.Project.config()[:version]
@repository Mix.Project.config()[:source_url] @repository Mix.Project.config()[:source_url]
@mix_env Mix.env()
def name, do: @name def name, do: @name
def version, do: @version def version, do: @version
@ -52,9 +51,12 @@ defmodule Pleroma.Application do
Pleroma.HTML.compile_scrubbers() Pleroma.HTML.compile_scrubbers()
Pleroma.Config.Oban.warn() Pleroma.Config.Oban.warn()
Config.DeprecationWarnings.warn() Config.DeprecationWarnings.warn()
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
if Config.get([Pleroma.Web.Plugs.HTTPSecurityPlug, :enable], true) do
Pleroma.Web.Plugs.HTTPSecurityPlug.warn_if_disabled()
end
Pleroma.ApplicationRequirements.verify!() Pleroma.ApplicationRequirements.verify!()
setup_instrumenters()
load_custom_modules() load_custom_modules()
Pleroma.Docs.JSON.compile() Pleroma.Docs.JSON.compile()
limiters_setup() limiters_setup()
@ -91,6 +93,7 @@ defmodule Pleroma.Application do
# Define workers and child supervisors to be supervised # Define workers and child supervisors to be supervised
children = children =
[ [
Pleroma.PromEx,
Pleroma.Repo, Pleroma.Repo,
Config.TransferTask, Config.TransferTask,
Pleroma.Emoji, Pleroma.Emoji,
@ -98,7 +101,7 @@ defmodule Pleroma.Application do
{Task.Supervisor, name: Pleroma.TaskSupervisor} {Task.Supervisor, name: Pleroma.TaskSupervisor}
] ++ ] ++
cachex_children() ++ cachex_children() ++
http_children(adapter, @mix_env) ++ http_children(adapter) ++
[ [
Pleroma.Stats, Pleroma.Stats,
Pleroma.JobQueueMonitor, Pleroma.JobQueueMonitor,
@ -106,46 +109,22 @@ defmodule Pleroma.Application do
{Oban, Config.get(Oban)}, {Oban, Config.get(Oban)},
Pleroma.Web.Endpoint Pleroma.Web.Endpoint
] ++ ] ++
task_children(@mix_env) ++ task_children() ++
dont_run_in_test(@mix_env) ++ streamer_registry() ++
background_migrators() ++
shout_child(shout_enabled?()) ++ shout_child(shout_enabled?()) ++
[Pleroma.Gopher.Server] [Pleroma.Gopher.Server] ++
[Pleroma.Search.Healthcheck]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options # for other strategies and supported options
# If we have a lot of caches, default max_restarts can cause test # If we have a lot of caches, default max_restarts can cause test
# resets to fail. # resets to fail.
# Go for the default 3 unless we're in test # Go for the default 3 unless we're in test
max_restarts = max_restarts = Application.get_env(:pleroma, __MODULE__)[:max_restarts]
if @mix_env == :test do
100
else
3
end
opts = [strategy: :one_for_one, name: Pleroma.Supervisor, max_restarts: max_restarts] opts = [strategy: :one_for_one, name: Pleroma.Supervisor, max_restarts: max_restarts]
result = Supervisor.start_link(children, opts) Supervisor.start_link(children, opts)
set_postgres_server_version()
result
end
defp set_postgres_server_version do
version =
with %{rows: [[version]]} <- Ecto.Adapters.SQL.query!(Pleroma.Repo, "show server_version"),
{num, _} <- Float.parse(version) do
num
else
e ->
Logger.warn(
"Could not get the postgres version: #{inspect(e)}.\nSetting the default value of 9.6"
)
9.6
end
:persistent_term.put({Pleroma.Repo, :postgres_version}, version)
end end
def load_custom_modules do def load_custom_modules do
@ -159,7 +138,7 @@ defmodule Pleroma.Application do
raise "Invalid custom modules" raise "Invalid custom modules"
{:ok, modules, _warnings} -> {:ok, modules, _warnings} ->
if @mix_env != :test do if Application.get_env(:pleroma, __MODULE__)[:load_custom_modules] do
Enum.each(modules, fn mod -> Enum.each(modules, fn mod ->
Logger.info("Custom module loaded: #{inspect(mod)}") Logger.info("Custom module loaded: #{inspect(mod)}")
end) end)
@ -170,29 +149,6 @@ defmodule Pleroma.Application do
end end
end end
defp setup_instrumenters do
require Prometheus.Registry
if Application.get_env(:prometheus, Pleroma.Repo.Instrumenter) do
:ok =
:telemetry.attach(
"prometheus-ecto",
[:pleroma, :repo, :query],
&Pleroma.Repo.Instrumenter.handle_event/4,
%{}
)
Pleroma.Repo.Instrumenter.setup()
end
Pleroma.Web.Endpoint.MetricsExporter.setup()
Pleroma.Web.Endpoint.PipelineInstrumenter.setup()
# Note: disabled until prometheus-phx is integrated into prometheus-phoenix:
# Pleroma.Web.Endpoint.Instrumenter.setup()
PrometheusPhx.setup()
end
defp cachex_children do defp cachex_children do
[ [
build_cachex("used_captcha", ttl_interval: seconds_valid_interval()), build_cachex("used_captcha", ttl_interval: seconds_valid_interval()),
@ -205,6 +161,7 @@ defmodule Pleroma.Application do
build_cachex("web_resp", limit: 2500), build_cachex("web_resp", limit: 2500),
build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10), build_cachex("emoji_packs", expiration: emoji_packs_expiration(), limit: 10),
build_cachex("failed_proxy_url", limit: 2500), build_cachex("failed_proxy_url", limit: 2500),
build_cachex("failed_media_helper_url", default_ttl: :timer.minutes(15), limit: 2_500),
build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000), build_cachex("banned_urls", default_ttl: :timer.hours(24 * 30), limit: 5_000),
build_cachex("chat_message_id_idempotency_key", build_cachex("chat_message_id_idempotency_key",
expiration: chat_message_id_idempotency_key_expiration(), expiration: chat_message_id_idempotency_key_expiration(),
@ -237,24 +194,30 @@ defmodule Pleroma.Application do
defp shout_enabled?, do: Config.get([:shout, :enabled]) defp shout_enabled?, do: Config.get([:shout, :enabled])
defp dont_run_in_test(env) when env in [:test, :benchmark], do: [] defp streamer_registry do
if Application.get_env(:pleroma, __MODULE__)[:streamer_registry] do
defp dont_run_in_test(_) do [
[ {Registry,
{Registry, [
[ name: Pleroma.Web.Streamer.registry(),
name: Pleroma.Web.Streamer.registry(), keys: :duplicate,
keys: :duplicate, partitions: System.schedulers_online()
partitions: System.schedulers_online() ]}
]} ]
] ++ background_migrators() else
[]
end
end end
defp background_migrators do defp background_migrators do
[ if Application.get_env(:pleroma, __MODULE__)[:background_migrators] do
Pleroma.Migrators.HashtagsTableMigrator, [
Pleroma.Migrators.ContextObjectsDeletionMigrator Pleroma.Migrators.HashtagsTableMigrator,
] Pleroma.Migrators.ContextObjectsDeletionMigrator
]
else
[]
end
end end
defp shout_child(true) do defp shout_child(true) do
@ -266,37 +229,43 @@ defmodule Pleroma.Application do
defp shout_child(_), do: [] defp shout_child(_), do: []
defp task_children(:test) do defp task_children do
[ children = [
%{ %{
id: :web_push_init, id: :web_push_init,
start: {Task, :start_link, [&Pleroma.Web.Push.init/0]}, start: {Task, :start_link, [&Pleroma.Web.Push.init/0]},
restart: :temporary restart: :temporary
} }
] ]
end
defp task_children(_) do if Application.get_env(:pleroma, __MODULE__)[:internal_fetch] do
[ children ++
%{ [
id: :web_push_init, %{
start: {Task, :start_link, [&Pleroma.Web.Push.init/0]}, id: :internal_fetch_init,
restart: :temporary start: {Task, :start_link, [&Pleroma.Web.ActivityPub.InternalFetchActor.init/0]},
}, restart: :temporary
%{ }
id: :internal_fetch_init, ]
start: {Task, :start_link, [&Pleroma.Web.ActivityPub.InternalFetchActor.init/0]}, else
restart: :temporary children
} end
]
end end
# start hackney and gun pools in tests # start hackney and gun pools in tests
defp http_children(_, :test) do defp http_children(adapter) do
http_children(Tesla.Adapter.Hackney, nil) ++ http_children(Tesla.Adapter.Gun, nil) if Application.get_env(:pleroma, __MODULE__)[:test_http_pools] do
http_children_hackney() ++ http_children_gun()
else
cond do
match?(Tesla.Adapter.Hackney, adapter) -> http_children_hackney()
match?(Tesla.Adapter.Gun, adapter) -> http_children_gun()
true -> []
end
end
end end
defp http_children(Tesla.Adapter.Hackney, _) do defp http_children_hackney do
pools = [:federation, :media] pools = [:federation, :media]
pools = pools =
@ -312,18 +281,18 @@ defmodule Pleroma.Application do
end end
end end
defp http_children(Tesla.Adapter.Gun, _) do defp http_children_gun do
Pleroma.Gun.ConnectionPool.children() ++ Pleroma.Gun.ConnectionPool.children() ++
[{Task, &Pleroma.HTTP.AdapterHelper.Gun.limiter_setup/0}] [{Task, &Pleroma.HTTP.AdapterHelper.Gun.limiter_setup/0}]
end end
defp http_children(_, _), do: []
@spec limiters_setup() :: :ok @spec limiters_setup() :: :ok
def limiters_setup do def limiters_setup do
config = Config.get(ConcurrentLimiter, []) config = Config.get(ConcurrentLimiter, [])
[Pleroma.Web.RichMedia.Helpers, Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy] [
Pleroma.Search
]
|> Enum.each(fn module -> |> Enum.each(fn module ->
mod_config = Keyword.get(config, module, []) mod_config = Keyword.get(config, module, [])

View File

@ -7,7 +7,10 @@ defmodule Pleroma.ApplicationRequirements do
The module represents the collection of validations to runs before start server. The module represents the collection of validations to runs before start server.
""" """
defmodule VerifyError, do: defexception([:message]) defmodule VerifyError do
defexception([:message])
@type t :: %__MODULE__{}
end
alias Pleroma.Config alias Pleroma.Config
alias Pleroma.Helpers.MediaHelper alias Pleroma.Helpers.MediaHelper
@ -25,6 +28,7 @@ defmodule Pleroma.ApplicationRequirements do
|> check_welcome_message_config!() |> check_welcome_message_config!()
|> check_rum!() |> check_rum!()
|> check_repo_pool_size!() |> check_repo_pool_size!()
|> check_mrfs()
|> handle_result() |> handle_result()
end end
@ -34,7 +38,7 @@ defmodule Pleroma.ApplicationRequirements do
defp check_welcome_message_config!(:ok) do defp check_welcome_message_config!(:ok) do
if Pleroma.Config.get([:welcome, :email, :enabled], false) and if Pleroma.Config.get([:welcome, :email, :enabled], false) and
not Pleroma.Emails.Mailer.enabled?() do not Pleroma.Emails.Mailer.enabled?() do
Logger.warn(""" Logger.warning("""
To send welcome emails, you need to enable the mailer. To send welcome emails, you need to enable the mailer.
Welcome emails will NOT be sent with the current config. Welcome emails will NOT be sent with the current config.
@ -53,7 +57,7 @@ defmodule Pleroma.ApplicationRequirements do
def check_confirmation_accounts!(:ok) do def check_confirmation_accounts!(:ok) do
if Pleroma.Config.get([:instance, :account_activation_required]) && if Pleroma.Config.get([:instance, :account_activation_required]) &&
not Pleroma.Emails.Mailer.enabled?() do not Pleroma.Emails.Mailer.enabled?() do
Logger.warn(""" Logger.warning("""
Account activation is required, but the mailer is disabled. Account activation is required, but the mailer is disabled.
Users will NOT be able to confirm their accounts with this config. Users will NOT be able to confirm their accounts with this config.
Either disable account activation or enable the mailer. Either disable account activation or enable the mailer.
@ -168,8 +172,6 @@ defmodule Pleroma.ApplicationRequirements do
check_filter(Pleroma.Upload.Filter.Exiftool.ReadDescription, "exiftool"), check_filter(Pleroma.Upload.Filter.Exiftool.ReadDescription, "exiftool"),
check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"), check_filter(Pleroma.Upload.Filter.Mogrify, "mogrify"),
check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"), check_filter(Pleroma.Upload.Filter.Mogrifun, "mogrify"),
check_filter(Pleroma.Upload.Filter.AnalyzeMetadata, "mogrify"),
check_filter(Pleroma.Upload.Filter.AnalyzeMetadata, "convert"),
check_filter(Pleroma.Upload.Filter.AnalyzeMetadata, "ffprobe") check_filter(Pleroma.Upload.Filter.AnalyzeMetadata, "ffprobe")
] ]
@ -195,8 +197,6 @@ defmodule Pleroma.ApplicationRequirements do
end end
end end
defp check_system_commands!(result), do: result
defp check_repo_pool_size!(:ok) do defp check_repo_pool_size!(:ok) do
if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and
not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do
@ -235,4 +235,24 @@ defmodule Pleroma.ApplicationRequirements do
true true
end end
end end
defp check_mrfs(:ok) do
mrfs = Config.get!([:mrf, :policies])
missing_mrfs =
Enum.reduce(mrfs, [], fn x, acc ->
case Code.ensure_compiled(x) do
{:module, _} -> acc
{:error, _} -> acc ++ [x]
end
end)
if Enum.empty?(missing_mrfs) do
:ok
else
{:error, "The following MRF modules are configured but missing: #{inspect(missing_mrfs)}"}
end
end
defp check_mrfs(result), do: result
end end

View File

@ -10,6 +10,7 @@ defmodule Pleroma.Bookmark do
alias Pleroma.Activity alias Pleroma.Activity
alias Pleroma.Bookmark alias Pleroma.Bookmark
alias Pleroma.BookmarkFolder
alias Pleroma.Repo alias Pleroma.Repo
alias Pleroma.User alias Pleroma.User
@ -18,33 +19,46 @@ defmodule Pleroma.Bookmark do
schema "bookmarks" do schema "bookmarks" do
belongs_to(:user, User, type: FlakeId.Ecto.CompatType) belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
belongs_to(:activity, Activity, type: FlakeId.Ecto.CompatType) belongs_to(:activity, Activity, type: FlakeId.Ecto.CompatType)
belongs_to(:folder, BookmarkFolder, type: FlakeId.Ecto.CompatType)
timestamps() timestamps()
end end
@spec create(FlakeId.Ecto.CompatType.t(), FlakeId.Ecto.CompatType.t()) :: @spec create(Ecto.UUID.t(), Ecto.UUID.t()) ::
{:ok, Bookmark.t()} | {:error, Changeset.t()} {:ok, Bookmark.t()} | {:error, Ecto.Changeset.t()}
def create(user_id, activity_id) do def create(user_id, activity_id, folder_id \\ nil) do
attrs = %{ attrs = %{
user_id: user_id, user_id: user_id,
activity_id: activity_id activity_id: activity_id,
folder_id: folder_id
} }
%Bookmark{} %Bookmark{}
|> cast(attrs, [:user_id, :activity_id]) |> cast(attrs, [:user_id, :activity_id, :folder_id])
|> validate_required([:user_id, :activity_id]) |> validate_required([:user_id, :activity_id])
|> unique_constraint(:activity_id, name: :bookmarks_user_id_activity_id_index) |> unique_constraint(:activity_id, name: :bookmarks_user_id_activity_id_index)
|> Repo.insert() |> Repo.insert(
on_conflict: [set: [folder_id: folder_id]],
conflict_target: [:user_id, :activity_id]
)
end end
@spec for_user_query(FlakeId.Ecto.CompatType.t()) :: Ecto.Query.t() @spec for_user_query(Ecto.UUID.t()) :: Ecto.Query.t()
def for_user_query(user_id) do def for_user_query(user_id, folder_id \\ nil) do
Bookmark Bookmark
|> where(user_id: ^user_id) |> where(user_id: ^user_id)
|> maybe_filter_by_folder(folder_id)
|> join(:inner, [b], activity in assoc(b, :activity)) |> join(:inner, [b], activity in assoc(b, :activity))
|> preload([b, a], activity: a) |> preload([b, a], activity: a)
end end
defp maybe_filter_by_folder(query, nil), do: query
defp maybe_filter_by_folder(query, folder_id) do
query
|> where(folder_id: ^folder_id)
end
def get(user_id, activity_id) do def get(user_id, activity_id) do
Bookmark Bookmark
|> where(user_id: ^user_id) |> where(user_id: ^user_id)
@ -52,8 +66,8 @@ defmodule Pleroma.Bookmark do
|> Repo.one() |> Repo.one()
end end
@spec destroy(FlakeId.Ecto.CompatType.t(), FlakeId.Ecto.CompatType.t()) :: @spec destroy(Ecto.UUID.t(), Ecto.UUID.t()) ::
{:ok, Bookmark.t()} | {:error, Changeset.t()} {:ok, Bookmark.t()} | {:error, Ecto.Changeset.t()}
def destroy(user_id, activity_id) do def destroy(user_id, activity_id) do
from(b in Bookmark, from(b in Bookmark,
where: b.user_id == ^user_id, where: b.user_id == ^user_id,
@ -62,4 +76,11 @@ defmodule Pleroma.Bookmark do
|> Repo.one() |> Repo.one()
|> Repo.delete() |> Repo.delete()
end end
def set_folder(bookmark, folder_id) do
bookmark
|> cast(%{folder_id: folder_id}, [:folder_id])
|> validate_required([:folder_id])
|> Repo.update()
end
end end

View File

@ -0,0 +1,115 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2024 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.BookmarkFolder do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias Pleroma.BookmarkFolder
alias Pleroma.Emoji
alias Pleroma.Repo
alias Pleroma.User
@type t :: %__MODULE__{}
@primary_key {:id, FlakeId.Ecto.CompatType, autogenerate: true}
schema "bookmark_folders" do
field(:name, :string)
field(:emoji, :string)
belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
timestamps()
end
def get_by_id(id), do: Repo.get_by(BookmarkFolder, id: id)
def create(user_id, name, emoji \\ nil) do
%BookmarkFolder{}
|> cast(
%{
user_id: user_id,
name: name,
emoji: emoji
},
[:user_id, :name, :emoji]
)
|> validate_required([:user_id, :name])
|> fix_emoji()
|> validate_emoji()
|> unique_constraint([:user_id, :name])
|> Repo.insert()
end
def update(folder_id, name, emoji \\ nil) do
get_by_id(folder_id)
|> cast(
%{
name: name,
emoji: emoji
},
[:name, :emoji]
)
|> fix_emoji()
|> validate_emoji()
|> unique_constraint([:user_id, :name])
|> Repo.update()
end
defp fix_emoji(changeset) do
with {:emoji_field, emoji} when is_binary(emoji) <-
{:emoji_field, get_field(changeset, :emoji)},
{:fixed_emoji, emoji} <-
{:fixed_emoji,
emoji
|> Pleroma.Emoji.fully_qualify_emoji()
|> Pleroma.Emoji.maybe_quote()} do
put_change(changeset, :emoji, emoji)
else
{:emoji_field, _} -> changeset
end
end
defp validate_emoji(changeset) do
validate_change(changeset, :emoji, fn
:emoji, nil ->
[]
:emoji, emoji ->
if Emoji.unicode?(emoji) or valid_local_custom_emoji?(emoji) do
[]
else
[emoji: "Invalid emoji"]
end
end)
end
defp valid_local_custom_emoji?(emoji) do
with %{file: _path} <- Emoji.get(emoji) do
true
else
_ -> false
end
end
def delete(folder_id) do
BookmarkFolder
|> Repo.get_by(id: folder_id)
|> Repo.delete()
end
def for_user(user_id) do
BookmarkFolder
|> where(user_id: ^user_id)
|> Repo.all()
end
def belongs_to_user?(folder_id, user_id) do
BookmarkFolder
|> where(id: ^folder_id, user_id: ^user_id)
|> Repo.exists?()
end
end

View File

@ -8,10 +8,13 @@ defmodule Pleroma.Caching do
@callback put(Cachex.cache(), any(), any(), Keyword.t()) :: {Cachex.status(), boolean()} @callback put(Cachex.cache(), any(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
@callback put(Cachex.cache(), any(), any()) :: {Cachex.status(), boolean()} @callback put(Cachex.cache(), any(), any()) :: {Cachex.status(), boolean()}
@callback fetch!(Cachex.cache(), any(), function() | nil) :: any() @callback fetch!(Cachex.cache(), any(), function() | nil) :: any()
@callback fetch(Cachex.cache(), any(), function() | nil) ::
{atom(), any()} | {atom(), any(), any()}
# @callback del(Cachex.cache(), any(), Keyword.t()) :: {Cachex.status(), boolean()} # @callback del(Cachex.cache(), any(), Keyword.t()) :: {Cachex.status(), boolean()}
@callback del(Cachex.cache(), any()) :: {Cachex.status(), boolean()} @callback del(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
@callback stream!(Cachex.cache(), any()) :: Enumerable.t() @callback stream!(Cachex.cache(), any()) :: Enumerable.t()
@callback expire_at(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()} @callback expire_at(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()}
@callback expire(Cachex.cache(), binary(), number()) :: {Cachex.status(), boolean()}
@callback exists?(Cachex.cache(), any()) :: {Cachex.status(), boolean()} @callback exists?(Cachex.cache(), any()) :: {Cachex.status(), boolean()}
@callback execute!(Cachex.cache(), function()) :: any() @callback execute!(Cachex.cache(), function()) :: any()
@callback get_and_update(Cachex.cache(), any(), function()) :: @callback get_and_update(Cachex.cache(), any(), function()) ::

View File

@ -29,7 +29,7 @@ defmodule Pleroma.Captcha.Kocaptcha do
@impl Service @impl Service
def validate(_token, captcha, answer_data) do def validate(_token, captcha, answer_data) do
# Here the token is unsed, because the unencrypted captcha answer is just passed to method # Here the token is unused, because the unencrypted captcha answer is just passed to method
if not is_nil(captcha) and if not is_nil(captcha) and
:crypto.hash(:md5, captcha) |> Base.encode16() == String.upcase(answer_data), :crypto.hash(:md5, captcha) |> Base.encode16() == String.upcase(answer_data),
do: :ok, do: :ok,

View File

@ -42,7 +42,7 @@ defmodule Pleroma.Chat do
|> unique_constraint(:user_id, name: :chats_user_id_recipient_index) |> unique_constraint(:user_id, name: :chats_user_id_recipient_index)
end end
@spec get_by_user_and_id(User.t(), FlakeId.Ecto.CompatType.t()) :: @spec get_by_user_and_id(User.t(), Ecto.UUID.t()) ::
{:ok, t()} | {:error, :not_found} {:ok, t()} | {:error, :not_found}
def get_by_user_and_id(%User{id: user_id}, id) do def get_by_user_and_id(%User{id: user_id}, id) do
from(c in __MODULE__, from(c in __MODULE__,
@ -52,17 +52,17 @@ defmodule Pleroma.Chat do
|> Repo.find_resource() |> Repo.find_resource()
end end
@spec get_by_id(FlakeId.Ecto.CompatType.t()) :: t() | nil @spec get_by_id(Ecto.UUID.t()) :: t() | nil
def get_by_id(id) do def get_by_id(id) do
Repo.get(__MODULE__, id) Repo.get(__MODULE__, id)
end end
@spec get(FlakeId.Ecto.CompatType.t(), String.t()) :: t() | nil @spec get(Ecto.UUID.t(), String.t()) :: t() | nil
def get(user_id, recipient) do def get(user_id, recipient) do
Repo.get_by(__MODULE__, user_id: user_id, recipient: recipient) Repo.get_by(__MODULE__, user_id: user_id, recipient: recipient)
end end
@spec get_or_create(FlakeId.Ecto.CompatType.t(), String.t()) :: @spec get_or_create(Ecto.UUID.t(), String.t()) ::
{:ok, t()} | {:error, Ecto.Changeset.t()} {:ok, t()} | {:error, Ecto.Changeset.t()}
def get_or_create(user_id, recipient) do def get_or_create(user_id, recipient) do
%__MODULE__{} %__MODULE__{}
@ -75,7 +75,7 @@ defmodule Pleroma.Chat do
) )
end end
@spec bump_or_create(FlakeId.Ecto.CompatType.t(), String.t()) :: @spec bump_or_create(Ecto.UUID.t(), String.t()) ::
{:ok, t()} | {:error, Ecto.Changeset.t()} {:ok, t()} | {:error, Ecto.Changeset.t()}
def bump_or_create(user_id, recipient) do def bump_or_create(user_id, recipient) do
%__MODULE__{} %__MODULE__{}
@ -87,7 +87,7 @@ defmodule Pleroma.Chat do
) )
end end
@spec for_user_query(FlakeId.Ecto.CompatType.t()) :: Ecto.Query.t() @spec for_user_query(Ecto.UUID.t()) :: Ecto.Query.t()
def for_user_query(user_id) do def for_user_query(user_id) do
from(c in Chat, from(c in Chat,
where: c.user_id == ^user_id, where: c.user_id == ^user_id,

View File

@ -24,7 +24,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
filters = Config.get([Pleroma.Upload]) |> Keyword.get(:filters, []) filters = Config.get([Pleroma.Upload]) |> Keyword.get(:filters, [])
if Pleroma.Upload.Filter.Exiftool in filters do if Pleroma.Upload.Filter.Exiftool in filters do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -63,7 +63,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|> Enum.any?(fn {_, v} -> Enum.any?(v, &is_binary/1) end) |> Enum.any?(fn {_, v} -> Enum.any?(v, &is_binary/1) end)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the SimplePolicy configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the SimplePolicy configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -121,7 +121,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
has_strings = Config.get([:instance, :quarantined_instances]) |> Enum.any?(&is_binary/1) has_strings = Config.get([:instance, :quarantined_instances]) |> Enum.any?(&is_binary/1)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the quarantined_instances configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the quarantined_instances configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -158,7 +158,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
has_strings = Config.get([:mrf, :transparency_exclusions]) |> Enum.any?(&is_binary/1) has_strings = Config.get([:mrf, :transparency_exclusions]) |> Enum.any?(&is_binary/1)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the transparency_exclusions configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the transparency_exclusions configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -172,7 +172,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
``` ```
config :pleroma, :mrf, config :pleroma, :mrf,
transparency_exclusions: [{"instance.tld", "Reason to exlude transparency"}] transparency_exclusions: [{"instance.tld", "Reason to exclude transparency"}]
``` ```
""") """)
@ -193,7 +193,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
def check_hellthread_threshold do def check_hellthread_threshold do
if Config.get([:mrf_hellthread, :threshold]) do if Config.get([:mrf_hellthread, :threshold]) do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
You are using the old configuration mechanism for the hellthread filter. Please check config.md. You are using the old configuration mechanism for the hellthread filter. Please check config.md.
""") """)
@ -213,7 +213,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
check_gun_pool_options(), check_gun_pool_options(),
check_activity_expiration_config(), check_activity_expiration_config(),
check_remote_ip_plug_name(), check_remote_ip_plug_name(),
check_uploders_s3_public_endpoint(), check_uploaders_s3_public_endpoint(),
check_old_chat_shoutbox(), check_old_chat_shoutbox(),
check_quarantined_instances_tuples(), check_quarantined_instances_tuples(),
check_transparency_exclusions_tuples(), check_transparency_exclusions_tuples(),
@ -256,7 +256,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
move_namespace_and_warn(@mrf_config_map, warning_preface) move_namespace_and_warn(@mrf_config_map, warning_preface)
end end
@spec move_namespace_and_warn([config_map()], String.t()) :: :ok | nil @spec move_namespace_and_warn([config_map()], String.t()) :: :ok | :error
def move_namespace_and_warn(config_map, warning_preface) do def move_namespace_and_warn(config_map, warning_preface) do
warning = warning =
Enum.reduce(config_map, "", fn Enum.reduce(config_map, "", fn
@ -274,17 +274,17 @@ defmodule Pleroma.Config.DeprecationWarnings do
if warning == "" do if warning == "" do
:ok :ok
else else
Logger.warn(warning_preface <> warning) Logger.warning(warning_preface <> warning)
:error :error
end end
end end
@spec check_media_proxy_whitelist_config() :: :ok | nil @spec check_media_proxy_whitelist_config() :: :ok | :error
def check_media_proxy_whitelist_config do def check_media_proxy_whitelist_config do
whitelist = Config.get([:media_proxy, :whitelist]) whitelist = Config.get([:media_proxy, :whitelist])
if Enum.any?(whitelist, &(not String.starts_with?(&1, "http"))) do if Enum.any?(whitelist, &(not String.starts_with?(&1, "http"))) do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using old format (only domain) for MediaProxy whitelist option. Setting should work for now, but you are advised to change format to scheme with port to prevent possible issues later. Your config is using old format (only domain) for MediaProxy whitelist option. Setting should work for now, but you are advised to change format to scheme with port to prevent possible issues later.
""") """)
@ -299,7 +299,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
pool_config = Config.get(:connections_pool) pool_config = Config.get(:connections_pool)
if timeout = pool_config[:await_up_timeout] do if timeout = pool_config[:await_up_timeout] do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using old setting `config :pleroma, :connections_pool, await_up_timeout`. Please change to `config :pleroma, :connections_pool, connect_timeout` to ensure compatibility with future releases. Your config is using old setting `config :pleroma, :connections_pool, await_up_timeout`. Please change to `config :pleroma, :connections_pool, connect_timeout` to ensure compatibility with future releases.
""") """)
@ -331,7 +331,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
"\n* `:timeout` options in #{pool_name} pool is now `:recv_timeout`" "\n* `:timeout` options in #{pool_name} pool is now `:recv_timeout`"
end) end)
Logger.warn(Enum.join([warning_preface | pool_warnings])) Logger.warning(Enum.join([warning_preface | pool_warnings]))
Config.put(:pools, updated_config) Config.put(:pools, updated_config)
:error :error
@ -340,7 +340,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
end end
end end
@spec check_activity_expiration_config() :: :ok | nil @spec check_activity_expiration_config() :: :ok | :error
def check_activity_expiration_config do def check_activity_expiration_config do
warning_preface = """ warning_preface = """
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
@ -356,7 +356,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
) )
end end
@spec check_remote_ip_plug_name() :: :ok | nil @spec check_remote_ip_plug_name() :: :ok | :error
def check_remote_ip_plug_name do def check_remote_ip_plug_name do
warning_preface = """ warning_preface = """
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
@ -372,8 +372,8 @@ defmodule Pleroma.Config.DeprecationWarnings do
) )
end end
@spec check_uploders_s3_public_endpoint() :: :ok | nil @spec check_uploaders_s3_public_endpoint() :: :ok | :error
def check_uploders_s3_public_endpoint do def check_uploaders_s3_public_endpoint do
s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3]) s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3])
use_old_config = Keyword.has_key?(s3_config, :public_endpoint) use_old_config = Keyword.has_key?(s3_config, :public_endpoint)
@ -393,7 +393,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
end end
end end
@spec check_old_chat_shoutbox() :: :ok | nil @spec check_old_chat_shoutbox() :: :ok | :error
def check_old_chat_shoutbox do def check_old_chat_shoutbox do
instance_config = Pleroma.Config.get([:instance]) instance_config = Pleroma.Config.get([:instance])
chat_config = Pleroma.Config.get([:chat]) || [] chat_config = Pleroma.Config.get([:chat]) || []

View File

@ -5,4 +5,11 @@
defmodule Pleroma.Config.Getting do defmodule Pleroma.Config.Getting do
@callback get(any()) :: any() @callback get(any()) :: any()
@callback get(any(), any()) :: any() @callback get(any(), any()) :: any()
def get(key), do: get(key, nil)
def get(key, default), do: impl().get(key, default)
def impl do
Application.get_env(:pleroma, :config_impl, Pleroma.Config)
end
end end

View File

@ -23,7 +23,7 @@ defmodule Pleroma.Config.Oban do
You are using old workers in Oban crontab settings, which were removed. You are using old workers in Oban crontab settings, which were removed.
Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)} Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)}
""" """
|> Logger.warn() |> Logger.warning()
List.delete(acc, setting) List.delete(acc, setting)
else else

View File

@ -21,7 +21,7 @@ defmodule Pleroma.Config.ReleaseRuntimeProvider do
with_runtime_config = with_runtime_config =
if File.exists?(config_path) do if File.exists?(config_path) do
# <https://git.pleroma.social/pleroma/pleroma/-/issues/3135> # <https://git.pleroma.social/pleroma/pleroma/-/issues/3135>
%File.Stat{mode: mode} = File.lstat!(config_path) %File.Stat{mode: mode} = File.stat!(config_path)
if Bitwise.band(mode, 0o007) > 0 do if Bitwise.band(mode, 0o007) > 0 do
raise "Configuration at #{config_path} has world-permissions, execute the following: chmod o= #{config_path}" raise "Configuration at #{config_path} has world-permissions, execute the following: chmod o= #{config_path}"

View File

@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server # Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> # Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only # SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Config.TransferTask do defmodule Pleroma.Config.TransferTask do
@ -44,19 +44,13 @@ defmodule Pleroma.Config.TransferTask do
with {_, true} <- {:configurable, Config.get(:configurable_from_database)} do with {_, true} <- {:configurable, Config.get(:configurable_from_database)} do
# We need to restart applications for loaded settings take effect # We need to restart applications for loaded settings take effect
{logger, other} = settings =
(Repo.all(ConfigDB) ++ deleted_settings) (Repo.all(ConfigDB) ++ deleted_settings)
|> Enum.map(&merge_with_default/1) |> Enum.map(&merge_with_default/1)
|> Enum.split_with(fn {group, _, _, _} -> group in [:logger] end)
logger
|> Enum.sort()
|> Enum.each(&configure/1)
started_applications = Application.started_applications() started_applications = Application.started_applications()
# TODO: some problem with prometheus after restart! reject = [nil, :postgrex]
reject = [nil, :prometheus, :postgrex]
reject = reject =
if restart_pleroma? do if restart_pleroma? do
@ -65,7 +59,7 @@ defmodule Pleroma.Config.TransferTask do
[:pleroma | reject] [:pleroma | reject]
end end
other settings
|> Enum.map(&update/1) |> Enum.map(&update/1)
|> Enum.uniq() |> Enum.uniq()
|> Enum.reject(&(&1 in reject)) |> Enum.reject(&(&1 in reject))
@ -103,38 +97,6 @@ defmodule Pleroma.Config.TransferTask do
{group, key, value, merged} {group, key, value, merged}
end end
# change logger configuration in runtime, without restart
defp configure({_, :backends, _, merged}) do
# removing current backends
Enum.each(Application.get_env(:logger, :backends), &Logger.remove_backend/1)
Enum.each(merged, &Logger.add_backend/1)
:ok = update_env(:logger, :backends, merged)
end
defp configure({_, key, _, merged}) when key in [:console, :ex_syslogger] do
merged =
if key == :console do
put_in(merged[:format], merged[:format] <> "\n")
else
merged
end
backend =
if key == :ex_syslogger,
do: {ExSyslogger, :ex_syslogger},
else: key
Logger.configure_backend(backend, merged)
:ok = update_env(:logger, key, merged)
end
defp configure({_, key, _, merged}) do
Logger.configure([{key, merged}])
:ok = update_env(:logger, key, merged)
end
defp update({group, key, value, merged}) do defp update({group, key, value, merged}) do
try do try do
:ok = update_env(group, key, merged) :ok = update_env(group, key, merged)
@ -145,7 +107,7 @@ defmodule Pleroma.Config.TransferTask do
error_msg = error_msg =
"updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}" "updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}"
Logger.warn(error_msg) Logger.warning(error_msg)
nil nil
end end
@ -179,12 +141,12 @@ defmodule Pleroma.Config.TransferTask do
:ok = Application.start(app) :ok = Application.start(app)
else else
nil -> nil ->
Logger.warn("#{app} is not started.") Logger.warning("#{app} is not started.")
error -> error ->
error error
|> inspect() |> inspect()
|> Logger.warn() |> Logger.warning()
end end
end end

View File

@ -54,7 +54,7 @@ defmodule Pleroma.ConfigDB do
@spec get_by_params(map()) :: ConfigDB.t() | nil @spec get_by_params(map()) :: ConfigDB.t() | nil
def get_by_params(%{group: _, key: _} = params), do: Repo.get_by(ConfigDB, params) def get_by_params(%{group: _, key: _} = params), do: Repo.get_by(ConfigDB, params)
@spec changeset(ConfigDB.t(), map()) :: Changeset.t() @spec changeset(ConfigDB.t(), map()) :: Ecto.Changeset.t()
def changeset(config, params \\ %{}) do def changeset(config, params \\ %{}) do
config config
|> cast(params, [:key, :group, :value]) |> cast(params, [:key, :group, :value])
@ -138,7 +138,7 @@ defmodule Pleroma.ConfigDB do
end end
end end
@spec update_or_create(map()) :: {:ok, ConfigDB.t()} | {:error, Changeset.t()} @spec update_or_create(map()) :: {:ok, ConfigDB.t()} | {:error, Ecto.Changeset.t()}
def update_or_create(params) do def update_or_create(params) do
params = Map.put(params, :value, to_elixir_types(params[:value])) params = Map.put(params, :value, to_elixir_types(params[:value]))
search_opts = Map.take(params, [:group, :key]) search_opts = Map.take(params, [:group, :key])
@ -165,8 +165,7 @@ defmodule Pleroma.ConfigDB do
{:pleroma, :ecto_repos}, {:pleroma, :ecto_repos},
{:mime, :types}, {:mime, :types},
{:cors_plug, [:max_age, :methods, :expose, :headers]}, {:cors_plug, [:max_age, :methods, :expose, :headers]},
{:swarm, :node_blacklist}, {:swarm, :node_blacklist}
{:logger, :backends}
] ]
Enum.any?(full_key_update, fn Enum.any?(full_key_update, fn
@ -175,7 +174,7 @@ defmodule Pleroma.ConfigDB do
end) end)
end end
@spec delete(ConfigDB.t() | map()) :: {:ok, ConfigDB.t()} | {:error, Changeset.t()} @spec delete(ConfigDB.t() | map()) :: {:ok, ConfigDB.t()} | {:error, Ecto.Changeset.t()}
def delete(%ConfigDB{} = config), do: Repo.delete(config) def delete(%ConfigDB{} = config), do: Repo.delete(config)
def delete(params) do def delete(params) do
@ -385,7 +384,12 @@ defmodule Pleroma.ConfigDB do
@spec module_name?(String.t()) :: boolean() @spec module_name?(String.t()) :: boolean()
def module_name?(string) do def module_name?(string) do
Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Ueberauth|Swoosh)\./, string) or if String.contains?(string, ".") do
string in ["Oban", "Ueberauth", "ExSyslogger", "ConcurrentLimiter"] [name | _] = String.split(string, ".", parts: 2)
name in ~w[Pleroma Phoenix Tesla Ueberauth Swoosh Logger LoggerBackends]
else
string in ~w[Oban Ueberauth ExSyslogger ConcurrentLimiter]
end
end end
end end

View File

@ -19,7 +19,8 @@ defmodule Pleroma.Constants do
"context_id", "context_id",
"deleted_activity_id", "deleted_activity_id",
"pleroma_internal", "pleroma_internal",
"generator" "generator",
"rules"
] ]
) )
@ -76,6 +77,14 @@ defmodule Pleroma.Constants do
] ]
) )
const(allowed_user_actor_types,
do: [
"Person",
"Service",
"Group"
]
)
# basic regex, just there to weed out potential mistakes # basic regex, just there to weed out potential mistakes
# https://datatracker.ietf.org/doc/html/rfc2045#section-5.1 # https://datatracker.ietf.org/doc/html/rfc2045#section-5.1
const(mime_regex, const(mime_regex,

View File

@ -57,7 +57,7 @@ defmodule Pleroma.Conversation do
3. Bump all relevant participations to 'unread' 3. Bump all relevant participations to 'unread'
""" """
def create_or_bump_for(activity, opts \\ []) do def create_or_bump_for(activity, opts \\ []) do
with true <- Pleroma.Web.ActivityPub.Visibility.is_direct?(activity), with true <- Pleroma.Web.ActivityPub.Visibility.direct?(activity),
"Create" <- activity.data["type"], "Create" <- activity.data["type"],
%Object{} = object <- Object.normalize(activity, fetch: false), %Object{} = object <- Object.normalize(activity, fetch: false),
true <- object.data["type"] in ["Note", "Question"], true <- object.data["type"] in ["Note", "Question"],

View File

@ -12,6 +12,8 @@ defmodule Pleroma.Conversation.Participation do
import Ecto.Changeset import Ecto.Changeset
import Ecto.Query import Ecto.Query
@type t :: %__MODULE__{}
schema "conversation_participations" do schema "conversation_participations" do
belongs_to(:user, User, type: FlakeId.Ecto.CompatType) belongs_to(:user, User, type: FlakeId.Ecto.CompatType)
belongs_to(:conversation, Conversation) belongs_to(:conversation, Conversation)

View File

@ -12,6 +12,8 @@ defmodule Pleroma.DataMigration do
import Ecto.Changeset import Ecto.Changeset
import Ecto.Query import Ecto.Query
@type t :: %__MODULE__{}
schema "data_migrations" do schema "data_migrations" do
field(:name, :string) field(:name, :string)
field(:state, State, default: :pending) field(:state, State, default: :pending)

View File

@ -15,8 +15,10 @@ defmodule Pleroma.Docs.Generator do
:code.all_loaded() :code.all_loaded()
|> Enum.filter(fn {module, _} -> |> Enum.filter(fn {module, _} ->
# This shouldn't be needed as all modules are expected to have module_info/1, # This shouldn't be needed as all modules are expected to have module_info/1,
# but in test enviroments some transient modules `:elixir_compiler_XX` # but in test environments some transient modules `:elixir_compiler_XX`
# are loaded for some reason (where XX is a random integer). # are loaded for some reason (where XX is a random integer).
Code.ensure_loaded(module)
if function_exported?(module, :module_info, 1) do if function_exported?(module, :module_info, 1) do
module.module_info(:attributes) module.module_info(:attributes)
|> Keyword.get_values(:behaviour) |> Keyword.get_values(:behaviour)

View File

@ -18,7 +18,7 @@ defmodule Pleroma.Docs.JSON do
:persistent_term.put(@term, Pleroma.Docs.Generator.convert_to_strings(descriptions)) :persistent_term.put(@term, Pleroma.Docs.Generator.convert_to_strings(descriptions))
end end
@spec compiled_descriptions :: Map.t() @spec compiled_descriptions :: map()
def compiled_descriptions do def compiled_descriptions do
:persistent_term.get(@term) :persistent_term.get(@term)
end end

View File

@ -27,11 +27,3 @@ defenum(Pleroma.DataMigration.State,
failed: 4, failed: 4,
manual: 5 manual: 5
) )
defenum(Pleroma.User.Backup.State,
pending: 1,
running: 2,
complete: 3,
failed: 4,
invalid: 5
)

View File

@ -8,10 +8,12 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUri do
def type, do: :string def type, do: :string
def cast(uri) when is_binary(uri) do def cast(uri) when is_binary(uri) do
case URI.parse(uri) do parsed = URI.parse(uri)
%URI{scheme: nil} -> :error
%URI{} -> {:ok, uri} if is_nil(parsed.scheme) do
_ -> :error :error
else
{:ok, uri}
end end
end end

View File

@ -345,37 +345,22 @@ defmodule Pleroma.Emails.UserEmail do
Router.Helpers.subscription_url(Endpoint, :unsubscribe, token) Router.Helpers.subscription_url(Endpoint, :unsubscribe, token)
end end
def backup_is_ready_email(backup, admin_user_id \\ nil) do def backup_is_ready_email(backup) do
%{user: user} = Pleroma.Repo.preload(backup, :user) %{user: user} = Pleroma.Repo.preload(backup, :user)
Gettext.with_locale_or_default user.language do Gettext.with_locale_or_default user.language do
download_url = Pleroma.Web.PleromaAPI.BackupView.download_url(backup) download_url = Pleroma.Web.PleromaAPI.BackupView.download_url(backup)
html_body = html_body =
if is_nil(admin_user_id) do Gettext.dpgettext(
Gettext.dpgettext( "static_pages",
"static_pages", "account archive email body",
"account archive email body - self-requested", """
""" <p>A full backup of your Pleroma account was requested. It's ready for download:</p>
<p>You requested a full backup of your Pleroma account. It's ready for download:</p> <p><a href="%{download_url}">%{download_url}</a></p>
<p><a href="%{download_url}">%{download_url}</a></p> """,
""", download_url: download_url
download_url: download_url )
)
else
admin = Pleroma.Repo.get(User, admin_user_id)
Gettext.dpgettext(
"static_pages",
"account archive email body - admin requested",
"""
<p>Admin @%{admin_nickname} requested a full backup of your Pleroma account. It's ready for download:</p>
<p><a href="%{download_url}">%{download_url}</a></p>
""",
admin_nickname: admin.nickname,
download_url: download_url
)
end
new() new()
|> to(recipient(user)) |> to(recipient(user))

View File

@ -24,6 +24,8 @@ defmodule Pleroma.Emoji do
defstruct [:code, :file, :tags, :safe_code, :safe_file] defstruct [:code, :file, :tags, :safe_code, :safe_file]
@type t :: %__MODULE__{}
@doc "Build emoji struct" @doc "Build emoji struct"
def build({code, file, tags}) do def build({code, file, tags}) do
%__MODULE__{ %__MODULE__{
@ -49,12 +51,12 @@ defmodule Pleroma.Emoji do
end end
@doc "Returns the path of the emoji `name`." @doc "Returns the path of the emoji `name`."
@spec get(String.t()) :: String.t() | nil @spec get(String.t()) :: Pleroma.Emoji.t() | nil
def get(name) do def get(name) do
name = maybe_strip_name(name) name = maybe_strip_name(name)
case :ets.lookup(@ets, name) do case :ets.lookup(@ets, name) do
[{_, path}] -> path [{_, emoji}] -> emoji
_ -> nil _ -> nil
end end
end end
@ -136,23 +138,23 @@ defmodule Pleroma.Emoji do
emojis = emojis ++ regional_indicators emojis = emojis ++ regional_indicators
for emoji <- emojis do for emoji <- emojis do
def is_unicode_emoji?(unquote(emoji)), do: true def unicode?(unquote(emoji)), do: true
end end
def is_unicode_emoji?(_), do: false def unicode?(_), do: false
@emoji_regex ~r/:[A-Za-z0-9_-]+(@.+)?:/ @emoji_regex ~r/:[A-Za-z0-9_-]+(@.+)?:/
def is_custom_emoji?(s) when is_binary(s), do: Regex.match?(@emoji_regex, s) def custom?(s) when is_binary(s), do: Regex.match?(@emoji_regex, s)
def is_custom_emoji?(_), do: false def custom?(_), do: false
def maybe_strip_name(name) when is_binary(name), do: String.trim(name, ":") def maybe_strip_name(name) when is_binary(name), do: String.trim(name, ":")
def maybe_strip_name(name), do: name def maybe_strip_name(name), do: name
def maybe_quote(name) when is_binary(name) do def maybe_quote(name) when is_binary(name) do
if is_unicode_emoji?(name) do if unicode?(name) do
name name
else else
if String.starts_with?(name, ":") do if String.starts_with?(name, ":") do

View File

@ -15,8 +15,6 @@ defmodule Pleroma.Emoji.Loader do
require Logger require Logger
@mix_env Mix.env()
@type pattern :: Regex.t() | module() | String.t() @type pattern :: Regex.t() | module() | String.t()
@type patterns :: pattern() | [pattern()] @type patterns :: pattern() | [pattern()]
@type group_patterns :: keyword(patterns()) @type group_patterns :: keyword(patterns())
@ -59,7 +57,7 @@ defmodule Pleroma.Emoji.Loader do
Logger.info("Found emoji packs: #{Enum.join(packs, ", ")}") Logger.info("Found emoji packs: #{Enum.join(packs, ", ")}")
if not Enum.empty?(files) do if not Enum.empty?(files) do
Logger.warn( Logger.warning(
"Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}" "Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}"
) )
end end
@ -79,7 +77,7 @@ defmodule Pleroma.Emoji.Loader do
# for testing emoji.txt entries we do not want exposed in normal operation # for testing emoji.txt entries we do not want exposed in normal operation
test_emoji = test_emoji =
if @mix_env == :test do if Application.get_env(:pleroma, __MODULE__)[:test_emoji] do
load_from_file("test/config/emoji.txt", emoji_groups) load_from_file("test/config/emoji.txt", emoji_groups)
else else
[] []

View File

@ -100,7 +100,7 @@ defmodule Pleroma.Emoji.Pack do
{:ok, _emoji_files} = {:ok, _emoji_files} =
:zip.unzip( :zip.unzip(
to_charlist(file.path), to_charlist(file.path),
[{:file_list, Enum.map(emojies, & &1[:path])}, {:cwd, tmp_dir}] [{:file_list, Enum.map(emojies, & &1[:path])}, {:cwd, String.to_charlist(tmp_dir)}]
) )
{_, updated_pack} = {_, updated_pack} =
@ -209,7 +209,9 @@ defmodule Pleroma.Emoji.Pack do
with :ok <- validate_shareable_packs_available(uri) do with :ok <- validate_shareable_packs_available(uri) do
uri uri
|> URI.merge("/api/pleroma/emoji/packs?page=#{opts[:page]}&page_size=#{opts[:page_size]}") |> URI.merge(
"/api/v1/pleroma/emoji/packs?page=#{opts[:page]}&page_size=#{opts[:page_size]}"
)
|> http_get() |> http_get()
end end
end end
@ -249,8 +251,12 @@ defmodule Pleroma.Emoji.Pack do
uri = url |> String.trim() |> URI.parse() uri = url |> String.trim() |> URI.parse()
with :ok <- validate_shareable_packs_available(uri), with :ok <- validate_shareable_packs_available(uri),
{:ok, %{"files_count" => files_count}} <-
uri |> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}&page_size=0") |> http_get(),
{:ok, remote_pack} <- {:ok, remote_pack} <-
uri |> URI.merge("/api/pleroma/emoji/pack?name=#{name}") |> http_get(), uri
|> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}&page_size=#{files_count}")
|> http_get(),
{:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name), {:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name),
{:ok, archive} <- download_archive(url, sha), {:ok, archive} <- download_archive(url, sha),
pack <- copy_as(remote_pack, as || name), pack <- copy_as(remote_pack, as || name),
@ -410,10 +416,10 @@ defmodule Pleroma.Emoji.Pack do
end end
defp create_archive_and_cache(pack, hash) do defp create_archive_and_cache(pack, hash) do
files = ['pack.json' | Enum.map(pack.files, fn {_, file} -> to_charlist(file) end)] files = [~c"pack.json" | Enum.map(pack.files, fn {_, file} -> to_charlist(file) end)]
{:ok, {_, result}} = {:ok, {_, result}} =
:zip.zip('#{pack.name}.zip', files, [:memory, cwd: to_charlist(pack.path)]) :zip.zip(~c"#{pack.name}.zip", files, [:memory, cwd: to_charlist(pack.path)])
ttl_per_file = Pleroma.Config.get!([:emoji, :shared_pack_cache_seconds_per_file]) ttl_per_file = Pleroma.Config.get!([:emoji, :shared_pack_cache_seconds_per_file])
overall_ttl = :timer.seconds(ttl_per_file * Enum.count(files)) overall_ttl = :timer.seconds(ttl_per_file * Enum.count(files))
@ -580,7 +586,7 @@ defmodule Pleroma.Emoji.Pack do
with :ok <- File.mkdir_p!(local_pack.path) do with :ok <- File.mkdir_p!(local_pack.path) do
files = Enum.map(remote_pack["files"], fn {_, path} -> to_charlist(path) end) files = Enum.map(remote_pack["files"], fn {_, path} -> to_charlist(path) end)
# Fallback cannot contain a pack.json file # Fallback cannot contain a pack.json file
files = if pack_info[:fallback], do: files, else: ['pack.json' | files] files = if pack_info[:fallback], do: files, else: [~c"pack.json" | files]
:zip.unzip(archive, cwd: to_charlist(local_pack.path), file_list: files) :zip.unzip(archive, cwd: to_charlist(local_pack.path), file_list: files)
end end
@ -592,7 +598,7 @@ defmodule Pleroma.Emoji.Pack do
{:ok, {:ok,
%{ %{
sha: sha, sha: sha,
url: URI.merge(uri, "/api/pleroma/emoji/packs/archive?name=#{name}") |> to_string() url: URI.merge(uri, "/api/v1/pleroma/emoji/packs/archive?name=#{name}") |> to_string()
}} }}
%{"fallback-src" => src, "fallback-src-sha256" => sha} when is_binary(src) -> %{"fallback-src" => src, "fallback-src-sha256" => sha} when is_binary(src) ->

View File

@ -216,9 +216,6 @@ defmodule Pleroma.Filter do
:re -> :re ->
~r/\b#{phrases}\b/i ~r/\b#{phrases}\b/i
_ ->
nil
end end
end end

View File

@ -199,8 +199,8 @@ defmodule Pleroma.FollowingRelationship do
|> preload([:follower]) |> preload([:follower])
|> Repo.all() |> Repo.all()
|> Enum.map(fn following_relationship -> |> Enum.map(fn following_relationship ->
Pleroma.Web.CommonAPI.follow(following_relationship.follower, target) Pleroma.Web.CommonAPI.follow(target, following_relationship.follower)
Pleroma.Web.CommonAPI.unfollow(following_relationship.follower, origin) Pleroma.Web.CommonAPI.unfollow(origin, following_relationship.follower)
end) end)
|> case do |> case do
[] -> [] ->
@ -241,13 +241,13 @@ defmodule Pleroma.FollowingRelationship do
end end
@doc """ @doc """
For a query with joined activity, For a query with joined activity's actor,
keeps rows where activity's actor is followed by user -or- is NOT domain-blocked by user. keeps rows where actor is followed by user -or- is NOT domain-blocked by user.
""" """
def keep_following_or_not_domain_blocked(query, user) do def keep_following_or_not_domain_blocked(query, user) do
where( where(
query, query,
[_, activity], [_, user_actor: user_actor],
fragment( fragment(
# "(actor's domain NOT in domain_blocks) OR (actor IS in followed AP IDs)" # "(actor's domain NOT in domain_blocks) OR (actor IS in followed AP IDs)"
""" """
@ -255,9 +255,9 @@ defmodule Pleroma.FollowingRelationship do
? = ANY(SELECT ap_id FROM users AS u INNER JOIN following_relationships AS fr ? = ANY(SELECT ap_id FROM users AS u INNER JOIN following_relationships AS fr
ON u.id = fr.following_id WHERE fr.follower_id = ? AND fr.state = ?) ON u.id = fr.following_id WHERE fr.follower_id = ? AND fr.state = ?)
""", """,
activity.actor, user_actor.ap_id,
^user.domain_blocks, ^user.domain_blocks,
activity.actor, user_actor.ap_id,
^User.binary_id(user.id), ^User.binary_id(user.id),
^accept_state_code() ^accept_state_code()
) )

View File

@ -43,10 +43,6 @@ defmodule Pleroma.Frontend do
{:download_or_unzip, _} -> {:download_or_unzip, _} ->
Logger.info("Could not download or unzip the frontend") Logger.info("Could not download or unzip the frontend")
{:error, "Could not download or unzip the frontend"} {:error, "Could not download or unzip the frontend"}
_e ->
Logger.info("Could not install the frontend")
{:error, "Could not install the frontend"}
end end
end end

View File

@ -114,7 +114,7 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
def response("/notices/" <> id) do def response("/notices/" <> id) do
with %Activity{} = activity <- Activity.get_by_id(id), with %Activity{} = activity <- Activity.get_by_id(id),
true <- Visibility.is_public?(activity) do true <- Visibility.public?(activity) do
activities = activities =
ActivityPub.fetch_activities_for_context(activity.data["context"]) ActivityPub.fetch_activities_for_context(activity.data["context"])
|> render_activities |> render_activities

View File

@ -56,7 +56,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )
@ -90,7 +90,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )
@ -106,7 +106,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )

Some files were not shown because too many files have changed in this diff Show More