Made the update info more public

This commit is contained in:
Lukasdotcom
2022-01-03 17:03:25 -05:00
parent c152de1ae6
commit 059d1cebd4
2 changed files with 5 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ if (array_key_exists("uptime", $_GET)) { # Will return some status info for a se
} else {
missingPrivilege($USERNAME);
}
} elseif (array_key_exists("update", $_POST)) { // To delete an entry in log
} elseif (array_key_exists("update", $_POST)) { // To update the server
if ($PRIVILEGE["updateServer"]) {
unlink("../updateInfo.log");
echo "Updating.";
@@ -39,7 +39,6 @@ if (array_key_exists("uptime", $_GET)) { # Will return some status info for a se
echo file_get_contents("../updateInfo.log");
} else {
echo "No recent update";
http_response_code(404);
}
} else {
missingPrivilege($USERNAME);

View File

@@ -63,9 +63,7 @@ function updateUpdateInfo() { // Used to get the response to the update info.
ajax.onload = function() {
if (ajax.status == 200) {
$('#updateText').text(ajax.responseText)
} else {
updateUpdateInfo();
}
}
}
ajax.open("GET", `/api/server.php?update=true&key='${getCookie('user')}'`);
ajax.send();
@@ -75,10 +73,10 @@ function update() {
ajax.onload = function() {
if (ajax.status == 200) {
alert("Updating Server.")
alert("Updating Server.");
updateUpdateInfo();
} else {
alert("Error something went wrong.")
alert("Error something went wrong.");
}
}
ajax.open("POST", "/api/server.php");
@@ -138,6 +136,7 @@ $(document).ready(function() {
updateLog();
collapseCategories();
collapseCategories();
setInterval(updateUpdateInfo, 10000);
if (localStorage.log != undefined) {
$("#searchText").val(localStorage.logSearch)
}