can't resist
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

106 lines
2.5 KiB

defmodule TomieWeb.Router do
use TomieWeb, :router
import Phoenix.LiveDashboard.Router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :put_root_layout, {TomieWeb.LayoutView, :root}
end
pipeline :home do
plug :accepts, ["html"]
end
pipeline :api do
plug :accepts, ["json"]
end
pipeline :protected do
plug Pow.Plug.RequireAuthenticated,
error_handler: Pow.Phoenix.PlugErrorHandler
end
# --- Auth Routes
scope "/" do
pipe_through :browser
pow_routes()
end
# --- Home Routes
scope "/", TomieWeb do
pipe_through :home
get "/", HomeController, :index
get "/about", HomeController, :about
get "/project/:name", HomeController, :project
get "/bookmark/:id", HomeController, :bookmark
end
# --- Admin Routes
scope "/admin" do
pipe_through [:browser, :protected]
live_dashboard "/dashboard", metrics: Tomie.Telemetry
end
scope "/indie" do
pipe_through [:api]
forward "/micropub",
PlugMicropub,
handler: TomieWeb.MicropubHandler,
json_encoder: Jason
end
scope "/admin", TomieWeb do
pipe_through [:browser, :protected]
live "/", PageLive.Index
get "/posts", BlogController, :index
get "/posts/new", BlogController, :new
post "/posts/new", BlogController, :create
get "/posts/:id/edit", BlogController, :edit
post "/posts/:id/edit", BlogController, :update
put "/posts/:id/edit", BlogController, :update
live "/bookmarks", BookmarkLive.Index
live "/bookmarks/new", BookmarkLive.New
live "/bookmarks/:id", BookmarkLive.Show
live "/bookmarks/:id/edit", BookmarkLive.Edit
live "/tags", TagLive.Index
live "/tags/new", TagLive.New
live "/tags/:id", TagLive.Show
live "/tags/:id/edit", TagLive.Edit
live "/jobs", JobLive.Index
live "/jobs/queues", JobLive.Queues
live "/jobs/:id", JobLive.Show
live "/listens", ListenLive.Index
live "/listens/artists", ListenLive.Artists
live "/listens/albums", ListenLive.Albums
live "/listens/charts", ListenLive.Charts
live "/listens/artist/:id", ArtistLive.Show
live "/listens/album/:id", AlbumLive.Show
live "/listens/album/:id/edit", AlbumLive.Edit
live "/listens/album/:id/merge", AlbumLive.Merge
get "/r/:id/:slug", LinkController, :redirect
resources "/profile", ProfileController,
only: [:edit, :update, :show],
singleton: true
end
end