AppImage / AppImage/appimage.github.io

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

Aperta
#61 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement help wanted
Lingua principale
Shell
Stelle
374
Fork
769
Merge medio
4g 10h
PR unite (30g)
8

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.