Skip to content

Fix broken download button on landing page #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -214,8 +214,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