@ -28,7 +28,8 @@ config :block_scout_web,
"EtherChain" => "https://www.etherchain.org/",
"Bloxy" => "https://bloxy.info/"
},
other_networks: System.get_env("SUPPORTED_CHAINS")
other_networks: System.get_env("SUPPORTED_CHAINS"),
webapp_url: System.get_env("WEBAPP_URL")
config :block_scout_web, BlockScoutWeb.Counters.BlocksIndexedCounter, enabled: true
@ -3,7 +3,7 @@
<!-- Logo -->
<div class="row footer-logo-row">
<div class="col-md-12">
<%= link to: chain_path(@conn, :show), class: "footer-brand" do %>
<%= link to: webapp_url(@conn), class: "footer-brand" do %>
<img class="footer-logo" src="<%= logo_footer() %>" alt="<%= subnetwork_title() %>" />
<% end %>
</div>
@ -5,7 +5,7 @@
}
</script>
<div class="container-fluid navbar-container">
<%= link to: chain_path(@conn, :show), class: "navbar-brand", "data-test": "header_logo" do %>
<%= link to: webapp_url(@conn), class: "navbar-brand", "data-test": "header_logo" do %>
<img class="navbar-logo" id="navbar-logo" src="<%= logo() %>" alt="<%= subnetwork_title() %>" />
<script>
@ -228,4 +228,23 @@ defmodule BlockScoutWeb.LayoutView do
[]
end
defp webapp_url(conn) do
:block_scout_web
|> Application.get_env(:webapp_url)
|> validate_url()
|> case do
:error -> chain_path(conn, :show)
url -> url
defp validate_url(url) when is_binary(url) do
case URI.parse(url) do
%URI{host: nil} -> :error
_ -> {:ok, url}
defp validate_url(_), do: :error