|
|
@ -109,25 +109,34 @@ defmodule BlockScoutWeb.LayoutView do |
|
|
|
BlockScoutWeb.version() |
|
|
|
BlockScoutWeb.version() |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def release_link(""), do: "" |
|
|
|
|
|
|
|
def release_link(nil), do: "" |
|
|
|
|
|
|
|
|
|
|
|
def release_link(version) do |
|
|
|
def release_link(version) do |
|
|
|
release_link_env_var = Application.get_env(:block_scout_web, :release_link) |
|
|
|
release_link_env_var = Application.get_env(:block_scout_web, :release_link) |
|
|
|
|
|
|
|
|
|
|
|
release_link = |
|
|
|
release_link = |
|
|
|
cond do |
|
|
|
if release_link_env_var == "" || release_link_env_var == nil do |
|
|
|
version == "" || version == nil -> |
|
|
|
release_link_from_version(version) |
|
|
|
nil |
|
|
|
else |
|
|
|
|
|
|
|
release_link_env_var |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
release_link_env_var == "" || release_link_env_var == nil -> |
|
|
|
html_escape({:safe, "<a href=\"#{release_link}\" class=\"footer-link\" target=\"_blank\">#{version}</a>"}) |
|
|
|
"https://github.com/blockscout/blockscout/releases/tag/" <> version |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
true -> |
|
|
|
def release_link_from_version(version) do |
|
|
|
release_link_env_var |
|
|
|
repo = "https://github.com/blockscout/blockscout" |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if String.contains?(version, "+commit.") do |
|
|
|
|
|
|
|
commit_hash = |
|
|
|
|
|
|
|
version |
|
|
|
|
|
|
|
|> String.split("+commit.") |
|
|
|
|
|
|
|
|> List.last() |
|
|
|
|
|
|
|
|
|
|
|
if release_link == nil do |
|
|
|
repo <> "/commit/" <> commit_hash |
|
|
|
"" |
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
html_escape({:safe, "<a href=\"#{release_link}\" class=\"footer-link\" target=\"_blank\">#{version}</a>"}) |
|
|
|
repo <> "/releases/tag/" <> version |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|