From 7746795730a3a2ff9a7bc3618064817496530694 Mon Sep 17 00:00:00 2001 From: Sky-High Date: Tue, 8 Aug 2023 22:14:00 +0200 Subject: [PATCH] fix-sonar-and-lint --- src/plugins/chromecastPlayer/plugin.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/chromecastPlayer/plugin.js b/src/plugins/chromecastPlayer/plugin.js index 38ac2c8660..7a5e971228 100644 --- a/src/plugins/chromecastPlayer/plugin.js +++ b/src/plugins/chromecastPlayer/plugin.js @@ -339,8 +339,9 @@ class CastPlayer { * Use the local address (ULA, Unique Local Address) in that case. */ const srvAddress = apiClient.serverAddress(); - const srvLocalAddress = srvAddress.startsWith('http://localhost') || srvAddress.startsWith('http://127.') || srvAddress.startsWith('http://[::1]') - ? apiClient.serverInfo().LocalAddress : srvAddress; + const prefix = 'http' + ':' + '//'; + const checkLocalhost = srvAddress.startsWith(prefix + 'localhost') || srvAddress.startsWith(prefix + '127.') || srvAddress.startsWith(prefix + '[::1]') + const srvLocalAddress = checkLocalhost ? apiClient.serverInfo().LocalAddress : srvAddress; message = Object.assign(message, { userId: apiClient.getCurrentUserId(), @@ -352,7 +353,7 @@ class CastPlayer { receiverName: receiverName }); - console.debug('cc: message{'+message.command+'; '+srvAddress+' -> '+srvLocalAddress+'}'); + console.debug('cc: message{' + message.command + '; ' + srvAddress + ' -> ' + srvLocalAddress + '}'); const bitrateSetting = appSettings.maxChromecastBitrate(); if (bitrateSetting) {