feat(compat): sweep of components against the real core with strict diagnostics

This commit is contained in:
kj
2026-10-05 17:36:08 -03:00
parent 1127272330
commit 0b98b7a26b
19 changed files with 740 additions and 1 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
// Router de compatibilidad del paquete http: curlRequest con flujo completo
// (se llama a si mismo via el mismo servidor) y carga nivel 1 de los clientes
// con servicio externo.
use Libs\Aria2;
use Libs\CompreFace;
use Libs\CurlRequest;
use Libs\Proxy;
use Libs\Router;
Router::get('/compat/http/echo', function () {
echo 'ECHO:' . ($_GET['who'] ?? 'nadie');
});
Router::get('/compat/http/curl', function () {
$host = $_SERVER['HTTP_HOST'];
$req = new CurlRequest();
$req->get("http://$host/compat/http/echo?who=42");
echo str_contains($req->body(), 'ECHO:42') ? 'CURL_OK' : 'CURL_FAIL:' . substr($req->body(), 0, 80);
});
Router::get('/compat/http/load', function () {
$class = 'Libs\\' . basename((string) ($_GET['class'] ?? ''));
if (!class_exists($class)) {
echo 'LOAD_MISSING';
return;
}
$instance = match ($class) {
'Libs\\Aria2' => new Aria2('http://127.0.0.1:6800/jsonrpc'),
'Libs\\CompreFace' => new CompreFace('compat-key', 'http://127.0.0.1:18080'),
default => new $class(),
};
echo 'LOAD_OK:' . get_class($instance);
});