This commit is contained in:
2026-07-19 18:27:27 +08:00
parent fe4b286ce1
commit 0febcf69f4
170 changed files with 19490 additions and 11878 deletions
+6 -31
View File
@@ -1,30 +1,5 @@
<?php
/**
* System info partial — hostname, kernel, platform, CPU load/temp, service
* status grid (MMDVMHost / DStarRepeater / ircDDBGateway / TimeServer /
* PiStar-Watchdog / PiStar-Remote).
*
* Loaded inline by /index.php on the admin path and AJAX-refreshed every
* 15 seconds via $("#sysInfo").load(...). Used in BOTH MMDVMHost and
* DStarRepeater modes (same partial, gated by /index.php).
*
* Served two ways from /index.php: an inline `include` for the initial
* page render, then AJAX `$("#sysInfo").load(...)` for refreshes. On
* the inline path the parent has already emitted full security headers
* (and the headers_sent() guard inside makes our call idempotent); on
* the AJAX path the response is XHR — X-Frame-Options / frame-ancestors
* apply to iframe ancestry, not XHR, so the embeddable variant is the
* correct choice in both directions.
*
* Reads /etc/ircddbgateway (flat key=value via the hand-rolled parser)
* to surface the gateway callsign in the hardware-info table.
*/
require_once($_SERVER['DOCUMENT_ROOT'] . '/config/security_headers.php');
setEmbeddableSecurityHeaders();
include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
<?php include_once $_SERVER['DOCUMENT_ROOT'].'/config/ircddblocal.php';
include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code
include_once $_SERVER['DOCUMENT_ROOT'].'/mmdvmhost/tools.php';
$configs = array();
@@ -43,7 +18,7 @@ $MYCALL=strtoupper($callsign);
?>
<?php
$cpuLoad = sys_getloadavg();
$cpuTempCRaw = exec('cat /sys/class/thermal/thermal_zone0/temp');
$cpuTempCRaw = floatval(exec('cat /sys/class/thermal/thermal_zone0/temp'));
if ($cpuTempCRaw > 1000) { $cpuTempC = round($cpuTempCRaw / 1000, 1); } else { $cpuTempC = round($cpuTempCRaw, 1); }
$cpuTempF = round(+$cpuTempC * 9 / 5 + 32, 1);
if ($cpuTempC < 50) { $cpuTempHTML = "<td style=\"background: #1d1\">".$cpuTempC."&deg;C / ".$cpuTempF."&deg;F</td>\n"; }
@@ -60,9 +35,9 @@ if ($cpuTempC >= 69) { $cpuTempHTML = "<td style=\"background: #f00\">".$cpuTemp
<th><a class="tooltip" href="#"><?php echo $lang['cpu_temp'];?><span><b>CPU Temp</b></span></a></th>
</tr>
<tr>
<td><?php $h = php_uname('n'); if (strlen($h) >= 16) { $h = substr($h, 0, 14) . '..'; } echo htmlspecialchars((string)$h, ENT_QUOTES, 'UTF-8'); ?></td>
<td><?php echo htmlspecialchars((string)php_uname('r'), ENT_QUOTES, 'UTF-8');?></td>
<td colspan="2"><?php echo htmlspecialchars((string)exec('/usr/local/bin/platformDetect.sh'), ENT_QUOTES, 'UTF-8');?></td>
<td><?php if (strlen(php_uname('n')) >= 16) { echo substr(php_uname('n'), 0, 14) . '..'; } else { echo php_uname('n'); } ?></td>
<td><?php echo php_uname('r');?></td>
<td colspan="2"><?php echo exec('/usr/local/bin/platformDetect.sh');?></td>
<td><?php echo number_format($cpuLoad[0],2);?> / <?php echo number_format($cpuLoad[1],2);?> / <?php echo number_format($cpuLoad[2],2);?></td>
<?php echo $cpuTempHTML; ?>
</tr>