1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Fix API host address in About dialog and debug message

The API server is listening on all interfaces. This is indicated by Qt
with the address 0.0.0.0 even if it is listening on both IPv4 and IPv6
https://doc.qt.io/qt-6/qhostaddress.html#toString
So the following addresses are valid
 http://127.0.0.1:8091/
 http://[::1]:8091/
 http://0.0.0.0:8091/
 http://[::]:8091/
plus any other address assigned to wired, wireless or virtual interfaces.
This commit is contained in:
Daniele Forsi 2024-07-20 19:20:17 +02:00
parent 40f7ecdaa0
commit e46f7f09b8
3 changed files with 4 additions and 4 deletions

View File

@ -44,7 +44,7 @@ void WebAPIServer::start()
if (!m_listener)
{
m_listener = new qtwebapp::HttpListener(m_settings, m_requestMapper, qApp);
qInfo("WebAPIServer::start: starting web API server at http://%s:%d", qPrintable(m_settings.host), m_settings.port);
qInfo("WebAPIServer::start: starting web API server at http://%s:%d", qPrintable(m_settings.host.isEmpty() ? "0.0.0.0" : m_settings.host), m_settings.port);
}
}
@ -54,7 +54,7 @@ void WebAPIServer::stop()
{
delete m_listener;
m_listener = 0;
qInfo("WebAPIServer::stop: stopped web API server at http://%s:%d", qPrintable(m_settings.host), m_settings.port);
qInfo("WebAPIServer::stop: stopped web API server at http://%s:%d", qPrintable(m_settings.host.isEmpty() ? "0.0.0.0" : m_settings.host), m_settings.port);
}
}

View File

@ -32,7 +32,7 @@ AboutDialog::AboutDialog(const QString& apiHost, int apiPort, const MainSettings
ui->dspBits->setText(QString("DSP Rx %1 bits Tx %2 bits").arg(SDR_RX_SAMP_SZ).arg(SDR_TX_SAMP_SZ));
ui->pid->setText(QString("PID: %1").arg(qApp->applicationPid()));
QString apiUrl = QString("http://%1:%2/").arg(apiHost).arg(apiPort);
ui->restApiUrl->setText(QString("REST API documentation: <a href=\"%1\">%2</a>").arg(apiUrl).arg(apiUrl));
ui->restApiUrl->setText(QString("REST API server and documentation: <a href=\"%1\">%2</a>").arg(apiUrl).arg(apiUrl));
ui->restApiUrl->setOpenExternalLinks(true);
ui->settingsFile->setText(QString("Settings: %1").arg(mainSettings.getFileLocation()));
}

View File

@ -3096,7 +3096,7 @@ void MainWindow::loadDefaultPreset(const QString& pluginId, SerializableInterfac
void MainWindow::on_action_About_triggered()
{
AboutDialog dlg(m_apiHost.isEmpty() ? "127.0.0.1" : m_apiHost, m_apiPort, m_mainCore->m_settings, this);
AboutDialog dlg(m_apiHost.isEmpty() ? "0.0.0.0" : m_apiHost, m_apiPort, m_mainCore->m_settings, this);
dlg.exec();
}