mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-12-09 05:20:38 +00:00
Merge branch 'rich-media-user-agent' into 'develop'
Allow setting custom user-agent for fetching rich media content See merge request pleroma/pleroma!4390
This commit is contained in:
commit
6e98c7a1ca
3 changed files with 12 additions and 1 deletions
1
changelog.d/rich-media-user-agent.add
Normal file
1
changelog.d/rich-media-user-agent.add
Normal file
|
|
@ -0,0 +1 @@
|
|||
Allow setting custom user-agent for fetching rich media content
|
||||
|
|
@ -2131,6 +2131,11 @@ config :pleroma, :config_description, [
|
|||
description:
|
||||
"Amount of milliseconds after which the HTTP request is forcibly terminated.",
|
||||
suggestions: [5_000]
|
||||
},
|
||||
%{
|
||||
key: :user_agent,
|
||||
type: :string,
|
||||
description: "Custom User-Agent header to be used when fetching rich media content."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -126,6 +126,11 @@ defmodule Pleroma.Web.RichMedia.Helpers do
|
|||
end
|
||||
|
||||
defp req_headers do
|
||||
[{"user-agent", Pleroma.Application.user_agent() <> "; Bot"}]
|
||||
user_agent = Config.get([:rich_media, :user_agent], :default)
|
||||
|
||||
case user_agent do
|
||||
:default -> [{"user-agent", Pleroma.Application.user_agent() <> "; Bot"}]
|
||||
custom -> [{"user-agent", custom}]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue