forked from AkkomaGang/akkoma
Merge branch 'fix/rich-media-disable-in-config' into 'develop'
Make rich media support toggleable See merge request pleroma/pleroma!748
This commit is contained in:
commit
fb9730010e
3 changed files with 7 additions and 1 deletions
|
@ -235,6 +235,8 @@
|
|||
reject: [],
|
||||
accept: []
|
||||
|
||||
config :pleroma, :rich_media, enabled: true
|
||||
|
||||
config :pleroma, :media_proxy,
|
||||
enabled: false,
|
||||
proxy_opts: [
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Reference in a new issue