Change references from "deleted_urls" to "banned_urls" as nothing is handled via media deletions anymore; all actions are manual operations by an admin to ban the url
This commit is contained in:
parent
c08c9db0c1
commit
2731ea1334
8 changed files with 43 additions and 43 deletions
|
|
@ -13,7 +13,7 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
setup do: clear_config([:media_proxy])
|
||||
|
||||
setup do
|
||||
on_exit(fn -> Cachex.clear(:deleted_urls_cache) end)
|
||||
on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
|
||||
end
|
||||
|
||||
setup do
|
||||
|
|
@ -34,14 +34,14 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
|
||||
describe "GET /api/pleroma/admin/media_proxy_caches" do
|
||||
test "shows banned MediaProxy URLs", %{conn: conn} do
|
||||
MediaProxy.put_in_deleted_urls([
|
||||
MediaProxy.put_in_banned_urls([
|
||||
"http://localhost:4001/media/a688346.jpg",
|
||||
"http://localhost:4001/media/fb1f4d.jpg"
|
||||
])
|
||||
|
||||
MediaProxy.put_in_deleted_urls("http://localhost:4001/media/gb1f44.jpg")
|
||||
MediaProxy.put_in_deleted_urls("http://localhost:4001/media/tb13f47.jpg")
|
||||
MediaProxy.put_in_deleted_urls("http://localhost:4001/media/wb1f46.jpg")
|
||||
MediaProxy.put_in_banned_urls("http://localhost:4001/media/gb1f44.jpg")
|
||||
MediaProxy.put_in_banned_urls("http://localhost:4001/media/tb13f47.jpg")
|
||||
MediaProxy.put_in_banned_urls("http://localhost:4001/media/wb1f46.jpg")
|
||||
|
||||
response =
|
||||
conn
|
||||
|
|
@ -74,7 +74,7 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
|
||||
describe "POST /api/pleroma/admin/media_proxy_caches/delete" do
|
||||
test "deleted MediaProxy URLs from banned", %{conn: conn} do
|
||||
MediaProxy.put_in_deleted_urls([
|
||||
MediaProxy.put_in_banned_urls([
|
||||
"http://localhost:4001/media/a688346.jpg",
|
||||
"http://localhost:4001/media/fb1f4d.jpg"
|
||||
])
|
||||
|
|
@ -88,8 +88,8 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert response["urls"] == ["http://localhost:4001/media/a688346.jpg"]
|
||||
refute MediaProxy.in_deleted_urls("http://localhost:4001/media/a688346.jpg")
|
||||
assert MediaProxy.in_deleted_urls("http://localhost:4001/media/fb1f4d.jpg")
|
||||
refute MediaProxy.in_banned_urls("http://localhost:4001/media/a688346.jpg")
|
||||
assert MediaProxy.in_banned_urls("http://localhost:4001/media/fb1f4d.jpg")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
|
||||
assert response["urls"] == urls
|
||||
|
||||
refute MediaProxy.in_deleted_urls("http://example.com/media/a688346.jpg")
|
||||
refute MediaProxy.in_deleted_urls("http://example.com/media/fb1f4d.jpg")
|
||||
refute MediaProxy.in_banned_urls("http://example.com/media/a688346.jpg")
|
||||
refute MediaProxy.in_banned_urls("http://example.com/media/fb1f4d.jpg")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -137,8 +137,8 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
|||
|
||||
assert response["urls"] == urls
|
||||
|
||||
assert MediaProxy.in_deleted_urls("http://example.com/media/a688346.jpg")
|
||||
assert MediaProxy.in_deleted_urls("http://example.com/media/fb1f4d.jpg")
|
||||
assert MediaProxy.in_banned_urls("http://example.com/media/a688346.jpg")
|
||||
assert MediaProxy.in_banned_urls("http://example.com/media/fb1f4d.jpg")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do
|
|||
setup do: clear_config([:media_proxy])
|
||||
|
||||
setup do
|
||||
on_exit(fn -> Cachex.clear(:deleted_urls_cache) end)
|
||||
on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
|
||||
end
|
||||
|
||||
describe "Invalidation.Http" do
|
||||
|
|
@ -23,7 +23,7 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do
|
|||
|
||||
Config.put([Invalidation.Http], method: :purge, headers: [{"x-refresh", 1}])
|
||||
image_url = "http://example.com/media/example.jpg"
|
||||
Pleroma.Web.MediaProxy.put_in_deleted_urls(image_url)
|
||||
Pleroma.Web.MediaProxy.put_in_banned_urls(image_url)
|
||||
|
||||
mock(fn
|
||||
%{
|
||||
|
|
@ -35,9 +35,9 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do
|
|||
end)
|
||||
|
||||
assert capture_log(fn ->
|
||||
assert Pleroma.Web.MediaProxy.in_deleted_urls(image_url)
|
||||
assert Pleroma.Web.MediaProxy.in_banned_urls(image_url)
|
||||
assert Invalidation.purge([image_url]) == {:ok, [image_url]}
|
||||
assert Pleroma.Web.MediaProxy.in_deleted_urls(image_url)
|
||||
assert Pleroma.Web.MediaProxy.in_banned_urls(image_url)
|
||||
end) =~ "Running cache purge: [\"#{image_url}\"]"
|
||||
end
|
||||
end
|
||||
|
|
@ -50,13 +50,13 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do
|
|||
Config.put([Invalidation.Script], script_path: "purge-nginx")
|
||||
|
||||
image_url = "http://example.com/media/example.jpg"
|
||||
Pleroma.Web.MediaProxy.put_in_deleted_urls(image_url)
|
||||
Pleroma.Web.MediaProxy.put_in_banned_urls(image_url)
|
||||
|
||||
with_mocks [{System, [], [cmd: fn _, _ -> {"ok", 0} end]}] do
|
||||
assert capture_log(fn ->
|
||||
assert Pleroma.Web.MediaProxy.in_deleted_urls(image_url)
|
||||
assert Pleroma.Web.MediaProxy.in_banned_urls(image_url)
|
||||
assert Invalidation.purge([image_url]) == {:ok, [image_url]}
|
||||
assert Pleroma.Web.MediaProxy.in_deleted_urls(image_url)
|
||||
assert Pleroma.Web.MediaProxy.in_banned_urls(image_url)
|
||||
end) =~ "Running cache purge: [\"#{image_url}\"]"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
|
|||
setup do: clear_config([Pleroma.Web.Endpoint, :secret_key_base])
|
||||
|
||||
setup do
|
||||
on_exit(fn -> Cachex.clear(:deleted_urls_cache) end)
|
||||
on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
|
||||
end
|
||||
|
||||
test "it returns 404 when MediaProxy disabled", %{conn: conn} do
|
||||
|
|
@ -71,11 +71,11 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
|
|||
end
|
||||
end
|
||||
|
||||
test "it returns 404 when url contains in deleted_urls cache", %{conn: conn} do
|
||||
test "it returns 404 when url contains in banned_urls cache", %{conn: conn} do
|
||||
Config.put([:media_proxy, :enabled], true)
|
||||
Config.put([Pleroma.Web.Endpoint, :secret_key_base], "00000000000")
|
||||
url = Pleroma.Web.MediaProxy.encode_url("https://google.fn/test.png")
|
||||
Pleroma.Web.MediaProxy.put_in_deleted_urls("https://google.fn/test.png")
|
||||
Pleroma.Web.MediaProxy.put_in_banned_urls("https://google.fn/test.png")
|
||||
|
||||
with_mock Pleroma.ReverseProxy,
|
||||
call: fn _conn, _url, _opts -> %Plug.Conn{status: :success} end do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue