Merge branch 'feature/http-ua-header-always' into 'develop'
http: request builder: send user-agent when making requests Closes #546 See merge request pleroma/pleroma!1174
This commit is contained in:
commit
cd7a6a25d2
@ -102,6 +102,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Mastodon API: Correct `reblogged`, `favourited`, and `bookmarked` values in the reblog status JSON
|
||||
- Mastodon API: Exposing default scope of the user to anyone
|
||||
- Mastodon API: Make `irreversible` field default to `false` [`POST /api/v1/filters`]
|
||||
- User-Agent is now sent correctly for all HTTP requests.
|
||||
|
||||
## Removed
|
||||
- Configuration: `config :pleroma, :fe` in favor of the more flexible `config :pleroma, :frontend_configurations`
|
||||
|
@ -192,6 +192,7 @@ config :tesla, adapter: Tesla.Adapter.Hackney
|
||||
# Configures http settings, upstream proxy etc.
|
||||
config :pleroma, :http,
|
||||
proxy_url: nil,
|
||||
send_user_agent: true,
|
||||
adapter: [
|
||||
ssl_options: [
|
||||
# We don't support TLS v1.3 yet
|
||||
|
@ -63,6 +63,8 @@ config :pleroma, :app_account_creation, max_requests: 5
|
||||
|
||||
config :pleroma, :http_security, report_uri: "https://endpoint.com"
|
||||
|
||||
config :pleroma, :http, send_user_agent: false
|
||||
|
||||
rum_enabled = System.get_env("RUM_ENABLED") == "true"
|
||||
config :pleroma, :database, rum_enabled: rum_enabled
|
||||
IO.puts("RUM enabled: #{rum_enabled}")
|
||||
|
@ -45,8 +45,15 @@ defmodule Pleroma.HTTP.RequestBuilder do
|
||||
Add headers to the request
|
||||
"""
|
||||
@spec headers(map(), list(tuple)) :: map()
|
||||
def headers(request, h) do
|
||||
Map.put_new(request, :headers, h)
|
||||
def headers(request, header_list) do
|
||||
header_list =
|
||||
if Pleroma.Config.get([:http, :send_user_agent]) do
|
||||
header_list ++ [{"User-Agent", Pleroma.Application.user_agent()}]
|
||||
else
|
||||
header_list
|
||||
end
|
||||
|
||||
Map.put_new(request, :headers, header_list)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
Loading…
Reference in New Issue
Block a user