Files
html/api/ambre-v10-fix.php
opus d1e4930ef9
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
auto-sync-0325
2026-04-22 03:25:02 +02:00

28 lines
972 B
PHP

<?php
header("Content-Type: application/json");
$path = "/var/www/html/wevia.html";
$c = @file_get_contents($path);
$orig = strlen($c);
// Replace the V10 addMsg call with direct innerHTML injection
$old = 'addMsg("assistant", badges + inlineBlock, (data.elapsed_ms/1000).toFixed(2));';
$new = '// Direct innerHTML injection (bypass formatMd HTML escape)
var _el = addMsg("assistant", "Diagramme Mermaid", (data.elapsed_ms/1000).toFixed(2));
var _bubble = _el ? _el.querySelector(".bubble") : null;
if (_bubble) _bubble.innerHTML = badges + inlineBlock;';
if (strpos($c, $old) === false) {
echo json_encode(["error"=>"pattern not found in V10"]);
exit;
}
$new_c = str_replace($old, $new, $c);
$backup = "/opt/wevads/vault/wevia.html.GOLD-" . date("Ymd-His") . "-v10-fix";
@copy($path, $backup);
$wrote = @file_put_contents($path, $new_c);
echo json_encode([
"delta" => strlen($new_c) - $orig,
"wrote" => $wrote,
]);