Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADS-B: Fix OpenSky authentication to enable 4000 API calls per day. #2363

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions plugins/channelrx/demodadsb/adsbdemodgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5935,9 +5935,6 @@ void ADSBDemodGUI::applyImportSettings()
void ADSBDemodGUI::import()
{
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";
QChar join = '?';
if (!m_settings.m_importParameters.isEmpty())
Expand Down Expand Up @@ -5965,7 +5962,13 @@ void ADSBDemodGUI::import()
urlString = urlString + join + "lomax=" + m_settings.m_importMaxLongitude;
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
Expand Down
2 changes: 1 addition & 1 deletion plugins/channelrx/demodadsb/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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.

<h3>17: Open Notifications Dialog</h3>
Expand Down
Loading