aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-08-28 14:40:26 +0000
committerlain <lain@soykaf.club>2020-08-28 14:40:26 +0000
commit51844b1e420fdfbceed6fda85e4c2e0ad87a9b1e (patch)
tree21fbe0f8b6057a2641b474b3e62e94a7c42002a5 /lib
parentb41c8cff18f7c7e6a7170a479452b5dc3d659efa (diff)
parentce387ce7306d944c11e63f0c86719afd5c2da2d2 (diff)
downloadpleroma-51844b1e420fdfbceed6fda85e4c2e0ad87a9b1e.tar.gz
Merge branch 'stable-sync/2.1.0' into 'develop'
Merge stable in develop and bump development version Closes #1610, #1621, #1613, #1375, #1374, #1614, #1422, #1595, #1620, #1364, #1640, #1643, #1653, #1624, #764, #1687, #1698, #1670, #1677, #1727, #1559, #1746, #1313, #1810, #751, and #866 See merge request pleroma/pleroma!2928
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/plugs/remote_ip.ex7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pleroma/plugs/remote_ip.ex b/lib/pleroma/plugs/remote_ip.ex
index 2eca4f8f6..0ac9050d0 100644
--- a/lib/pleroma/plugs/remote_ip.ex
+++ b/lib/pleroma/plugs/remote_ip.ex
@@ -7,6 +7,8 @@ defmodule Pleroma.Plugs.RemoteIp do
This is a shim to call [`RemoteIp`](https://git.pleroma.social/pleroma/remote_ip) but with runtime configuration.
"""
+ import Plug.Conn
+
@behaviour Plug
@headers ~w[
@@ -26,11 +28,12 @@ defmodule Pleroma.Plugs.RemoteIp do
def init(_), do: nil
- def call(conn, _) do
+ def call(%{remote_ip: original_remote_ip} = conn, _) do
config = Pleroma.Config.get(__MODULE__, [])
if Keyword.get(config, :enabled, false) do
- RemoteIp.call(conn, remote_ip_opts(config))
+ %{remote_ip: new_remote_ip} = conn = RemoteIp.call(conn, remote_ip_opts(config))
+ assign(conn, :remote_ip_found, original_remote_ip != new_remote_ip)
else
conn
end