Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
const upnpClient = new homebridgeLib.UpnpClient({
filter: (message) => {
return /^[0-9A-F]{16}$/.test(message['hue-bridgeid'])
},
timeout: this._options.timeout
})
upnpClient.on('deviceFound', (address, obj, message) => {
const id = obj['hue-bridgeid']
const location = obj.location
let host
const a = location.split('/')
if (a.length > 3 && a[2] != null) {
host = a[2]
const b = host.split(':')
const port = parseInt(b[1])
if (port === 80) {
host = b[0]