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

View file

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