From ed612f3e38e6a5c31fc02efb30a1db1cf428b741 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Thu, 26 Mar 2026 16:19:42 -0400 Subject: [PATCH] refactor: enhance message handling for dual-mode channel compatibility using Channels.match() --- webbridge.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webbridge.lua b/webbridge.lua index 692f32b..b30667d 100644 --- a/webbridge.lua +++ b/webbridge.lua @@ -491,11 +491,13 @@ parallel.waitForAny( local event, side, channel, replyChannel, message, distance = os.pullEvent("modem_message") stats.messagesReceived = stats.messagesReceived + 1 - if channel == STATUS_CHANNEL or channel == CHANNEL_RECEIVE then + -- Uses Channels.match() for dual-mode safety: accepts messages on + -- both legacy (101/102/103) and target (4211/4212/4213) during migration. + if (Channels.match('remoteturtle.status', channel) or Channels.match('remoteturtle.response', channel)) then if type(message) == "table" then forwardToServer(message) end - elseif channel == POCKET_CHANNEL then + elseif Channels.match('remoteturtle.pocket', channel) then if type(message) == "table" then handlePocketMessage(message) end