Added RCON Response box

This commit is contained in:
Shobhit Pathak 2023-10-11 23:34:51 +05:30
parent 41c0a69add
commit 50a7c545a8
2 changed files with 15 additions and 1 deletions

View File

@ -107,7 +107,17 @@ $(document).ready(function () {
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
console.log(data.message) console.log(data.message)
if(apiEndpoint == '/api/rcon') {
if (data.message.includes("Response received")) {
$('#rconResultBox').show();
$('#rconResultText').text(data.message.split("Command sent! Response received:")[1]);
} else {
$('#rconResultBox').hide();
alert(data.message); alert(data.message);
}
} else {
alert(data.message);
}
} else if (response.status == 401) { } else if (response.status == 401) {
alert('Unauthorized, please reload and relogin.'); alert('Unauthorized, please reload and relogin.');
} }

View File

@ -263,6 +263,10 @@
</svg> </svg>
</button> </button>
</div> </div>
<div id="rconResultBox" class="alert alert-primary" style="display: none;">
<strong>RCON Response:</strong>
<p id="rconResultText"></p>
</div>
</div> </div>
</div> </div>