Fix ADSB truth on ddmap

This commit is contained in:
30hours 2024-02-12 09:04:13 +00:00
parent db6d9656cf
commit e17c04af0a
2 changed files with 13 additions and 5 deletions

View file

@ -71,7 +71,7 @@ app.get('/api/config', (req, res) => {
});
app.get('/api/adsb2dd', (req, res) => {
if (config.truth.adsb.enabled == true) {
const api_url = "http://adsb2dd.30hours.dev/api/dd";
const api_url = "https://adsb2dd.30hours.dev/api/dd";
const api_query =
api_url +
"?rx=" + config.location.rx.latitude + "," +
@ -80,9 +80,12 @@ app.get('/api/adsb2dd', (req, res) => {
"&tx=" + config.location.tx.latitude + "," +
config.location.tx.longitude + "," +
config.location.tx.altitude +
"&fc=" + (config.capture.fs / 1000000) +
"&fc=" + (config.capture.fc / 1000000) +
"&server=" + "http://" + config.truth.adsb.ip;
res.send(api_query);
const jsonResponse = {
url: api_query
};
res.json(jsonResponse);
}
else {
res.status(400).end();

View file

@ -9,6 +9,7 @@ var range_y = [];
var urlTimestamp;
var urlDetection;
var urlAdsb;
var urlAdsbLink;
var urlConfig;
if (isLocalHost) {
urlTimestamp = '//' + host + ':3000/api/timestamp';
@ -26,9 +27,9 @@ if (isLocalHost) {
urlMap = '//' + host + urlMap;
}
if (isLocalHost) {
urlAdsb = '//' + host + ':3000/api/adsb2dd';
urlAdsbLink = '//' + host + ':3000/api/adsb2dd';
} else {
urlAdsb = '//' + host + '/api/adsb2dd';
urlAdsbLink = '//' + host + '/api/adsb2dd';
}
if (isLocalHost) {
urlConfig = '//' + host + ':3000/api/config';
@ -45,6 +46,10 @@ var configData = $.getJSON(urlConfig, function () { })
.done(function (data_config) {
if (data_config.truth.adsb.enabled === true) {
isTruth = true;
var adsbLinkData = $.getJSON(urlAdsbLink, function () { })
.done(function (data) {
urlAdsb = data.url;
})
}
});