Handle calling .well-known/host-meta with "application/xrd+xml" accept

header

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-03-23 19:28:19 +01:00
parent 346d6438f8
commit b002d905cb
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 12 additions and 2 deletions

View File

@ -59,7 +59,8 @@ config :mobilizon, Mobilizon.Web.Endpoint,
config :mime, :types, %{
"application/activity+json" => ["activity-json"],
"application/ld+json" => ["activity-json"],
"application/jrd+json" => ["jrd-json"]
"application/jrd+json" => ["jrd-json"],
"application/xrd+xml" => ["xrd-xml"]
}
# Upload configuration

View File

@ -9,6 +9,10 @@ defmodule Mobilizon.Web.Router do
plug(Mobilizon.Web.Auth.Pipeline)
end
pipeline :host_meta do
plug(:accepts, ["xrd-xml"])
end
pipeline :well_known do
plug(:accepts, ["json", "jrd-json"])
end
@ -67,9 +71,14 @@ defmodule Mobilizon.Web.Router do
end
scope "/.well-known", Mobilizon.Web do
pipe_through(:well_known)
pipe_through(:host_meta)
get("/host-meta", WebFingerController, :host_meta)
end
scope "/.well-known", Mobilizon.Web do
pipe_through(:well_known)
get("/webfinger", WebFingerController, :webfinger)
get("/nodeinfo", NodeInfoController, :schemas)
get("/nodeinfo/:version", NodeInfoController, :nodeinfo)