mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-04-09 20:44:08 +00:00
Merge branch 'emoji-404' into 'develop'
Draft: Return 404s for unknown /{emoji,images} See merge request pleroma/pleroma!4237
This commit is contained in:
commit
14fb0936f4
2 changed files with 16 additions and 4 deletions
|
@ -63,6 +63,16 @@ defmodule Pleroma.Web.Endpoint do
|
|||
"cache-control" => @static_cache_control
|
||||
}
|
||||
)
|
||||
plug(
|
||||
:not_found,
|
||||
at: "/",
|
||||
from: :pleroma,
|
||||
only: ["emoji", "images"],
|
||||
cache_control_for_etags: @static_cache_control,
|
||||
headers: %{
|
||||
"cache-control" => @static_cache_control
|
||||
}
|
||||
)
|
||||
|
||||
plug(Pleroma.Web.Plugs.InstanceStatic,
|
||||
at: "/",
|
||||
|
@ -193,4 +203,8 @@ defmodule Pleroma.Web.Endpoint do
|
|||
def websocket_url do
|
||||
String.replace_leading(url(), "http", "ws")
|
||||
end
|
||||
|
||||
def not_found(conn) do
|
||||
send_resp(conn, 404, "not found")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,11 +17,9 @@ defmodule Pleroma.Web.Plugs.InstanceStatic do
|
|||
instance_path =
|
||||
Path.join(Pleroma.Config.get([:instance, :static_dir], "instance/static/"), path)
|
||||
|
||||
frontend_path = Pleroma.Web.Plugs.FrontendStatic.file_path(path, :primary)
|
||||
static_path = Path.join(Application.app_dir(:pleroma, "priv/static/"), path)
|
||||
|
||||
(File.exists?(instance_path) && instance_path) ||
|
||||
(frontend_path && File.exists?(frontend_path) && frontend_path) ||
|
||||
Path.join(Application.app_dir(:pleroma, "priv/static/"), path)
|
||||
(File.exists?(instance_path) && instance_path) || static_path
|
||||
end
|
||||
|
||||
def init(opts) do
|
||||
|
|
Loading…
Reference in a new issue