Parse the payload as manual only in manual mode

This commit is contained in:
Mykola Balakin 2026-10-13 23:01:54 +03:00
parent 68ca0107f9
commit 955f78f083
No known key found for this signature in database
GPG Key ID: B9B5039ECA2ACA32

View File

@ -259,12 +259,14 @@ func (r *JsonRpc2Client) ReceiveData(number string, receiveWebhookUrl string) {
// the envelope directly. Unwrap so the broadcast format is
// the same in both modes and downstream consumers (e.g. the
// websocket handler) don't have to know which mode is in use.
var manualWrapper struct {
Subscription int64 `json:"subscription"`
Result json.RawMessage `json:"result"`
}
if err := json.Unmarshal(resp1.Params, &manualWrapper); err == nil && len(manualWrapper.Result) > 0 {
resp1.Params = manualWrapper.Result
if r.manualReceiveMode {
var manualWrapper struct {
Subscription int64 `json:"subscription"`
Result json.RawMessage `json:"result"`
}
if err := json.Unmarshal(resp1.Params, &manualWrapper); err == nil && len(manualWrapper.Result) > 0 {
resp1.Params = manualWrapper.Result
}
}
r.receivedMessagesMutex.Lock()