Skip to content

Commit

Permalink
Update admin.ejs
Browse files Browse the repository at this point in the history
  • Loading branch information
achul123 authored Jan 14, 2024
1 parent f20e7e6 commit 562ec0a
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions themes/default/admin.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,23 @@
</div>
</div>
</div>
<script>
fetch("https://ovrxglobal.github.io/versionapi/")
.then(res => Promise.resolve(res.json()).then(ver => {
let currentver = "<%= settings.version.replace(/"/g, `\\\\"`) %>";
if (ver.version == currentver) {
document.getElementById("latestversion").innerHTML = `<span>You are running Heliactyl version <code style="color: #007fcc" >v${currentver}</code>. Heliactyl is up-to-date!</span>`;
} else if (ver.prerelease == currentver) {
document.getElementById("latestversion").innerHTML = `<span>You are running Heliactyl version <code style="color: #007fcc">v${currentver}</code>. Heliactyl is up-to-date!</span>`;
} else {
document.getElementById("latestversion").innerHTML = `<span>Heliactyl is <b>not up-to-date!</b> The latest version is <code style="color: #007fcc" >v${ver.version}</code> and you are currently running version <code style="color: #007fcc" >v<%= settings.version %></code>.</span>`;
};
}));
</script>
<script>
fetch("https://api.github.com/repos/OvernodeProjets/Heliactyl-fixed/releases/latest")
.then(response => response.json())
.then(data => {
let latestVersion = data.tag_name.replace('v', '');
let currentVersion = "<%= settings.version.replace(/\"/g, '\\\\\"') %>";
if (latestVersion === currentVersion) {
document.getElementById("latestversion").innerHTML = `<span>You are running Heliactyl version <code style="color: #007fcc">v${currentVersion}</code>. Heliactyl is up-to-date!</span>`;
} else {
document.getElementById("latestversion").innerHTML = `<span>Heliactyl is <b>not up-to-date!</b> The latest version is <code style="color: #007fcc">v${latestVersion}</code> and you are currently running version <code style="color: #007fcc">v${currentVersion}</code>.</span>`;
}
})
.catch(error => {
console.error("Error fetching GitHub API:", error);
document.getElementById("latestversion").innerHTML = "<span>Error checking for updates.</span>";
});
</script>
<div class="row">
<div class="col-md-12 grid-margin stretch-card">
<div class="card">
Expand Down

0 comments on commit 562ec0a

Please sign in to comment.