MQTT page: expose broker host/port endpoint
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e74308f5e2
commit
384675b3c6
1 changed files with 7 additions and 0 deletions
|
|
@ -32,6 +32,13 @@ function parseTopics(raw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mqttClientRoutes(app) {
|
export async function mqttClientRoutes(app) {
|
||||||
|
// GET /settings/api/mqtt-broker — where devices should point (shown on the
|
||||||
|
// MQTT Clients page). Same host/port the service-client endpoint hands out.
|
||||||
|
app.get('/mqtt-broker', { preHandler: requireAdmin }, async () => ({
|
||||||
|
host: MQTT_BROKER_HOST,
|
||||||
|
port: MQTT_BROKER_PORT,
|
||||||
|
}))
|
||||||
|
|
||||||
// GET /settings/api/mqtt-clients
|
// GET /settings/api/mqtt-clients
|
||||||
app.get('/mqtt-clients', { preHandler: requireAdmin }, async () => {
|
app.get('/mqtt-clients', { preHandler: requireAdmin }, async () => {
|
||||||
const { rows } = await pool.query(`SELECT ${CLIENT_COLS} FROM mqtt_clients ORDER BY created_at DESC`)
|
const { rows } = await pool.query(`SELECT ${CLIENT_COLS} FROM mqtt_clients ORDER BY created_at DESC`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue