41 lines
1.6 KiB
PHP
41 lines
1.6 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
$out = [];
|
|
$dir = "/var/www/html/api";
|
|
|
|
// Find SSE / stream endpoints
|
|
$candidates = [];
|
|
foreach (glob("$dir/*stream*.php") as $f) $candidates[] = basename($f);
|
|
foreach (glob("$dir/*sse*.php") as $f) $candidates[] = basename($f);
|
|
foreach (glob("$dir/wevcode*.php") as $f) $candidates[] = basename($f);
|
|
foreach (glob("$dir/*plan-exec*.php") as $f) $candidates[] = basename($f);
|
|
foreach (glob("$dir/*autonomous*.php") as $f) $candidates[] = basename($f);
|
|
$out["streaming_endpoints"] = array_unique($candidates);
|
|
|
|
// Find wevia-master-api.php size + check if supports SSE
|
|
if (file_exists("$dir/wevia-master-api.php")) {
|
|
$content = @file_get_contents("$dir/wevia-master-api.php");
|
|
$out["master_api_size"] = strlen($content);
|
|
$out["has_sse_hint"] = strpos($content, "text/event-stream") !== false;
|
|
}
|
|
|
|
// Check existing wevia-autonomous/wevcode for SSE pattern
|
|
foreach (["wevia-autonomous.php", "wevcode.php", "wevcode-stream.php", "wevia-sse.php"] as $f) {
|
|
$p = "$dir/$f";
|
|
if (file_exists($p)) {
|
|
$c = @file_get_contents($p, false, null, 0, 2000);
|
|
$out["preview_$f"] = [
|
|
"size" => filesize($p),
|
|
"has_event_stream" => strpos($c, "text/event-stream") !== false,
|
|
"has_flush" => strpos($c, "ob_flush") !== false,
|
|
"first_200" => substr($c, 0, 200),
|
|
];
|
|
}
|
|
}
|
|
|
|
// Check existing React dashboards
|
|
$out["react_dashboards"] = array_map("basename", glob("$dir/../*react*.html") ?: []);
|
|
$out["dashboard_files"] = array_map("basename", array_slice(glob("$dir/../dashboard*.html"), 0, 10));
|
|
|
|
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|