Update routes
This commit is contained in:
parent
2cfc459cd0
commit
88b8b379e7
2 changed files with 24 additions and 16 deletions
|
@ -17,7 +17,7 @@ defmodule NullaWeb.ActorController do
|
||||||
|> json(%{error: "Not Found"})
|
|> json(%{error: "Not Found"})
|
||||||
|
|
||||||
%Actor{} = actor ->
|
%Actor{} = actor ->
|
||||||
if accept in ["application/activity+json", "application/ld+json"] do
|
if accept in ["application/activity+json"] do
|
||||||
conn
|
conn
|
||||||
|> put_resp_content_type("application/activity+json")
|
|> put_resp_content_type("application/activity+json")
|
||||||
|> send_resp(200, Jason.encode!(ActivityPub.actor(actor)))
|
|> send_resp(200, Jason.encode!(ActivityPub.actor(actor)))
|
||||||
|
|
|
@ -2,7 +2,7 @@ defmodule NullaWeb.Router do
|
||||||
use NullaWeb, :router
|
use NullaWeb, :router
|
||||||
|
|
||||||
pipeline :browser do
|
pipeline :browser do
|
||||||
plug :accepts, ["html", "json", "activity+json", "ld+json"]
|
plug :accepts, ["html", "json", "activity+json"]
|
||||||
plug :fetch_session
|
plug :fetch_session
|
||||||
plug :fetch_live_flash
|
plug :fetch_live_flash
|
||||||
plug :put_root_layout, html: {NullaWeb.Layouts, :root}
|
plug :put_root_layout, html: {NullaWeb.Layouts, :root}
|
||||||
|
@ -14,6 +14,10 @@ defmodule NullaWeb.Router do
|
||||||
plug :accepts, ["json"]
|
plug :accepts, ["json"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pipeline :activitypub do
|
||||||
|
plug :accepts, ["activity+json"]
|
||||||
|
end
|
||||||
|
|
||||||
scope "/", NullaWeb do
|
scope "/", NullaWeb do
|
||||||
pipe_through :browser
|
pipe_through :browser
|
||||||
|
|
||||||
|
@ -23,7 +27,6 @@ defmodule NullaWeb.Router do
|
||||||
get "/.well-known/webfinger", WebfingerController, :index
|
get "/.well-known/webfinger", WebfingerController, :index
|
||||||
get "/.well-known/nodeinfo", NodeinfoController, :index
|
get "/.well-known/nodeinfo", NodeinfoController, :index
|
||||||
get "/nodeinfo/2.0", NodeinfoController, :show
|
get "/nodeinfo/2.0", NodeinfoController, :show
|
||||||
post "/inbox", InboxController, :inbox
|
|
||||||
|
|
||||||
scope "/auth" do
|
scope "/auth" do
|
||||||
post "/", AuthController, :sign_up
|
post "/", AuthController, :sign_up
|
||||||
|
@ -33,15 +36,6 @@ defmodule NullaWeb.Router do
|
||||||
get "/sign_in", PageController, :sign_in
|
get "/sign_in", PageController, :sign_in
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/users/:username" do
|
|
||||||
get "/", ActorController, :show
|
|
||||||
get "/following", FollowController, :following
|
|
||||||
get "/followers", FollowController, :followers
|
|
||||||
post "/inbox", InboxController, :inbox
|
|
||||||
get "/outbox", OutboxController, :outbox
|
|
||||||
get "/notes/:id", NoteController, :show
|
|
||||||
end
|
|
||||||
|
|
||||||
scope "/@:username" do
|
scope "/@:username" do
|
||||||
get "/", ActorController, :show
|
get "/", ActorController, :show
|
||||||
get "/following", FollowController, :following
|
get "/following", FollowController, :following
|
||||||
|
@ -52,10 +46,24 @@ defmodule NullaWeb.Router do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Other scopes may use custom stacks.
|
scope "/api", NullaWeb do
|
||||||
# scope "/api", NullaWeb do
|
pipe_through :api
|
||||||
# pipe_through :api
|
end
|
||||||
# end
|
|
||||||
|
scope "/", NullaWeb do
|
||||||
|
pipe_through :activitypub
|
||||||
|
|
||||||
|
post "/inbox", InboxController, :inbox
|
||||||
|
|
||||||
|
scope "/users/:username" do
|
||||||
|
get "/", ActorController, :show
|
||||||
|
get "/following", FollowController, :following
|
||||||
|
get "/followers", FollowController, :followers
|
||||||
|
post "/inbox", InboxController, :inbox
|
||||||
|
get "/outbox", OutboxController, :outbox
|
||||||
|
get "/notes/:id", NoteController, :show
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Enable LiveDashboard and Swoosh mailbox preview in development
|
# Enable LiveDashboard and Swoosh mailbox preview in development
|
||||||
if Application.compile_env(:nulla, :dev_routes) do
|
if Application.compile_env(:nulla, :dev_routes) do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue