diff --git a/.gitignore b/.gitignore index 30ecb68..a1ab293 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ vendor/ *.sqlite-shm *.sqlite-wal +ota/ diff --git a/api/mqtt.php b/api/mqtt.php index f75f5e1..227b88a 100644 --- a/api/mqtt.php +++ b/api/mqtt.php @@ -2,8 +2,10 @@ declare(strict_types=1); function mqtt_publish(string $topic, string $msg): void { + // broker Proxmox (CT106) por TLS; 127.0.0.1:1883 era de um mosquitto + // local que já não existe (corrigido 2026-07-16) $cmd = sprintf( - 'mosquitto_pub -h 127.0.0.1 -p 1883 -t %s -m %s', + 'mosquitto_pub -h mqtt.xupas.mywire.org -p 8883 --capath /etc/ssl/certs -u xupa -P xupa -t %s -m %s', escapeshellarg($topic), escapeshellarg($msg) ); diff --git a/esp_proxmox.php b/esp_proxmox.php index e1ac479..722d868 100644 --- a/esp_proxmox.php +++ b/esp_proxmox.php @@ -66,17 +66,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { [PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]); if ($action === 'approve') { $pdo->prepare("UPDATE contadores SET blocked=0 WHERE uid=?")->execute([$uid]); - // sincronizar na VPS - $vps = ['http'=>['method'=>'POST','header'=>'Content-Type: application/x-www-form-urlencoded', - 'content'=>http_build_query(['action'=>'approve','uid'=>$uid]),'timeout'=>4]]; - @file_get_contents('https://web.xpto.ooguy.com/esp_api.php?key=esp_api_xupas_2025', false, stream_context_create($vps)); $msg = "[$uid] aprovado OK"; $msgOk = true; } elseif ($action === 'block') { $pdo->prepare("UPDATE contadores SET blocked=1,online=0 WHERE uid=?")->execute([$uid]); - // sincronizar na VPS - $vps = ['http'=>['method'=>'POST','header'=>'Content-Type: application/x-www-form-urlencoded', - 'content'=>http_build_query(['action'=>'block','uid'=>$uid]),'timeout'=>4]]; - @file_get_contents('https://web.xpto.ooguy.com/esp_api.php?key=esp_api_xupas_2025', false, stream_context_create($vps)); $msg = "[$uid] bloqueado OK"; $msgOk = true; } elseif ($action === 'delete') { // CT106 api.py: envia DELETE_CERT via MQTT + apaga CT106 SQLite + apaga VPS SQLite @@ -111,7 +103,6 @@ ob_start();