From 2afb4d15045cdb5f521a5d57859ba23505afc852 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 5 Sep 2022 23:33:47 +0200 Subject: [PATCH] UI protocol: remove hashId field support to route requests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../ChargingStationWorkerBroadcastChannel.ts | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 81996076..3000626e 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -51,24 +51,17 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca const [uuid, command, requestPayload] = this.validateMessageEvent(messageEvent) .data as BroadcastChannelRequest; - if (requestPayload?.hashIds !== undefined || requestPayload?.hashId !== undefined) { - if ( - requestPayload?.hashId === undefined && - requestPayload?.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false - ) { - return; - } - if ( - requestPayload?.hashIds === undefined && - requestPayload?.hashId !== this.chargingStation.stationInfo.hashId - ) { - return; - } - if (requestPayload?.hashId !== undefined) { - logger.warn( - `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' instead` - ); - } + if ( + requestPayload?.hashIds !== undefined && + requestPayload?.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false + ) { + return; + } + if (requestPayload?.hashId !== undefined) { + logger.error( + `${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' instead` + ); + return; } let responsePayload: BroadcastChannelResponsePayload; -- 2.34.1