2017-12-08 09:58:14 +01:00
|
|
|
defmodule EventosWeb.Router do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
Router for eventos app
|
|
|
|
"""
|
2017-12-08 09:58:14 +01:00
|
|
|
use EventosWeb, :router
|
|
|
|
|
|
|
|
pipeline :api do
|
|
|
|
plug :accepts, ["json"]
|
|
|
|
end
|
|
|
|
|
2018-05-17 11:32:23 +02:00
|
|
|
pipeline :well_known do
|
2018-05-18 09:56:21 +02:00
|
|
|
plug :accepts, ["json/application", "jrd-json"]
|
2018-05-17 11:32:23 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
pipeline :activity_pub do
|
|
|
|
plug :accepts, ["activity-json"]
|
|
|
|
plug(EventosWeb.HTTPSignaturePlug)
|
|
|
|
end
|
|
|
|
|
2017-12-09 14:58:37 +01:00
|
|
|
pipeline :api_auth do
|
2018-01-13 23:33:03 +01:00
|
|
|
plug :accepts, ["json"]
|
2017-12-09 14:58:37 +01:00
|
|
|
plug EventosWeb.AuthPipeline
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
|
|
|
|
2018-01-09 17:52:26 +01:00
|
|
|
pipeline :browser do
|
|
|
|
plug :accepts, ["html"]
|
|
|
|
plug :fetch_session
|
|
|
|
plug :fetch_flash
|
|
|
|
plug :protect_from_forgery
|
|
|
|
plug :put_secure_browser_headers
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/api", EventosWeb do
|
2017-12-09 14:58:37 +01:00
|
|
|
pipe_through :api
|
2017-12-08 09:58:14 +01:00
|
|
|
|
2018-05-17 11:32:23 +02:00
|
|
|
scope "/v1" do
|
|
|
|
|
|
|
|
post "/users", UserController, :register
|
|
|
|
post "/login", UserSessionController, :sign_in
|
2018-05-30 18:59:13 +02:00
|
|
|
get "/groups", GroupController, :index
|
2018-05-19 10:19:21 +02:00
|
|
|
get "/events", EventController, :index
|
2018-05-30 14:27:21 +02:00
|
|
|
get "/events/search/:name", EventController, :search
|
2018-06-06 17:42:53 +02:00
|
|
|
get "/events/:uuid/ics", EventController, :export_to_ics
|
|
|
|
get "/events/:uuid/tracks", TrackController, :show_tracks_for_event
|
|
|
|
get "/events/:uuid/sessions", SessionController, :show_sessions_for_event
|
|
|
|
get "/events/:uuid", EventController, :show
|
2018-05-17 11:32:23 +02:00
|
|
|
resources "/comments", CommentController, only: [:show]
|
2018-05-30 14:27:21 +02:00
|
|
|
get "/bots/:id", BotController, :view
|
2018-05-19 10:19:21 +02:00
|
|
|
|
|
|
|
get "/actors", ActorController, :index
|
|
|
|
get "/actors/search/:name", ActorController, :search
|
|
|
|
get "/actors/:name", ActorController, :show
|
2018-05-17 11:32:23 +02:00
|
|
|
resources "/tags", TagController, only: [:index, :show]
|
|
|
|
resources "/categories", CategoryController, only: [:index, :show]
|
|
|
|
resources "/sessions", SessionController, only: [:index, :show]
|
|
|
|
resources "/tracks", TrackController, only: [:index, :show]
|
|
|
|
resources "/addresses", AddressController, only: [:index, :show]
|
2018-05-30 14:27:21 +02:00
|
|
|
|
|
|
|
get "/search/:name", SearchController, :search
|
2018-05-17 11:32:23 +02:00
|
|
|
end
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
# Other scopes may use custom stacks.
|
|
|
|
scope "/api", EventosWeb do
|
2017-12-09 14:58:37 +01:00
|
|
|
pipe_through :api_auth
|
|
|
|
|
2018-05-17 11:32:23 +02:00
|
|
|
scope "/v1" do
|
|
|
|
|
2018-05-18 09:56:21 +02:00
|
|
|
get "/user", UserController, :show_current_actor
|
2018-05-17 11:32:23 +02:00
|
|
|
post "/sign-out", UserSessionController, :sign_out
|
|
|
|
resources "/users", UserController, except: [:new, :edit, :show]
|
2018-05-19 10:19:21 +02:00
|
|
|
patch "/actors/:name", ActorController, :update
|
|
|
|
post "/events", EventController, :create
|
2018-06-06 17:42:53 +02:00
|
|
|
patch "/events/:uuid", EventController, :update
|
|
|
|
put "/events/:uuid", EventController, :update
|
|
|
|
delete "/events/:uuid", EventController, :delete
|
2018-05-30 14:27:21 +02:00
|
|
|
resources "/comments", CommentController, except: [:new, :edit, :show]
|
2018-05-18 09:56:21 +02:00
|
|
|
#post "/events/:id/request", EventRequestController, :create_for_event
|
2018-05-17 11:32:23 +02:00
|
|
|
resources "/participant", ParticipantController
|
2018-05-30 14:27:21 +02:00
|
|
|
resources "/bots", BotController, except: [:new, :edit, :show]
|
2018-05-18 09:56:21 +02:00
|
|
|
#resources "/requests", EventRequestController
|
2018-05-30 18:59:13 +02:00
|
|
|
post "/groups", GroupController, :create
|
2018-06-06 17:42:53 +02:00
|
|
|
post "/groups/:name/join", GroupController, :join
|
2018-05-17 11:32:23 +02:00
|
|
|
resources "/members", MemberController
|
|
|
|
resources "/sessions", SessionController, except: [:index, :show]
|
|
|
|
resources "/tracks", TrackController, except: [:index, :show]
|
|
|
|
get "/tracks/:id/sessions", SessionController, :show_sessions_for_track
|
|
|
|
resources "/categories", CategoryController
|
|
|
|
resources "/tags", TagController
|
|
|
|
resources "/addresses", AddressController, except: [:index, :show]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/.well-known", EventosWeb do
|
|
|
|
pipe_through :well_known
|
|
|
|
|
|
|
|
get "/host-meta", WebFingerController, :host_meta
|
|
|
|
get "/webfinger", WebFingerController, :webfinger
|
|
|
|
get "/nodeinfo", NodeinfoController, :schemas
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/nodeinfo", EventosWeb do
|
|
|
|
get("/:version", NodeinfoController, :nodeinfo)
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/", EventosWeb do
|
|
|
|
pipe_through :activity_pub
|
|
|
|
|
2018-05-18 09:56:21 +02:00
|
|
|
get "/@:name", ActivityPubController, :actor
|
|
|
|
get "/@:name/outbox", ActivityPubController, :outbox
|
|
|
|
get "/@:name/following", ActivityPubController, :following
|
|
|
|
get "/@:name/followers", ActivityPubController, :followers
|
|
|
|
get "/@:name/:slug", ActivityPubController, :event
|
|
|
|
post "/@:name/inbox", ActivityPubController, :inbox
|
2018-05-17 11:32:23 +02:00
|
|
|
post "/inbox", ActivityPubController, :inbox
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
2018-01-09 17:52:26 +01:00
|
|
|
|
|
|
|
scope "/", EventosWeb do
|
|
|
|
pipe_through :browser
|
|
|
|
|
2018-01-13 23:33:03 +01:00
|
|
|
get "/*path", PageController, :index
|
2018-01-09 17:52:26 +01:00
|
|
|
end
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|