mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-25 01:46:21 +03:00
Added download of a new version .msi
This commit is contained in:
parent
2b3b95d697
commit
ffaeb8b8ec
2 changed files with 59 additions and 2 deletions
30
web/static/scripts/update.js
Normal file
30
web/static/scripts/update.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
$.ajax({
|
||||||
|
url: "http://localhost:8080/api/get/version",
|
||||||
|
type: "GET",
|
||||||
|
success: function(version) {
|
||||||
|
$.ajax({
|
||||||
|
url: "https://api.github.com/repos/Redume/EveryNasa/tags",
|
||||||
|
type: "GET",
|
||||||
|
success: function(data) {
|
||||||
|
if (version.message !== data[0].name) {
|
||||||
|
let div = document.createElement("div");
|
||||||
|
div.id = "update";
|
||||||
|
div.innerHTML = `
|
||||||
|
<p id="update-title">A new update is available</p>
|
||||||
|
<p id="update-desc">You can download the new version of the program.</p>
|
||||||
|
<button id="update-button" class="btn btn-primary">Download</button>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(div);
|
||||||
|
let updateButton = document.querySelector("#update-button");
|
||||||
|
updateButton.addEventListener("click", function() {
|
||||||
|
window.location.href = `https://github.com/Redume/EveryNasa/releases/download/${data[0].name}/EveryNasa.msi`;
|
||||||
|
$(".toast-body").text("Downloading the update...");
|
||||||
|
let toastLiveExample = document.getElementById('liveToast');
|
||||||
|
let toast = new bootstrap.Toast(toastLiveExample);
|
||||||
|
toast.show();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
|
@ -11,11 +11,38 @@
|
||||||
margin-top: -0.7em;
|
margin-top: -0.7em;
|
||||||
}
|
}
|
||||||
|
|
||||||
p, .form-check {
|
.settings {
|
||||||
|
margin-top: 2.4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings p, .form-check {
|
||||||
margin-left: -12em;
|
margin-left: -12em;
|
||||||
margin-top: -0.8em;
|
margin-top: -0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#update-desc {
|
|
||||||
margin-top: -0.8rem;
|
#update {
|
||||||
|
display: inline-block;
|
||||||
|
width: 25%;
|
||||||
|
height: 6.7em;
|
||||||
|
margin-left: 2em;
|
||||||
|
margin-top: 1em;
|
||||||
|
background-color: #2f3041;
|
||||||
|
border-radius: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#update-title, #update-desc, #update-button {
|
||||||
|
margin-left: 0.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#update-desc {
|
||||||
|
margin-top: -0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#update-button {
|
||||||
|
margin-top: -0.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#update-title {
|
||||||
|
margin-top: 0.3em;
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue