34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
// WEVIA EXEC INTERCEPT v6 — auto-execute on require_once
|
|
// Reads php://input ONCE, saves to global, detects action verbs, executes or passes through
|
|
$GLOBALS['_wevia_raw'] = file_get_contents('php://input');
|
|
$_wi = json_decode($GLOBALS['_wevia_raw'], true);
|
|
$_wm = strtolower(trim($_wi['message'] ?? $_wi['prompt'] ?? $_GET['m'] ?? ''));
|
|
|
|
if ($_wm && preg_match('/^(lance|auto.?fix|nettoie|consolide|vacuum|securise|monte|git push|restart|test fonc|lance ux|scan oss|\/bash)/i', $_wm)) {
|
|
// ACTION detected — route to exec engine
|
|
$ch = curl_init();
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_URL => 'https://127.0.0.1/api/wevia-exec.php?m=' . urlencode($_wm),
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_SSL_VERIFYPEER => false,
|
|
CURLOPT_SSL_VERIFYHOST => 0,
|
|
CURLOPT_HTTPHEADER => ['Host: weval-consulting.com'],
|
|
CURLOPT_TIMEOUT => 25
|
|
]);
|
|
$r = curl_exec($ch);
|
|
curl_close($ch);
|
|
$d = json_decode($r, true);
|
|
if ($d && isset($d['response'])) {
|
|
header('Content-Type: application/json');
|
|
die(json_encode([
|
|
'success' => true,
|
|
'response' => $d['response'],
|
|
'provider' => 'wevia-exec',
|
|
'action' => 'executed',
|
|
'functions_loaded' => 12
|
|
]));
|
|
}
|
|
}
|
|
// NOT an action — pass through to chatbot (it will re-read from global)
|