mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-30 23:03:03 -07:00
DOCS+FE+BE: cleaner versioning retrieval, ICMP, plugin debug docs
Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="chart">
|
||||
<script src="lib/chart.js/Chart.js?v=<?php include 'php/templates/version.php'; ?>"></script>
|
||||
<script src="lib/chart.js/Chart.js"></script>
|
||||
<!-- presence chart -->
|
||||
<?php
|
||||
require 'php/components/graph_online_history.php';
|
||||
|
||||
@@ -128,14 +128,31 @@ class NetAlertXStateManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle state update from SSE
|
||||
* Handle state update from SSE or Polling
|
||||
*/
|
||||
handleStateUpdate(appState) {
|
||||
try {
|
||||
if (document.getElementById("state")) {
|
||||
const cleanState = appState["currentState"].replaceAll('"', "");
|
||||
document.getElementById("state").innerHTML = cleanState;
|
||||
// 1. Update the main status text
|
||||
if (appState["currentState"]) {
|
||||
const cleanState = appState["currentState"].replace(/"/g, "");
|
||||
$("#state").html(cleanState);
|
||||
}
|
||||
|
||||
// 2. Update Version placeholders
|
||||
const version = appState["appVersion"] || "UNKNOWN";
|
||||
$('[data-plc="version"]')
|
||||
.html(version)
|
||||
.attr('data-version', version);
|
||||
|
||||
// 3. Update Build Timestamp placeholders
|
||||
const buildTime = appState["buildTimestamp"] !== undefined ? appState["buildTimestamp"] : "";
|
||||
const displayTime = (buildTime === 0) ? "UNKNOWN" : buildTime;
|
||||
|
||||
$('[data-plc="build-timestamp"]')
|
||||
.html(displayTime)
|
||||
.attr('data-build-time', buildTime);
|
||||
|
||||
console.log("[NetAlertX State] UI updated via jQuery");
|
||||
} catch (e) {
|
||||
console.error("[NetAlertX State] Failed to update state display:", e);
|
||||
}
|
||||
|
||||
@@ -66,21 +66,24 @@ $db->close();
|
||||
<a href="https://docs.netalertx.com/VERSIONS" target="_blank"> <span><i class="fa fa-circle-question"></i></a></span>
|
||||
</div>
|
||||
<div class="db_info_table_cell">
|
||||
<div class="version" id="version" data-build-time="<?php echo file_get_contents( "buildtimestamp.txt");?>">
|
||||
<?php echo '<span id="new-version-text" class="myhidden"><i class="fa-solid fa-rocket fa-beat"></i> ' .lang('Maintenance_new_version').'</span>'.'<span id="current-version-text" class="myhidden">' .lang('Maintenance_current_version').'</span>';?>
|
||||
<div class="version" id="version" data-build-time="">
|
||||
<span id="new-version-text" class="myhidden"><i class="fa-solid fa-rocket fa-beat"></i>
|
||||
<?php echo lang('Maintenance_new_version');?> </span> <span id="current-version-text" class="myhidden">
|
||||
<?php echo lang('Maintenance_current_version') ;?> </span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_built_on');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php echo date("Y-m-d", ((int)file_get_contents( "buildtimestamp.txt")));?>
|
||||
<span data-plc="build-timestamp"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
<div class="db_info_table_cell" style="min-width: 140px"><?= lang('Maintenance_Running_Version');?></div>
|
||||
<div class="db_info_table_cell">
|
||||
<?php include 'php/templates/version.php'; ?>
|
||||
<span data-plc="version"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="db_info_table_row">
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
#---------------------------------------------------------------------------------#
|
||||
# NetAlertX #
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector #
|
||||
# #
|
||||
# build.php - Templates module Template to display the current build version #
|
||||
#---------------------------------------------------------------------------------#
|
||||
# Puche 2021 pi.alert.application@gmail.com GNU GPLv3 #
|
||||
# jokob-sk 2022 jokob.sk@gmail.com GNU GPLv3 #
|
||||
# leiweibau 2022 https://github.com/leiweibau GNU GPLv3 #
|
||||
# cvc90 2023 https://github.com/cvc90 GNU GPLv3 #
|
||||
#---------------------------------------------------------------------------------#
|
||||
|
||||
$file = "/app/front/buildtimestamp.txt";
|
||||
if (file_exists($file)) {
|
||||
echo date("Y-m-d", ((int)file_get_contents($file)));
|
||||
}
|
||||
else {
|
||||
echo "File not found";
|
||||
}
|
||||
?>
|
||||
@@ -32,8 +32,8 @@
|
||||
| <a href="https://docs.netalertx.com/" class="pointer" target="_blank" title="Documentation"><i class="fa fa-book"></i></a>
|
||||
| <a href="https://github.com/jokob-sk/NetAlertX/issues" class="pointer" target="_blank"><i class="fa fa-bug" title="Report a bug"></i></a>
|
||||
| <a href="https://discord.com/invite/NczTUTWyRr" class="pointer" target="_blank"><i class="fa-brands fa-discord" title="Join Discord"></i></a>
|
||||
| <?= lang('Maintenance_built_on');?>: <?php include 'php/templates/build.php'; ?>
|
||||
| Version: <?php include 'php/templates/version.php'; ?>
|
||||
| <?= lang('Maintenance_built_on');?>: <span data-plc="build-timestamp"></span>
|
||||
| Version: <span data-plc="version"></span>
|
||||
|
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user