import {JSONRPC} from "/assets/jrpc.js";
(async function () {
$("#panel").prepend(`
Checking for updates...
`);
let state = (await JSONRPC.__invoke("updates::check"));
if (state === null) {
$("#update-panel").html(`Error checking updates`);
} else if (state === false) {
$("#update-panel").html(`There is no updates`);
} else if (state === true) {
$("#update-panel").html(`Some updates are available `);
$("#update-panel button").click(async function () {
$("#panel").hide();
$("#loading").show().text("Installing updates...");
try {
alert(await JSONRPC.__invoke("updates::install"));
} finally {
setTimeout(() => location.reload(), 1000);
}
});
}
})();