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:
parent
1d0d1d8dea
commit
6379f788d8
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@
|
|||||||
vendor/
|
vendor/
|
||||||
*.sqlite-shm
|
*.sqlite-shm
|
||||||
*.sqlite-wal
|
*.sqlite-wal
|
||||||
|
ota/
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
function mqtt_publish(string $topic, string $msg): void {
|
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(
|
$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($topic),
|
||||||
escapeshellarg($msg)
|
escapeshellarg($msg)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -66,17 +66,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);
|
[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);
|
||||||
if ($action === 'approve') {
|
if ($action === 'approve') {
|
||||||
$pdo->prepare("UPDATE contadores SET blocked=0 WHERE uid=?")->execute([$uid]);
|
$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;
|
$msg = "[$uid] aprovado OK"; $msgOk = true;
|
||||||
} elseif ($action === 'block') {
|
} elseif ($action === 'block') {
|
||||||
$pdo->prepare("UPDATE contadores SET blocked=1,online=0 WHERE uid=?")->execute([$uid]);
|
$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;
|
$msg = "[$uid] bloqueado OK"; $msgOk = true;
|
||||||
} elseif ($action === 'delete') {
|
} elseif ($action === 'delete') {
|
||||||
// CT106 api.py: envia DELETE_CERT via MQTT + apaga CT106 SQLite + apaga VPS SQLite
|
// 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>
|
<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>
|
<h1>ESP Devices <span style="color:var(--muted);font-weight:400;font-size:16px">Proxmox broker</span></h1>
|
||||||
</div>
|
</div>
|
||||||
<a href="/esp_vps.php" class="btn btn-secondary">← Ver VPS</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($msg): ?>
|
<?php if ($msg): ?>
|
||||||
@ -205,10 +196,8 @@ ob_start();
|
|||||||
<button class="btn btn-danger btn-sm" data-uid="<?= h($uid) ?>" data-act="delete">✕</button>
|
<button class="btn btn-danger btn-sm" data-uid="<?= h($uid) ?>" data-act="delete">✕</button>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align:center">
|
<td style="text-align:center">
|
||||||
<span title="VPS" data-uid="<?= h($uid) ?>" data-act="switch_pair" data-pair="0"
|
<span title="Proxmox"
|
||||||
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>
|
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>
|
||||||
<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>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach;?>
|
<?php endforeach;?>
|
||||||
|
|||||||
@ -25,11 +25,6 @@ ob_start();
|
|||||||
<div class="dash-label">OTA</div>
|
<div class="dash-label">OTA</div>
|
||||||
<div class="dash-desc">Firmware updates</div>
|
<div class="dash-desc">Firmware updates</div>
|
||||||
</a>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user