Refactor: Doku-konformes Plugin-Format (DOCTYPE Entities, Method=update, .page-WebUI)
This commit is contained in:
1 parent
2c78574aa6
commit
3de8cb055a
2 files changed
+115
-86
No files matched your search
@@ -1,9 +1,14 @@
|
||||
---
|
||||
Menu="OtherSettings"
|
||||
Type="xmenu"
|
||||
Title="MUA"
|
||||
Icon="cubes"
|
||||
---
|
||||
<?php
|
||||
/**
|
||||
* MUA - Mikes Unraid Agent
|
||||
* WebGUI-Tab (plugin.php)
|
||||
* Wird vom Unraid-WebGUI geladen, wenn der Tab "Settings/MUA" geöffnet wird.
|
||||
* Zeigt Status, Endpunkt und Health-Check.
|
||||
* WebGUI-Tab (mua.page)
|
||||
* Unraid-Standard .page-Format
|
||||
*/
|
||||
|
||||
$plugin_dir = '/usr/local/emhttp/plugins/mua';
|
||||
@@ -23,6 +28,7 @@ if (file_exists($pidfile)) {
|
||||
|
||||
// Health-Check
|
||||
$health = null;
|
||||
$health_code = 0;
|
||||
$ch = curl_init('http://127.0.0.1:' . $port . '/health');
|
||||
curl_setopt_array($ch, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
@@ -34,53 +40,34 @@ $health_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
$health_ok = ($health_code === 200);
|
||||
|
||||
// PHP-Version
|
||||
$php_version = PHP_VERSION;
|
||||
|
||||
// Tool-Anzahl (aus tools.php)
|
||||
$tool_count = 21;
|
||||
|
||||
// Host-IP
|
||||
$host_ip = $_SERVER['SERVER_ADDR'] ?? '127.0.0.1';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>MUA - Mikes Unraid Agent</title>
|
||||
<style>
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; margin: 20px; color: #333; }
|
||||
h1 { font-size: 1.5em; border-bottom: 2px solid #4a90d9; padding-bottom: 8px; }
|
||||
.status { padding: 12px 16px; border-radius: 6px; margin: 12px 0; font-size: 0.95em; }
|
||||
.status.ok { background: #e8f5e9; border: 1px solid #4caf50; color: #2e7d32; }
|
||||
.status.err { background: #ffebee; border: 1px solid #f44336; color: #c62828; }
|
||||
.status.warn { background: #fff3e0; border: 1px solid #ff9800; color: #e65100; }
|
||||
table { border-collapse: collapse; margin: 12px 0; }
|
||||
td, th { padding: 8px 12px; border: 1px solid #ddd; text-align: left; }
|
||||
th { background: #f5f5f5; font-weight: 600; }
|
||||
code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
|
||||
.endpoint { font-size: 1.1em; color: #4a90d9; font-weight: 600; }
|
||||
.mua-status { padding: 12px 16px; border-radius: 6px; margin: 12px 0; font-size: 0.95em; }
|
||||
.mua-status.ok { background: #e8f5e9; border: 1px solid #4caf50; color: #2e7d32; }
|
||||
.mua-status.err { background: #ffebee; border: 1px solid #f44336; color: #c62828; }
|
||||
.mua-status.warn { background: #fff3e0; border: 1px solid #ff9800; color: #e65100; }
|
||||
.mua-endpoint { font-size: 1.1em; color: #4a90d9; font-weight: 600; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>MUA - Mikes Unraid Agent</h1>
|
||||
|
||||
<?php if ($running): ?>
|
||||
<div class="status ok">✅ <strong>MCP-Server läuft</strong> (PID <?= $pid ?>, Port <?= $port ?>)</div>
|
||||
<div class="mua-status ok">✅ <strong>MCP-Server läuft</strong> (PID <?= $pid ?>, Port <?= $port ?>)</div>
|
||||
<?php else: ?>
|
||||
<div class="status err">❌ <strong>MCP-Server läuft nicht</strong> — starte mit <code>/etc/rc.d/rc.mua start</code></div>
|
||||
<div class="mua-status err">❌ <strong>MCP-Server läuft nicht</strong> — starte mit <code>/etc/rc.d/rc.mua start</code></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($health_ok): ?>
|
||||
<div class="status ok">✅ Health-Check: OK</div>
|
||||
<div class="mua-status ok">✅ Health-Check: OK</div>
|
||||
<?php elseif ($health !== false): ?>
|
||||
<div class="status warn">⚠️ Health-Check: HTTP <?= $health_code ?></div>
|
||||
<div class="mua-status warn">⚠️ Health-Check: HTTP <?= $health_code ?></div>
|
||||
<?php else: ?>
|
||||
<div class="status warn">⚠️ Health-Check: nicht erreichbar</div>
|
||||
<div class="mua-status warn">⚠️ Health-Check: nicht erreichbar</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>MCP-Endpunkt</h2>
|
||||
<p class="endpoint"><?= $endpoint ?></p>
|
||||
<p class="mua-endpoint"><?= $endpoint ?></p>
|
||||
<p>Transport: <code>Streamable HTTP</code> (POST-only) · JSON-RPC 2.0</p>
|
||||
|
||||
<h2>Details</h2>
|
||||
@@ -112,6 +99,3 @@ code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 0.9
|
||||
<tr><td>Netzwerk (6)</td><td>inventory, list, inspect, host_state, audit_tcp, lan_probe</td></tr>
|
||||
<tr><td>System (1)</td><td>connection_test</td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user