Files
html/api/ambre-widget-trace.php
2026-04-22 10:50:03 +02:00

54 lines
1.6 KiB
PHP

<?php
header("Content-Type: application/json");
$root = @file_get_contents("/var/www/html/index.html");
// Find all widgets + iframes + the chatbot/claude-pattern widget
$out = [];
// Search for specific widget signatures in index.html
$sigs = [
"claude-pattern",
"Claude Pattern",
"WTP",
"IA Hub",
"Master",
"Droid",
"Arena",
"WEVIA Engine",
"WevCode",
"widget.js",
"chat-widget",
"Ouvrir en plein ecran",
"weval-chat-fix",
"wevia-widget",
"chat-fix",
];
foreach ($sigs as $s) {
$out["match_$s"] = substr_count($root, $s);
}
$out["root_size"] = strlen($root);
// All <script src>
preg_match_all('/<script[^>]*src=["\']([^"\']+)["\']/', $root, $m);
$out["scripts"] = array_unique($m[1] ?? []);
// Check weval-chat-fix.js content
$cf = @file_get_contents("/var/www/html/weval-chat-fix.js");
if ($cf) {
$out["chat_fix_size"] = strlen($cf);
$out["chat_fix_has_wtp"] = substr_count($cf, "WTP");
$out["chat_fix_has_claude_pattern"] = substr_count($cf, "Claude Pattern");
$out["chat_fix_has_Master"] = substr_count($cf, "Master") + substr_count($cf, "IA Hub");
$out["chat_fix_head_200"] = substr($cf, 0, 400);
}
// Also check wevia-widget
$ww = @file_get_contents("/var/www/html/wevia-widget.html");
if ($ww) {
$out["wevia_widget_size"] = strlen($ww);
$out["wevia_widget_has_dock"] = substr_count($ww, "WTP") + substr_count($ww, "Master") + substr_count($ww, "Droid");
$out["wevia_widget_has_claude_pattern"] = substr_count($ww, "Claude Pattern");
}
echo json_encode($out, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);