diff options
-rw-r--r-- | config/config.exs | 1 | ||||
-rw-r--r-- | config/description.exs | 6 | ||||
-rw-r--r-- | docs/configuration/cheatsheet.md | 1 | ||||
-rw-r--r-- | lib/pleroma/web/rich_media/parser.ex | 3 |
4 files changed, 10 insertions, 1 deletions
diff --git a/config/config.exs b/config/config.exs index d7a82ff63..d9f12d93c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -412,6 +412,7 @@ config :pleroma, :rich_media, Pleroma.Web.RichMedia.Parsers.OEmbed, Pleroma.Web.RichMedia.Parsers.TwitterCard ], + oembed_providers_enabled: true, failure_backoff: 60_000, ttl_setters: [Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl] diff --git a/config/description.exs b/config/description.exs index d9b15e684..7a88dbdb4 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1977,6 +1977,12 @@ config :pleroma, :config_description, [ description: "Enables RichMedia parsing of URLs" }, %{ + key: :oembed_providers_enabled, + type: :boolean, + description: + "Embed rich media from a list of known providers. This takes precedence over other parsers." + }, + %{ key: :ignore_hosts, type: {:list, :string}, description: "List of hosts which will be ignored by the metadata parser", diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 028c5e91d..ff00781fe 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -362,6 +362,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_tld`: list TLDs (top-level domains) which will ignore for parse metadata. default is ["local", "localdomain", "lan"]. * `parsers`: list of Rich Media parsers. +* `oembed_providers_enabled`: Embed rich media from a list of known providers. This takes precedence over other parsers. * `failure_backoff`: Amount of milliseconds after request failure, during which the request will not be retried. ## HTTP server diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex index 0eaf3274e..66c90682c 100644 --- a/lib/pleroma/web/rich_media/parser.ex +++ b/lib/pleroma/web/rich_media/parser.ex @@ -140,7 +140,8 @@ defmodule Pleroma.Web.RichMedia.Parser do end defp maybe_fetch_oembed(url) do - with {:ok, oembed_url} <- OEmbedProviders.oembed_url(url), + with true <- Pleroma.Config.get([:rich_media, :oembed_providers_enabled]), + {:ok, oembed_url} <- OEmbedProviders.oembed_url(url), {:ok, %Tesla.Env{body: json}} <- Pleroma.Web.RichMedia.Helpers.oembed_get(oembed_url), {:ok, data} <- Jason.decode(json), |