2021-03-04 05:56:28 +08:00
|
|
|
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
|
2021-03-04 05:56:28 +08:00
|
|
|
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
|
2021-04-08 17:41:52 +08:00
|
|
|
plug LivebookWeb.AuthPlug
|
2021-05-04 02:03:19 +08:00
|
|
|
plug LivebookWeb.UserPlug
|
2021-01-08 03:55:45 +08:00
|
|
|
end
|
|
|
|
|
2021-03-04 05:56:28 +08:00
|
|
|
scope "/", LivebookWeb do
|
2021-04-15 21:50:29 +08:00
|
|
|
pipe_through [:browser, :auth]
|
2021-01-08 03:55:45 +08:00
|
|
|
|
2021-02-11 23:35:32 +08:00
|
|
|
live "/", HomeLive, :page
|
2021-05-04 02:03:19 +08:00
|
|
|
live "/home/user-profile", HomeLive, :user
|
2021-04-23 23:40:13 +08:00
|
|
|
live "/home/import/:tab", HomeLive, :import
|
2021-04-13 05:24:26 +08:00
|
|
|
live "/home/sessions/:session_id/close", HomeLive, :close_session
|
2021-02-11 23:35:32 +08:00
|
|
|
live "/sessions/:id", SessionLive, :page
|
2021-05-04 02:03:19 +08:00
|
|
|
live "/sessions/:id/user-profile", SessionLive, :user
|
2021-02-18 20:14:09 +08:00
|
|
|
live "/sessions/:id/shortcuts", SessionLive, :shortcuts
|
2021-04-22 05:02:09 +08:00
|
|
|
live "/sessions/:id/settings/runtime", SessionLive, :runtime_settings
|
|
|
|
live "/sessions/:id/settings/file", SessionLive, :file_settings
|
2021-03-04 05:23:48 +08:00
|
|
|
live "/sessions/:id/cell-settings/:cell_id", SessionLive, :cell_settings
|
2021-04-05 00:55:51 +08:00
|
|
|
live "/sessions/:id/cell-upload/:cell_id", SessionLive, :cell_upload
|
|
|
|
get "/sessions/:id/images/:image", SessionController, :show_image
|
2021-04-15 02:10:25 +08:00
|
|
|
|
|
|
|
live_dashboard "/dashboard", metrics: LivebookWeb.Telemetry
|
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
|