defmodule GuildhallWeb.Router do use GuildhallWeb, :router import GuildhallWeb.Plugs.Auth, only: [fetch_current_user: 2] pipeline :browser do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash plug :put_root_layout, html: {GuildhallWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug :fetch_current_user end pipeline :api do plug :accepts, ["json"] end # Public auth routes (no auth required) scope "/auth", GuildhallWeb do pipe_through :browser get "/login", AuthController, :login get "/callback", AuthController, :callback get "/logout", AuthController, :logout end # Authenticated LiveView routes scope "/", GuildhallWeb do pipe_through :browser live_session :authenticated, on_mount: {GuildhallWeb.AuthHooks, :require_auth} do live "/", DashboardLive, :index live "/ceremonies", CeremonyLive.Index, :index live "/artifacts", ArtifactLive.Index, :index live "/guilds", GuildLive.Index, :index live "/guilds/register", GuildLive.Register, :new live "/guilds/:slug", GuildLive.Show, :show live "/guilds/:slug/schematic", GuildLive.Schematic, :schematic live "/guilds/:slug/realization", GuildLive.Realization, :realization live "/guilds/:slug/join", GuildLive.Join, :join live "/guilds/:slug/members", GuildLive.Members, :members end end # Health check endpoint for Kubernetes probes + LB targets. scope "/health", GuildhallWeb do pipe_through :api get "/", HealthController, :check end end