Add jquery call to github API to determine the latest release

This makes sure, that the latest version is used for the downloads, even
if I forget to update the download links.
This commit is contained in:
0xboobface 2019-01-21 15:08:34 +01:00
parent 414d0abaff
commit 92b83b8411
1 changed files with 16 additions and 3 deletions

View File

@ -118,19 +118,19 @@
</script>
<div class="row text-center">
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-win64-jre.zip');">
<a id="download_windows" class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-win64-jre.zip');">
<i class="fa fa-windows mr-2"></i>
Download for Windows!
</a>
</div>
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-macos-jre.zip');">
<a id="download_macos" class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-macos-jre.zip');">
<i class="fa fa-apple mr-2"></i>
Download for macOS!
</a>
</div>
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-linux-jre.zip');">
<a id="download_linux" class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-linux-jre.zip');">
<i class="fa fa-linux mr-2"></i>
Download for Linux!
</a>
@ -620,6 +620,19 @@
<!-- Custom scripts for this template -->
<script src="js/freelancer.min.js"></script>
<script>
$.ajax({
type: 'GET',
url: 'https://api.github.com/repos/0xboobface/ctbrec/releases'
}).done(function( releases ) {
let latest = releases[0];
let version = latest.tag_name;
$('#download_windows').on('click', () => downloadFile('https://github.com/0xboobface/ctbrec/releases/download/'+version+'/ctbrec-'+version+'-win64-jre.zip'));
$('#download_macos').on('click', () => downloadFile('https://github.com/0xboobface/ctbrec/releases/download/'+version+'/ctbrec-'+version+'-macos-jre.zip'));
$('#download_linux').on('click', () => downloadFile('https://github.com/0xboobface/ctbrec/releases/download/'+version+'/ctbrec-'+version+'-linux-jre.zip'));
});
</script>
</body>
</html>