fixed bug

This commit is contained in:
git 2025-06-15 20:38:32 +01:00
parent c4045a3d30
commit c10a43a1e3

View File

@ -161,25 +161,25 @@ function replyLocallyWithRemoteDevicesData(name,type,query) {
} }
// 3. If the query is for an SRV record (hostname + port of a service) // 3. If the query is for an SRV record (hostname + port of a service)
if (type === 'SRV' && db.remote[name] && db.remote[name].SRV !== null) { if (type === 'SRV' && db.remote.services[name] && db.remote.services[name].SRV !== null) {
answers.push({ answers.push({
name, name,
type: 'SRV', type: 'SRV',
class: 'IN', class: 'IN',
ttl: 120, ttl: 120,
data: db.remote[name].SRV // Must be an object like { port, target, priority, weight } data: db.remote.services[name].SRV // Must be an object like { port, target, priority, weight }
}); });
} }
// 4. If the query is for a TXT record (extra metadata) // 4. If the query is for a TXT record (extra metadata)
if (type === 'TXT' && db.remote[name] && db.remote[name].TXT !== null) { if (type === 'TXT' && db.remote.services[name] && db.remote.services[name].TXT !== null) {
answers.push({ answers.push({
name, name,
type: 'TXT', type: 'TXT',
class: 'IN', class: 'IN',
ttl: 120, ttl: 120,
// Convert plain string to buffer; required by mdns-server // Convert plain string to buffer; required by mdns-server
data: Buffer.from(db.remote[name].TXT, 'utf8') data: Buffer.from(db.remote.services[name].TXT, 'utf8')
}); });
} }
// 5. Many mDNS tools (like Avahi or Bonjour) send type: 'ANY' queries to discover all records for a name. // 5. Many mDNS tools (like Avahi or Bonjour) send type: 'ANY' queries to discover all records for a name.