Files
html/api/ambre-scan-230b.php
2026-04-22 03:35:02 +02:00

52 lines
1.9 KiB
PHP

<?php
header("Content-Type: application/json");
$out = [];
chdir("/var/www/html");
$out["recent_tags"] = array_filter(array_map("trim", explode("\n", @shell_exec("git tag -l 'wave-*' --sort=-creatordate 2>&1 | head -5"))));
$out["latest_commit"] = trim(@shell_exec("git log -1 --oneline 2>&1"));
// Check my wave-229 tools + wave-230 state
$reg = @file_get_contents("/var/www/html/api/wevia-tool-registry.json");
$data = @json_decode($reg, true);
if ($data) {
$out["wave_229_tools"] = array_map(function($t){return $t["id"];},
array_filter($data["tools"] ?? [], function($t){return ($t["wave"] ?? 0) == 229;}));
$out["total_tools"] = count($data["tools"] ?? []);
}
// Ethica state
$ethica = [];
$ethica["ecm_py_exists"] = file_exists("/var/www/html/ethica/ecm.py") || file_exists("/opt/ethica/ecm.py") || file_exists("/var/www/weval/ecm.py");
$ethica["find_ecm"] = trim(@shell_exec("find /var/www /opt -name 'ecm.py' 2>/dev/null | head -5"));
$ethica["consent_urls"] = [
"consent.wevup.app" => @shell_exec("curl -sI --max-time 3 https://consent.wevup.app/ 2>&1 | head -1"),
];
$out["ethica"] = $ethica;
// Mermaid V10 state in wevia.html
$w = @file_get_contents("/var/www/html/wevia.html");
$out["wevia"] = [
"size" => strlen($w),
"v10_mermaid" => strpos($w, "AMBRE-V10-MERMAID") !== false,
"v10_css_minheight" => strpos($w, "min-height:200px") !== false,
];
// Check i18n helpers in wevia.html
$out["i18n"] = [
"detectLang" => strpos($w, "function detectLang") !== false,
"lang_var" => strpos($w, "var lang =") !== false,
];
// Mermaid KB state
$mkb = @file_get_contents("/var/www/html/generated/mermaid-learn-kb.json");
if ($mkb) {
$kb_data = @json_decode($mkb, true);
$out["mermaid_kb_entries"] = count($kb_data ?: []);
}
// Load current
$out["load"] = trim(shell_exec("uptime"));
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);