AppImage / AppImage/appimage.github.io

Use client-side JavaScript to get the latest release from GitHub

Ouverte
#61 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement help wanted
Langage dominant
Shell
Étoiles
374
Forks
769
Merge moyen
4 j 10 h
PR mergées (30 j)
8

Description

AppImageHub is a repository of AppImages available on the net, but we don't want to keep track of each version released. It is a vital part of the AppImage philosophy that there should be no intermediaries between application authors and users, and in the very same second a releases is made available, it should be "there" for download for users. Hence, for AppImages made available on GitHub Releases, we could use the GitHub API on the client side to get the latest AppImage.

Something along the lines of https://stackoverflow.com/questions/24987542/

```

$(document).ready(function () {
GetLatestReleaseInfo();
});

function GetLatestReleaseInfo() {
$.getJSON("https://api.github.com/repos/ShareX/ShareX/releases/latest").done(function (release) {
var asset = release.assets[0];
var downloadCount = 0;
for (var i = 0; i < release.assets.length; i++) {
downloadCount += release.assets[i].download_count;
}
var oneHour = 60 * 60 * 1000;
var oneDay = 24 * oneHour;
var dateDiff = new Date() - new Date(asset.updated_at);
var timeAgo;
if (dateDiff < oneDay)
{
timeAgo = (dateDiff / oneHour).toFixed(1) + " hours ago";
}
else
{
timeAgo = (dateDiff / oneDay).toFixed(1) + " days ago";
}
var releaseInfo = release.name + " was updated " + timeAgo + " and downloaded " + downloadCount.toLocaleString() + " times.";
$(".sharex-download").attr("href", asset.browser_download_url);
$(".release-info").text(releaseInfo);
$(".release-info").fadeIn("slow");
});
}

```

__TODO__: Iterate through all AppImages that may be in the latest release and return the download link for the one matching the architecture the browser is running.

Help from JavaScript wizards highly appreciated.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.