mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-01 21:02:39 +08:00
Merge pull request #6679 from nicerloop/zeroconf-announce-screen-name
Use screen name instead of IP address to announce server through zeroconf
This commit is contained in:
commit
ffba759792
@ -12,12 +12,13 @@ Bug fixes:
|
||||
- #4036 Client cursor constrained to old resolution
|
||||
|
||||
Enhancements:
|
||||
- #6666 Add doxygen documentation output from piplines
|
||||
- #6666 Add doxygen documentation output from pipelines
|
||||
- #6674 Debian 10 X11 build for CI
|
||||
- #6714 Added windows core binaries upload to sandor
|
||||
- #6715 Updated language file from Crowdin
|
||||
- #6688 Fully migrate CI from Jenkins to Azure Pipelines
|
||||
- #6718 Action to test PR's for updated changelog
|
||||
- #6722 Allow servers to be announced by screen name instead of IP
|
||||
|
||||
Features:
|
||||
- #6538 System-wide config for all system users
|
||||
|
||||
@ -101,27 +101,6 @@ void ZeroconfService::errorHandle(DNSServiceErrorType errorCode)
|
||||
tr("Error code: %1.").arg(errorCode));
|
||||
}
|
||||
|
||||
QString ZeroconfService::getLocalIPAddresses()
|
||||
{
|
||||
QStringList addresses;
|
||||
foreach (const QHostAddress& address, QNetworkInterface::allAddresses()) {
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol &&
|
||||
address != QHostAddress(QHostAddress::LocalHost)) {
|
||||
addresses.append(address.toString());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const QString& preferedIP, preferedIPAddress) {
|
||||
foreach (const QString& address, addresses) {
|
||||
if (address.startsWith(preferedIP)) {
|
||||
return address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool ZeroconfService::registerService(bool server)
|
||||
{
|
||||
bool result = true;
|
||||
@ -137,20 +116,10 @@ bool ZeroconfService::registerService(bool server)
|
||||
else {
|
||||
m_pZeroconfRegister = new ZeroconfRegister(this);
|
||||
if (server) {
|
||||
QString localIP = getLocalIPAddresses();
|
||||
if (localIP.isEmpty()) {
|
||||
QMessageBox::warning(
|
||||
m_pMainWindow, tr("Synergy Auto Config"),
|
||||
tr("Failed to get local IP address. "
|
||||
"Please manually type in server address "
|
||||
"on your clients"));
|
||||
}
|
||||
else {
|
||||
m_pZeroconfRegister->registerService(
|
||||
ZeroconfRecord(tr("%1").arg(localIP),
|
||||
QLatin1String(m_ServerServiceName), QString()),
|
||||
m_zeroconfServer.serverPort());
|
||||
}
|
||||
m_pZeroconfRegister->registerService(
|
||||
ZeroconfRecord(tr("%1").arg(m_pMainWindow->getScreenName()),
|
||||
QLatin1String(m_ServerServiceName), QString()),
|
||||
m_zeroconfServer.serverPort());
|
||||
}
|
||||
else {
|
||||
m_pZeroconfRegister->registerService(
|
||||
|
||||
@ -42,7 +42,6 @@ private slots:
|
||||
void errorHandle(DNSServiceErrorType errorCode);
|
||||
|
||||
private:
|
||||
QString getLocalIPAddresses();
|
||||
bool registerService(bool server);
|
||||
|
||||
private:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user