Commit graph

9558 commits

Author SHA1 Message Date
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
Mark Felder 54ff7234b9 Fix ffmpeg framegrabs with Exile 2024-03-07 17:38:21 -05: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 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
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 (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 (lanodan) Monnier 7d624c4750
StealEmojiPolicy: Sanitize shortcodes
Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/3245
2024-02-20 09:09:54 +01: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
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 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 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
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
Alex Gleason 8daf19ec0f Fix notifications index 2024-02-12 14:13:11 -05: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
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
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
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
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
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 81c8592d69 Pleroma.Web.MastodonAPI.AccountController: fix dialyzer errors with replace_params: false 2024-01-30 16:50:00 -05: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 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