esp: remover VPS Alemanha das paginas + fix mqtt.php

- esp_proxmox.php: fora os botoes switch V/P (fica indicador P
  read-only), o link "Ver VPS" e os syncs p/ web.xpto em approve/block
  (brokers ESP da Alemanha foram desativados; frota so no Proxmox)
- painel.php: remove cartao "ESP VPS"
- api/mqtt.php: publicava p/ 127.0.0.1:1883 que nao existe -- passa a
  publicar por TLS no broker CT106 (mqtt.xupas.mywire.org:8883); a
  pagina OTA volta a funcionar
- .gitignore: ota/ (binarios fw + manifest, como no repo da VPS)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
deploy 2026-07-17 00:10:43 +01:00
parent 1d0d1d8dea
commit 6379f788d8
4 changed files with 6 additions and 19 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
vendor/
*.sqlite-shm
*.sqlite-wal
ota/

View File

@ -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)
);

View File

@ -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();
<div class="breadcrumb"><a href="/painel.php">Painel</a><span class="sep"></span>ESP Devices<span class="sep"></span>Proxmox</div>
<h1>ESP Devices <span style="color:var(--muted);font-weight:400;font-size:16px">Proxmox broker</span></h1>
</div>
<a href="/esp_vps.php" class="btn btn-secondary"> Ver VPS</a>
</div>
<?php if ($msg): ?>
@ -205,10 +196,8 @@ ob_start();
<button class="btn btn-danger btn-sm" data-uid="<?= h($uid) ?>" data-act="delete"></button>
</td>
<td style="text-align:center">
<span title="VPS" data-uid="<?= h($uid) ?>" data-act="switch_pair" data-pair="0"
style="cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;font-size:9px;font-weight:700;margin:0 3px;background:<?= $isVps?'#3fb950':'#333' ?>;color:<?= $isVps?'#0d1117':'#666' ?>;<?= $isVps?'box-shadow:0 0 5px #3fb950;':'' ?>">V</span>
<span title="Proxmox" data-uid="<?= h($uid) ?>" data-act="switch_pair" data-pair="1"
style="cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;font-size:9px;font-weight:700;margin:0 3px;background:<?= $isPmx?'#3fb950':'#333' ?>;color:<?= $isPmx?'#0d1117':'#666' ?>;<?= $isPmx?'box-shadow:0 0 5px #3fb950;':'' ?>">P</span>
<span title="Proxmox"
style="display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;font-size:9px;font-weight:700;margin:0 3px;background:<?= $isPmx?'#3fb950':'#333' ?>;color:<?= $isPmx?'#0d1117':'#666' ?>;<?= $isPmx?'box-shadow:0 0 5px #3fb950;':'' ?>">P</span>
</td>
</tr>
<?php endforeach;?>

View File

@ -25,11 +25,6 @@ ob_start();
<div class="dash-label">OTA</div>
<div class="dash-desc">Firmware updates</div>
</a>
<a href="/esp_vps.php" class="dash-card">
<div class="dash-ico">📡</div>
<div class="dash-label">ESP VPS</div>
<div class="dash-desc">Dispositivos VPS</div>
</a>
</div>
</div>