Skip to content

Commit

Permalink
Merge pull request #31 from arturo-lang/update-web
Browse files Browse the repository at this point in the history
Update web
  • Loading branch information
drkameleon authored Nov 14, 2023
2 parents 0603081 + c36ab42 commit 31aaefd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
17 changes: 11 additions & 6 deletions website/getdownloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@
if ($pkg != "") {
if (is_dir("/var/www/pkgr.art/public/" . $pkg)) {
header("Access-Control-Allow-Origin: $http_origin");

$cnt = 0;
$files = glob("/var/www/pkg_stats/" . $pkg . "-*");

foreach ($files as $file) {
if (is_file($file)) {
$cnt = intval(file_get_contents($file));
if (isset($_GET["ver"])){
$cnt = intval(file_get_contents("/var/www/pkg_stats/" . $pkg . "-" . str_replace("_",".",$_GET["ver"])));
}
else {
$files = glob("/var/www/pkg_stats/" . $pkg . "-*");

foreach ($files as $file) {
if (is_file($file)) {
$cnt = intval(file_get_contents($file));
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions website/package.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,15 @@ <h3 class="is-size-5"><||= entry\info\description ||></h3>
</section>
<script>
$(document).ready(function(){
$.get("https://pkgr.art/getdownloads.php?pkg=<||= entry\name ||>", function (data, status){
$("#<||=entry\name ||>-downloads").html(data);
});
<|| (currentVersionIsLatest)?[ ||>
$.get("https://pkgr.art/getdownloads.php?pkg=<||= entry\name ||>", function (data, status){
$("#<||=entry\name ||>-downloads").html(data);
});
<|| ][ ||>
$.get("https://pkgr.art/getdownloads.php?pkg=<||= entry\name ||>&ver=<||= currentVersion\version ||>", function (data, status){
$("#<||=entry\name ||>-downloads").html(data);
});
<|| ] ||>
});
</script>

Expand Down

0 comments on commit 31aaefd

Please sign in to comment.