mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-03 16:31:28 +02:00
843d59a2d6
Channel indices on the device can shift after the user deletes a channel — subsequent slots compact down by one — but mc-webui only ran _load_channel_secrets() once at startup, so the in-memory cache mapped channel_idx to whichever secret was there at boot. Once the indices moved, expected_payloads for sent channel messages were encrypted with the wrong key, so legitimate repeater echoes always fell into the 'doesn't match expected candidates' branch and never got linked to the originating send. send_channel_message now calls _refresh_channel_secret(idx) before building the candidate list: one extra get_channel(idx) round-trip that fetches the current secret straight from the firmware, updates the in-memory cache + DB if they had drifted, and is used for the pkt_payload computation. If the slot is empty, the stale cache entry is dropped. Also bump the set_param timeout for path_hash_mode and custom_var to 20s — the meshcore lib has a 15s internal timeout, so the previous 5s outer wrapper raised a bare concurrent.futures.TimeoutError with empty str(e) before the device's ERROR event could surface. The exception handler now logs the exception type as well so future empty-string errors are still diagnosable, and stores the event.payload (not the never-defined event.data) when capturing the sent message's pkt_payload field.