Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
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.
 
 
 
 
 
blockscout/lib/explorer_web/router.ex

98 lines
2.6 KiB

defmodule ExplorerWeb.Router do
use ExplorerWeb, :router
pipeline :browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers, %{
"content-security-policy" => "\
default-src 'self';\
script-src 'self' 'unsafe-inline' 'unsafe-eval';\
style-src 'self' 'unsafe-inline' 'unsafe-eval';\
img-src 'self' 'unsafe-inline' 'unsafe-eval' data:;\
font-src 'self' 'unsafe-inline' 'unsafe-eval' data:;\
"
})
end
pipeline :set_locale do
plug(SetLocale, gettext: ExplorerWeb.Gettext, default_locale: "en")
end
pipeline :exq do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:put_secure_browser_headers, %{
"content-security-policy" => "\
default-src 'self';\
script-src 'self' 'unsafe-inline';\
font-src 'self' fonts.gstatic.com;\
style-src 'self' 'unsafe-inline' fonts.googleapis.com;\
"
})
plug(ExqUi.RouterPlug, namespace: "exq")
end
pipeline :jasmine do
if Mix.env() != :prod,
do: plug(Jasmine, js_files: ["js/test.js"], css_files: ["css/test.css"])
end
pipeline :api do
plug(:accepts, ["json"])
end
scope "/exq", ExqUi do
pipe_through(:exq)
forward("/", RouterPlug.Router, :index)
end
scope "/", ExplorerWeb do
pipe_through(:browser)
pipe_through(:jasmine)
pipe_through(:set_locale)
resources("/", ChainController, only: [:show], singleton: true, as: :chain)
end
scope "/:locale", ExplorerWeb do
pipe_through(:browser)
pipe_through(:jasmine)
pipe_through(:set_locale)
resources("/", ChainController, only: [:show], singleton: true, as: :chain)
resources "/blocks", BlockController, only: [:index, :show] do
resources("/transactions", BlockTransactionController, only: [:index], as: :transaction)
end
resources("/pending_transactions", PendingTransactionController, only: [:index])
resources "/transactions", TransactionController, only: [:index, :show] do
resources("/logs", TransactionLogController, only: [:index], as: :log)
resources("/internal", InternalTransactionController, only: [:index])
end
resources "/addresses", AddressController, only: [:show] do
resources(
"/transactions_to",
AddressTransactionToController,
only: [:index],
as: :transaction_to
)
resources(
"/transactions_from",
AddressTransactionFromController,
only: [:index],
as: :transaction_from
)
end
get("/search", ChainController, :search)
end
end