1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-25 05:25:27 -04:00

Merge pull request #2363 from srcejon/freq_scanner

ADS-B: Fix OpenSky authentication to enable 4000 API calls per day.
This commit is contained in:
Edouard Griffiths 2024-12-25 20:11:19 +01:00 committed by GitHub
commit 70d090101a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View File

@ -5935,9 +5935,6 @@ void ADSBDemodGUI::applyImportSettings()
void ADSBDemodGUI::import() void ADSBDemodGUI::import()
{ {
QString urlString = "https://"; QString urlString = "https://";
if (!m_settings.m_importUsername.isEmpty() && !m_settings.m_importPassword.isEmpty()) {
urlString = urlString + m_settings.m_importUsername + ":" + m_settings.m_importPassword + "@";
}
urlString = urlString + m_settings.m_importHost + "/api/states/all"; urlString = urlString + m_settings.m_importHost + "/api/states/all";
QChar join = '?'; QChar join = '?';
if (!m_settings.m_importParameters.isEmpty()) if (!m_settings.m_importParameters.isEmpty())
@ -5965,7 +5962,13 @@ void ADSBDemodGUI::import()
urlString = urlString + join + "lomax=" + m_settings.m_importMaxLongitude; urlString = urlString + join + "lomax=" + m_settings.m_importMaxLongitude;
join = '&'; join = '&';
} }
m_networkManager->get(QNetworkRequest(QUrl(urlString))); QNetworkRequest request = QNetworkRequest(QUrl(urlString));
if (!m_settings.m_importUsername.isEmpty() && !m_settings.m_importPassword.isEmpty())
{
QByteArray encoded = (m_settings.m_importUsername + ":" + m_settings.m_importPassword).toLocal8Bit().toBase64();
request.setRawHeader("Authorization", "Basic " + encoded);
}
m_networkManager->get(request);
} }
// Handle opensky-network API call reply // Handle opensky-network API call reply

View File

@ -133,7 +133,7 @@ As a server:
The Beast binary and Hex formats are as detailed here: https://wiki.jetvision.de/wiki/Mode-S_Beast:Data_Output_Formats The Beast binary and Hex formats are as detailed here: https://wiki.jetvision.de/wiki/Mode-S_Beast:Data_Output_Formats
When Enable import is checked, aircraft data for aircraft anywhere in the world can be imported from OpenSky Network. When Enable import is checked, aircraft data for aircraft anywhere in the world can be imported from OpenSky Network.
A username and password are not required, but when specified, this allows the update period to be reduced to 5 seconds instead of 10 seconds. A username and password are not required, but when specified, this allows the update period to be reduced to 5 seconds instead of 10 seconds, and 4000 API calls per day instead of 400.
To limit network traffic and processing power requirements, a geographical region can be set via the minimum and maximum latitude and longitude fields. To limit network traffic and processing power requirements, a geographical region can be set via the minimum and maximum latitude and longitude fields.
<h3>17: Open Notifications Dialog</h3> <h3>17: Open Notifications Dialog</h3>