Commit Graph

57 Commits

Author SHA1 Message Date
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
Lain Soykaf e4f1325f78 InetHelper: Don't use deprecated function. 2024-05-27 19:44:41 +04: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
Mark Felder 741f22bfe0 MediaHelper: cache failed URLs for 15 minutes to prevent excessive retries 2024-03-19 12:14:03 -04:00
Mark Felder 54ff7234b9 Fix ffmpeg framegrabs with Exile 2024-03-07 17:38:21 -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 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
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
Haelwenn (lanodan) Monnier f271ea6e43 Move Plugs.RemoteIP.maybe_add_cidr/1 to InetHelper.parse_cidr/1 2023-12-16 18:23:26 +01:00
Mark Felder 13baba90f6 Replace ImageMagick with Vips for Media Preview Proxy 2023-11-13 15:41:39 -05:00
lain e853cfe7c3 Revert "Merge branch 'copyright-bump' into 'develop'"
This reverts merge request !3825
2023-01-02 20:38:50 +00:00
marcin mikołajczak 10886eeaa2 Bump copyright year
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-01-01 12:13:06 +01:00
Sean King 17aa3644be
Copyright bump for 2022 2022-02-25 23:11:42 -07:00
Haelwenn (lanodan) Monnier c4439c630f
Bump Copyright to 2021
grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>;'
2021-01-13 07:49:50 +01:00
Ivan Tashkinov e9859b68fc [#3112] Ensured presence and consistency of :user and :token assigns (EnsureUserTokenAssignsPlug). Refactored auth info dropping functions. 2020-12-06 13:59:10 +03:00
Ivan Tashkinov 12a5981cc3 Session token setting on token exchange. Auth-related refactoring. 2020-11-25 21:47:23 +03:00
Ivan Tashkinov ccc2cf0e87 Session-based OAuth auth fixes (token expiration check), refactoring, tweaks. 2020-11-21 19:47:25 +03:00
Ivan Tashkinov 04f6b48ac1 Auth subsystem refactoring and tweaks.
Added proper OAuth skipping for SessionAuthenticationPlug. Integrated LegacyAuthenticationPlug into AuthenticationPlug. Adjusted tests & docs.
2020-10-31 13:38:35 +03:00
Ivan Tashkinov 524fb0e4c2 [#1668] Restricted access to app metrics endpoint by default. Added ability to configure IP whitelist for this endpoint.
Added tests and documentation.
2020-10-18 21:22:21 +03:00
Ivan Tashkinov 4e4f771082 Adjusted MediaProxyControllerTest to gracefully fail on missing dependencies. Installation docs update.
Added ffmpeg/imagemagick checks to launch checks (if media preview proxy is enabled). Added documentation on installing optional media / graphics packages (imagemagick, ffmpeg, exiftool).
2020-09-26 19:32:16 +03:00
Ivan Tashkinov 7cdbd91d83 [#2497] Configurability of :min_content_length (preview proxy). Refactoring, documentation, tests. 2020-09-17 17:13:40 +03:00
Ivan Tashkinov a781f41f96 [#2497] Media preview proxy: misc. improvements (`static` param support, dynamic fifo pipe path), refactoring. 2020-09-16 22:30:42 +03:00
Ivan Tashkinov 68a74d6659 [#2497] Added missing alias, removed legacy `:adapter` option specification for HTTP.get/_. 2020-09-09 19:30:42 +03:00
Ivan Tashkinov f170d47130 [#2497] Adjusted media proxy preview invalidation. Allowed client-side caching for media preview. Adjusted prewarmer to fetch only proxiable URIs.
Removed :preview pool in favor of existing :media one. Misc. refactoring.
2020-09-05 20:19:09 +03:00
Ivan Tashkinov c3b02341bf [#2497] Made media preview proxy fall back to media proxy instead of to source url. Adjusted tests. Refactoring. 2020-09-05 16:16:35 +03:00
Mark Felder f25b0e87f3 URL passed to helper is already MediaProxy
Set :preview pool on the request
2020-09-03 15:28:57 -05:00
Ivan Tashkinov 60c925380d [#2497] Added support for enforcing output format for media proxy preview, used for avatar_static & header_static (AccountView). 2020-09-03 20:13:29 +03:00
Mark Felder 4ef210a587 Credo 2020-08-30 09:32:22 -05:00
Mark Felder 2d2af75777 Support PNG previews to preserve alpha channels 2020-08-30 09:17:24 -05:00
href 24d522c3b3 QtFastStart: optimize
~4-6x faster
~3~4x memory usage reduction (now mostly adds what we are rewriting in
the metadatas)
2020-08-29 13:05:23 +02:00
href dfceb03cf4 Rewrite MP4/MOV binaries to be faststart
In some cases, MP4/MOV files can have the data _before_ the meta-data.

Thus, ffmpeg (and all similar tools) cannot really process the input if
it's given over stdin/streaming/pipes.

BUT I REALLY DON'T WANT TO MAKE TEMPORARY FILES

so here we go, an implementation of qtfaststart in elixir.
2020-08-28 21:14:28 +02:00
Mark Felder 3a5231ec8f Keep args construction within video/image scopes instead of mangling down in fifo town 2020-08-27 16:33:37 -05:00
Mark Felder dd1de994d5 Try to trick ffmpeg into working with this named pipe 2020-08-27 13:10:40 -05:00
Mark Felder f1218a2b4e ffmpeg needs input from fifo path, not stdin 2020-08-27 12:47:29 -05:00
Mark Felder ef9d12fcc5 Attempt at supporting video thumbnails via ffmpeg 2020-08-27 12:31:55 -05:00
Mark Felder 697bea0473 Move arg for images to the list so we can reuse these fifo functions for videos 2020-08-26 17:43:25 -05:00
Mark Felder 9567b96c79 Rename to make it obvious this is for images not videos 2020-08-26 16:40:13 -05:00
Mark Felder 2c95533ead Change method of convert using stdout, make progressive jpegs 2020-08-26 15:37:45 +00:00
Mark Felder d4d1192341 Remove auto-orient; don't use it on previews, only originals 2020-08-26 14:28:25 +00:00
href bc94f0c6da Use mkfifo to feed ImageMagick 2020-08-26 16:12:34 +02:00
Mark Felder a136e7e9b5 Try specifying fd0, force jpg out 2020-08-25 18:10:27 -05:00
Mark Felder afa03ca8e2 Allow both stdin and stdout 2020-08-25 17:36:53 -05:00
Mark Felder 899ea2da3e Switch to imagemagick, only support videos 2020-08-25 17:18:22 -05:00
href edde0d9b54 Remove newline for linter 2020-08-21 17:40:49 +00:00
href 967afa064b Fix truncated images 2020-08-21 17:02:57 +00:00
Ivan Tashkinov aa0a5ffb48 [#2497] Media preview proxy: added `quality` config setting, adjusted width/height defaults. 2020-08-21 08:59:08 +03:00
Ivan Tashkinov da116d81fb [#2497] Added video preview proxy. Switched from exexec to Port. 2020-08-18 18:23:27 +03:00
Ivan Tashkinov 61180ab6f4 Merge remote-tracking branch 'remotes/origin/develop' into 2168-media-preview-proxy
# Conflicts:
#	config/config.exs
#	lib/pleroma/web/media_proxy/media_proxy.ex
#	lib/pleroma/web/media_proxy/media_proxy_controller.ex
2020-07-02 16:36:54 +03:00
Haelwenn 54bae06b4f Create Pleroma.Maps.put_if_present(map, key, value, value_fun // &{:ok, &1})
Unifies all the similar functions to one and simplify some blocks with it.
2020-06-05 14:48:02 +00:00