From 0b68c0417d7efa55c4c874f5542df408bb4ff9c4 Mon Sep 17 00:00:00 2001 From: ppfeiffer Date: Wed, 18 Feb 2026 16:01:49 +0100 Subject: [PATCH] fix: v0.6.8 - Bugfixes: Node-Sync, Modal, Badge, CSS - bot.py: pub.subscribe vor TCPInterface verschoben; Nodes beim Start wurden nicht geladen da connection.established/node.updated Events verpasst wurden. Fallback-Sync nach Konstruktor ergaenzt. - HTML: tabler.min.js -> bootstrap.bundle.min.js; Tabler exportiert bootstrap nicht global, new bootstrap.Modal() schlug fehl. - dashboard.js: badge-pill -> rounded-pill (Bootstrap 4 -> 5) - style.css: --tblr-bg-body Typo -> --tblr-body-bg Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 11 +++++++++++ config.yaml | 6 +++--- meshbot/bot.py | 19 ++++++++++++++++++- static/admin.html | 2 +- static/css/style.css | 2 +- static/index.html | 2 +- static/js/dashboard.js | 2 +- static/login.html | 2 +- static/scheduler.html | 2 +- static/settings.html | 2 +- 10 files changed, 39 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a78a9..56fb290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## [0.6.8] - 2026-02-18 + +### Fixed +- **bot.py**: `pub.subscribe()` wurde nach `TCPInterface()` aufgerufen → `connection.established` + und `node.updated`-Events beim Start wurden verpasst; Nodes nicht geladen, Status blieb + "Getrennt". Subscriptions werden jetzt VOR dem Konstruktor registriert + Fallback danach. +- **HTML**: `tabler.min.js` exportiert `bootstrap` nicht global → `new bootstrap.Modal()` schlug + fehl, Seiten brachen ab. Zurück zu `bootstrap.bundle.min.js` (Tabler CSS bleibt). +- **dashboard.js**: Bootstrap-4-Klasse `badge-pill` durch `rounded-pill` (Bootstrap 5) ersetzt. +- **style.css**: CSS-Variablen-Typo `--tblr-bg-body` → `--tblr-body-bg`. + ## [0.6.7] - 2026-02-17 ### Changed diff --git a/config.yaml b/config.yaml index 5425bf5..e309ed9 100644 --- a/config.yaml +++ b/config.yaml @@ -1,16 +1,16 @@ -version: "0.6.7" +version: "0.6.8" bot: name: "MeshDD-Bot" command_prefix: "?" meshtastic: - host: "192.168.11.11" + host: "192.168.11.4" port: 4403 web: host: "0.0.0.0" - port: 8080 + port: 8081 database: path: "meshdd.db" diff --git a/meshbot/bot.py b/meshbot/bot.py index c4da5c3..6cb1331 100644 --- a/meshbot/bot.py +++ b/meshbot/bot.py @@ -27,11 +27,28 @@ class MeshBot: host = config.get("meshtastic.host", "localhost") port = config.get("meshtastic.port", 4403) logger.info("Connecting to Meshtastic at %s:%s", host, port) - self.interface = TCPInterface(hostname=host, portNumber=port) + # Subscribe BEFORE creating the interface: TCPInterface fires + # connection.established and node.updated from a background thread + # during its constructor, so late subscriptions miss those events. pub.subscribe(self._on_receive, "meshtastic.receive") pub.subscribe(self._on_connection, "meshtastic.connection.established") pub.subscribe(self._on_connection_lost, "meshtastic.connection.lost") pub.subscribe(self._on_node_updated, "meshtastic.node.updated") + self.interface = TCPInterface(hostname=host, portNumber=port) + # Fallback: if connection.established fired before our subscription + # was registered, set the flag and sync initial nodes manually. + if not self._connected: + logger.warning("connection.established missed – applying fallback") + self._connected = True + if self.ws_manager: + self.loop.call_soon_threadsafe( + asyncio.ensure_future, self._broadcast_bot_status() + ) + if self.interface.nodes: + for node in self.interface.nodes.values(): + self.loop.call_soon_threadsafe( + asyncio.ensure_future, self._handle_node_update(node) + ) logger.info("Connected to Meshtastic") def disconnect(self): diff --git a/static/admin.html b/static/admin.html index 9e57d85..87302d2 100644 --- a/static/admin.html +++ b/static/admin.html @@ -185,7 +185,7 @@ - + diff --git a/static/css/style.css b/static/css/style.css index 939af75..710011d 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -105,7 +105,7 @@ margin-left: 210px; padding: .875rem; min-height: calc(100vh - 48px); - background: var(--tblr-bg-body, var(--bs-body-bg)); + background: var(--tblr-body-bg, var(--bs-body-bg)); } /* ── Info Boxes ──────────────────────────────────────────────── */ diff --git a/static/index.html b/static/index.html index 569a211..30698cd 100644 --- a/static/index.html +++ b/static/index.html @@ -219,7 +219,7 @@ - + diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 4747de5..3a36f2e 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -166,7 +166,7 @@ function addMessage(msg) { item.innerHTML = `
${escapeHtml(from)} - ${escapeHtml(chName)}${time} + ${escapeHtml(chName)}${time}
${escapeHtml(msg.payload || '')}
`; if (msgChannelFilter !== 'all' && String(chIdx) !== msgChannelFilter) { diff --git a/static/login.html b/static/login.html index f3a77a1..e78c67a 100644 --- a/static/login.html +++ b/static/login.html @@ -117,7 +117,7 @@ - + diff --git a/static/scheduler.html b/static/scheduler.html index ecade9b..15c8349 100644 --- a/static/scheduler.html +++ b/static/scheduler.html @@ -123,7 +123,7 @@ - + diff --git a/static/settings.html b/static/settings.html index 1aa1ac6..fae1692 100644 --- a/static/settings.html +++ b/static/settings.html @@ -147,7 +147,7 @@ - +