Skip to content

Commit

Permalink
Merge branch 'fix-download-link'
Browse files Browse the repository at this point in the history
  • Loading branch information
cromedome committed Aug 19, 2023
2 parents 6e6b3b0 + a2b50e0 commit 8bc9811
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
12 changes: 3 additions & 9 deletions lib/PerlDancer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,13 @@ hook before_template_render => sub {
}

my $json = LWP::Simple::get(
'http://api.metacpan.org/v0/release/Dancer2'
'https://fastapi.metacpan.org/v1/release/Dancer2'
) or return $latest_version;

my $response = from_json($json) or return $latest_version;
my ($short_ver) = $response->{version} =~ /^(\d+\.\d{3})/;
my $result = {
version => $response->{version},
short_version => $short_ver,
download_url => $response->{download_url},
};
$latest_version = $result;
$latest_version = $response->{download_url};
$last_check = time;
return $result;
return $latest_version;
}
}

Expand Down
4 changes: 2 additions & 2 deletions views/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ ajax '/getloadavg' => sub {


<ul class="clearme listreset dbc">
<li><a href="<% latest.download_url %>" id="contain-download">
<% latest.short_version %>&nbsp;</a></li>
<li><a href="<% latest %>" id="contain-download">
&nbsp;</a></li>
<li>You can also follow Dancer on <a
href="https://github.com/PerlDancer/Dancer2">GitHub</a> and on <a href="https://twitter.com/PerlDancer">Twitter</a></li>
</ul>
Expand Down

0 comments on commit 8bc9811

Please sign in to comment.