|
|
@ -2,6 +2,10 @@ defmodule BlockScoutWeb.Router do |
|
|
|
use BlockScoutWeb, :router |
|
|
|
use BlockScoutWeb, :router |
|
|
|
|
|
|
|
|
|
|
|
alias BlockScoutWeb.Plug.GraphQL |
|
|
|
alias BlockScoutWeb.Plug.GraphQL |
|
|
|
|
|
|
|
alias BlockScoutWeb.{ApiRouter, WebRouter} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forward("/wobserver", Wobserver.Web.Router) |
|
|
|
|
|
|
|
forward("/admin", BlockScoutWeb.AdminRouter) |
|
|
|
|
|
|
|
|
|
|
|
pipeline :browser do |
|
|
|
pipeline :browser do |
|
|
|
plug(:accepts, ["html"]) |
|
|
|
plug(:accepts, ["html"]) |
|
|
@ -11,13 +15,24 @@ defmodule BlockScoutWeb.Router do |
|
|
|
plug(BlockScoutWeb.CSPHeader) |
|
|
|
plug(BlockScoutWeb.CSPHeader) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
forward("/wobserver", Wobserver.Web.Router) |
|
|
|
pipeline :api do |
|
|
|
forward("/admin", BlockScoutWeb.AdminRouter) |
|
|
|
plug(:accepts, ["json"]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope "/", BlockScoutWeb.API.V1, as: :api_v1 do |
|
|
|
|
|
|
|
pipe_through(:api) |
|
|
|
|
|
|
|
get("/api/v1/health", HealthController, :health) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if Application.get_env(:block_scout_web, BlockScoutWeb.ApiRouter)[:enabled] do |
|
|
|
scope "/verify_smart_contract" do |
|
|
|
forward("/api", BlockScoutWeb.ApiRouter) |
|
|
|
pipe_through(:api) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
post("/contract_verifications", BlockScoutWeb.AddressContractVerificationController, :create) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Application.get_env(:block_scout_web, ApiRouter)[:enabled] do |
|
|
|
|
|
|
|
forward("/api", ApiRouter) |
|
|
|
|
|
|
|
|
|
|
|
# For backward compatibility. Should be removed |
|
|
|
|
|
|
|
# Needs to be 200 to support the schema introspection for graphiql |
|
|
|
# Needs to be 200 to support the schema introspection for graphiql |
|
|
|
@max_complexity 200 |
|
|
|
@max_complexity 200 |
|
|
|
|
|
|
|
|
|
|
@ -35,9 +50,28 @@ defmodule BlockScoutWeb.Router do |
|
|
|
analyze_complexity: true, |
|
|
|
analyze_complexity: true, |
|
|
|
max_complexity: @max_complexity |
|
|
|
max_complexity: @max_complexity |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
scope "/", BlockScoutWeb do |
|
|
|
|
|
|
|
pipe_through(:browser) |
|
|
|
|
|
|
|
get("/api_docs", PageNotFoundController, :index) |
|
|
|
|
|
|
|
get("/eth_rpc_api_docs", PageNotFoundController, :index) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scope "/", BlockScoutWeb do |
|
|
|
|
|
|
|
pipe_through(:browser) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get("/api_docs", APIDocsController, :index) |
|
|
|
|
|
|
|
get("/eth_rpc_api_docs", APIDocsController, :eth_rpc) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if Application.get_env(:block_scout_web, BlockScoutWeb.WebRouter)[:enabled] do |
|
|
|
if Application.get_env(:block_scout_web, WebRouter)[:enabled] do |
|
|
|
forward("/", BlockScoutWeb.WebRouter) |
|
|
|
forward("/", BlockScoutWeb.WebRouter) |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
scope "/", BlockScoutWeb do |
|
|
|
|
|
|
|
pipe_through(:browser) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forward("/", APIDocsController, :index) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|