livebook/lib/livebook_web/router.ex

52 lines
1.7 KiB
Elixir
Raw Normal View History

defmodule LivebookWeb.Router do
use LivebookWeb, :router
2021-04-15 02:10:25 +08:00
import Phoenix.LiveDashboard.Router
2021-01-08 03:55:45 +08:00
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
2021-01-08 04:16:54 +08:00
plug :fetch_live_flash
plug :put_root_layout, {LivebookWeb.LayoutView, :root}
2021-01-08 03:55:45 +08:00
plug :protect_from_forgery
plug :put_secure_browser_headers
2021-04-15 20:15:56 +08:00
end
pipeline :auth do
plug LivebookWeb.AuthPlug
plug LivebookWeb.UserPlug
2021-01-08 03:55:45 +08:00
end
scope "/", LivebookWeb do
pipe_through [:browser, :auth]
2021-01-08 03:55:45 +08:00
live "/", HomeLive, :page
live "/home/user-profile", HomeLive, :user
live "/home/import/:tab", HomeLive, :import
live "/home/sessions/:session_id/close", HomeLive, :close_session
live "/explore", ExploreLive, :page
live "/explore/user-profile", ExploreLive, :user
live "/explore/notebooks/:slug", ExploreLive, :notebook
live "/sessions/:id", SessionLive, :page
live "/sessions/:id/user-profile", SessionLive, :user
live "/sessions/:id/shortcuts", SessionLive, :shortcuts
live "/sessions/:id/settings/runtime", SessionLive, :runtime_settings
live "/sessions/:id/settings/file", SessionLive, :file_settings
live "/sessions/:id/bin", SessionLive, :bin
live "/sessions/:id/cell-settings/:cell_id", SessionLive, :cell_settings
live "/sessions/:id/cell-upload/:cell_id", SessionLive, :cell_upload
live "/sessions/:id/delete-section/:section_id", SessionLive, :delete_section
get "/sessions/:id/images/:image", SessionController, :show_image
2021-04-15 02:10:25 +08:00
live_dashboard "/dashboard",
metrics: LivebookWeb.Telemetry,
home_app: {"Livebook", :livebook}
2021-01-08 03:55:45 +08:00
end
2021-04-15 20:15:56 +08:00
scope "/authenticate", LivebookWeb do
pipe_through :browser
get "/", AuthController, :index
post "/", AuthController, :authenticate
end
2021-01-08 03:55:45 +08:00
end