fix zeroconf on apple systems

This commit is contained in:
Michael Zanetti 2018-11-15 23:13:42 +01:00
parent bd59345934
commit b1b29faf82

View File

@ -104,9 +104,10 @@ void ZeroconfDiscovery::serviceEntryAdded(const QZeroConfService &entry)
device->setName(serverName);
device->setVersion(version);
QUrl url;
if (entry.type() == "_jsonrpc._tcp") {
// NOTE: On linux this is "_jsonrpc._tcp" while on apple systems this is "_jsonrpc._tcp."
if (entry.type().startsWith("_jsonrpc._tcp")) {
url.setScheme(sslEnabled ? "nymeas" : "nymea");
} else {
} else if (entry.type().startsWith("_ws._tcp")) {
url.setScheme(sslEnabled ? "wss" : "ws");
}
url.setHost(!entry.ip().isNull() ? entry.ip().toString() : entry.ipv6().toString());