Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
fb973001
Commit
fb973001
authored
Jan 31, 2019
by
kaniini
Browse files
Merge branch 'fix/rich-media-disable-in-config' into 'develop'
Make rich media support toggleable See merge request
!748
parents
bd89cdbe
7057891d
Pipeline
#6851
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
config/config.exs
View file @
fb973001
...
@@ -235,6 +235,8 @@
...
@@ -235,6 +235,8 @@
reject:
[],
reject:
[],
accept:
[]
accept:
[]
config
:pleroma
,
:rich_media
,
enabled:
true
config
:pleroma
,
:media_proxy
,
config
:pleroma
,
:media_proxy
,
enabled:
false
,
enabled:
false
,
proxy_opts:
[
proxy_opts:
[
...
...
docs/config.md
View file @
fb973001
...
@@ -235,6 +235,9 @@ curl "http://localhost:4000/api/pleroma/admin/invite_token?admin_token=somerando
...
@@ -235,6 +235,9 @@ curl "http://localhost:4000/api/pleroma/admin/invite_token?admin_token=somerando
*
Pleroma.Web.Metadata.Providers.TwitterCard
*
Pleroma.Web.Metadata.Providers.TwitterCard
*
`unfurl_nsfw`
: If set to
`true`
nsfw attachments will be shown in previews
*
`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
## :hackney_pools
Advanced. Tweaks Hackney (http client) connections pools.
Advanced. Tweaks Hackney (http client) connections pools.
...
...
lib/pleroma/web/rich_media/helpers.ex
View file @
fb973001
...
@@ -7,7 +7,8 @@ defmodule Pleroma.Web.RichMedia.Helpers do
...
@@ -7,7 +7,8 @@ defmodule Pleroma.Web.RichMedia.Helpers do
alias
Pleroma
.
Web
.
RichMedia
.
Parser
alias
Pleroma
.
Web
.
RichMedia
.
Parser
def
fetch_data_for_activity
(%
Activity
{}
=
activity
)
do
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
,
page_url
}
<-
HTML
.
extract_first_external_url
(
object
,
object
.
data
[
"content"
]),
{
:ok
,
rich_media
}
<-
Parser
.
parse
(
page_url
)
do
{
:ok
,
rich_media
}
<-
Parser
.
parse
(
page_url
)
do
%{
page_url:
page_url
,
rich_media:
rich_media
}
%{
page_url:
page_url
,
rich_media:
rich_media
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment