mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-23 09:44:52 +00:00
Allow fetching over IPv6
Mint/Finch disable IPv6 by default preventing us from fetching anything from IPv6-only hosts without this.
This commit is contained in:
parent
889b57df82
commit
fc95519dbf
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- Issue preventing fetching anything from IPv6-only instances
|
||||||
|
|
||||||
## 2024.02
|
## 2024.02
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
|
@ -288,6 +288,7 @@ defmodule Pleroma.Application do
|
||||||
|> Config.get([])
|
|> Config.get([])
|
||||||
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
||||||
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
||||||
|
|> Pleroma.HTTP.AdapterHelper.ensure_ipv6()
|
||||||
|> Keyword.put(:name, MyFinch)
|
|> Keyword.put(:name, MyFinch)
|
||||||
|
|
||||||
[{Finch, config}]
|
[{Finch, config}]
|
||||||
|
|
|
@ -65,6 +65,15 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
||||||
|> put_in([:pools, :default, :size], pool_size)
|
|> put_in([:pools, :default, :size], pool_size)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ensure_ipv6(opts) do
|
||||||
|
# Default transport opts already enable IPv6, so just ensure they're loaded
|
||||||
|
opts
|
||||||
|
|> maybe_add_pools()
|
||||||
|
|> maybe_add_default_pool()
|
||||||
|
|> maybe_add_conn_opts()
|
||||||
|
|> maybe_add_transport_opts()
|
||||||
|
end
|
||||||
|
|
||||||
defp maybe_add_pools(opts) do
|
defp maybe_add_pools(opts) do
|
||||||
if Keyword.has_key?(opts, :pools) do
|
if Keyword.has_key?(opts, :pools) do
|
||||||
opts
|
opts
|
||||||
|
@ -96,11 +105,15 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
||||||
defp maybe_add_transport_opts(opts) do
|
defp maybe_add_transport_opts(opts) do
|
||||||
transport_opts = get_in(opts, [:pools, :default, :conn_opts, :transport_opts])
|
transport_opts = get_in(opts, [:pools, :default, :conn_opts, :transport_opts])
|
||||||
|
|
||||||
unless is_nil(transport_opts) do
|
opts =
|
||||||
opts
|
unless is_nil(transport_opts) do
|
||||||
else
|
opts
|
||||||
put_in(opts, [:pools, :default, :conn_opts, :transport_opts], [])
|
else
|
||||||
end
|
put_in(opts, [:pools, :default, :conn_opts, :transport_opts], [])
|
||||||
|
end
|
||||||
|
|
||||||
|
# IPv6 is disabled and IPv4 enabled by default; ensure we can use both
|
||||||
|
put_in(opts, [:pools, :default, :conn_opts, :transport_opts, :inet6], true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
|
Loading…
Reference in a new issue