X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2Fui-services%2FUIServiceUtils.ts;h=06db5a47109f2c11b77eb938021748d86968eaf5;hb=852a4c5f07886502e278d44fda06efdfa8c711d8;hp=573520b9687c93b267fcf4fcfe4eb70f6ee4453e;hpb=8114d10e3893e96bb725ce2fca9744429ee4b75b;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ui-server/ui-services/UIServiceUtils.ts b/src/charging-station/ui-server/ui-services/UIServiceUtils.ts index 573520b9..06db5a47 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceUtils.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceUtils.ts @@ -23,21 +23,21 @@ export class UIServiceUtils { protocolIndex + Protocol.UI.length ) as Protocol; version = fullProtocol.substring(protocolIndex + Protocol.UI.length) as ProtocolVersion; - if ( - Object.values(Protocol).includes(protocol) && - Object.values(ProtocolVersion).includes(version) - ) { + if (UIServiceUtils.isProtocolSupported(protocol, version) === true) { return fullProtocol; } } logger.error( `${Utils.logPrefix( - ' UI WebSocket Server:' + ' UI WebSocket Server |' )} Unsupported protocol: ${protocol} or protocol version: ${version}` ); return false; }; + public static isProtocolSupported = (protocol: Protocol, version: ProtocolVersion): boolean => + Object.values(Protocol).includes(protocol) && Object.values(ProtocolVersion).includes(version); + public static isLoopback(address: string): boolean { const isLoopbackRegExp = new RegExp( // eslint-disable-next-line no-useless-escape