Redirect properly to correct endpoint depending on content-type

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-03-04 17:20:18 +01:00
parent 634157eb4b
commit 66e67aa816
12 changed files with 237 additions and 70 deletions

View File

@@ -19,6 +19,10 @@ defmodule MobilizonWeb.Router do
end
pipeline :activity_pub do
plug(:accepts, ["activity-json"])
end
pipeline :activity_pub_and_html do
plug(:accepts, ["activity-json", "html"])
end
@@ -61,15 +65,19 @@ defmodule MobilizonWeb.Router do
get("/@:name/feed/:format", FeedController, :actor)
end
scope "/", MobilizonWeb do
pipe_through(:activity_pub_and_html)
get("/@:name", PageController, :actor)
get("/events/:uuid", PageController, :event)
get("/comments/:uuid", PageController, :comment)
end
scope "/", MobilizonWeb do
pipe_through(:activity_pub)
get("/@:name", ActivityPubController, :actor)
get("/@:name/outbox", ActivityPubController, :outbox)
get("/@:name/following", ActivityPubController, :following)
get("/@:name/followers", ActivityPubController, :followers)
get("/events/:uuid", ActivityPubController, :event)
get("/comments/:uuid", ActivityPubController, :comment)
end
scope "/", MobilizonWeb do