aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/config.exs2
-rw-r--r--docs/config.md5
-rw-r--r--lib/pleroma/web/rich_media/helpers.ex3
3 files changed, 8 insertions, 2 deletions
diff --git a/config/config.exs b/config/config.exs
index 4dc7a62d7..98c94c149 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -235,6 +235,8 @@ config :pleroma, :mrf_simple,
reject: [],
accept: []
+config :pleroma, :rich_media, enabled: true
+
config :pleroma, :media_proxy,
enabled: false,
proxy_opts: [
diff --git a/docs/config.md b/docs/config.md
index 4f4a4378c..22a9b23f9 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -123,7 +123,7 @@ This section is used to configure Pleroma-FE, unless ``:managed_config`` in ``:i
* `theme`: Which theme to use, they are defined in ``styles.json``
* `logo`: URL of the logo, defaults to Pleroma’s logo
-* `logo_mask`: Whenether to mask the logo
+* `logo_mask`: Whether to use only the logo's shape as a mask (true) or as a regular image (false)
* `logo_margin`: What margin to use around the logo
* `background`: URL of the background, unless viewing a user profile with a background that is set
* `redirect_root_no_login`: relative URL which indicates where to redirect when a user isn’t logged in.
@@ -235,6 +235,9 @@ curl "http://localhost:4000/api/pleroma/admin/invite_token?admin_token=somerando
* Pleroma.Web.Metadata.Providers.TwitterCard
* `unfurl_nsfw`: If set to `true` nsfw attachments will be shown in previews
+## :rich_media
+* `enabled`: if enabled the instance will parse metadata from attached links to generate link previews
+
## :hackney_pools
Advanced. Tweaks Hackney (http client) connections pools.
diff --git a/lib/pleroma/web/rich_media/helpers.ex b/lib/pleroma/web/rich_media/helpers.ex
index 71fdddef9..44e876777 100644
--- a/lib/pleroma/web/rich_media/helpers.ex
+++ b/lib/pleroma/web/rich_media/helpers.ex
@@ -7,7 +7,8 @@ defmodule Pleroma.Web.RichMedia.Helpers do
alias Pleroma.Web.RichMedia.Parser
def fetch_data_for_activity(%Activity{} = activity) do
- with %Object{} = object <- Object.normalize(activity.data["object"]),
+ with true <- Pleroma.Config.get([:rich_media, :enabled], true),
+ %Object{} = object <- Object.normalize(activity.data["object"]),
{:ok, page_url} <- HTML.extract_first_external_url(object, object.data["content"]),
{:ok, rich_media} <- Parser.parse(page_url) do
%{page_url: page_url, rich_media: rich_media}