sdrweb: use dump1090 json dumps for adsb.html

This commit is contained in:
Astro 2022-02-22 00:16:52 +01:00
parent 6153e0c197
commit b154e00172
3 changed files with 22 additions and 28 deletions

View File

@ -51,7 +51,7 @@
var maxalt = 40000; /* Max altitude in the average case */
var selected = (Selected == plane.hex);
b = 0.5 + (0.5*plane.altitude/maxalt);
b = 0.5 + (0.5 * plane.alt_baro / maxalt);
/* As Icon we use the plane emoji, this is a simple solution but
is definitely a compromise: we expect the icon to be rotated
@ -115,10 +115,10 @@
}
function fetchData() {
$.getJSON('/data.json', function(data) {
$.getJSON('/aircraft.json', function(data) {
var stillhere = {}
for (var j=0; j < data.length; j++) {
var plane = data[j];
for (var j=0; j < data.aircraft.length; j++) {
var plane = data.aircraft[j];
var marker = null;
stillhere[plane.hex] = true;
plane.flight = $.trim(plane.flight);
@ -157,7 +157,7 @@
Planes[plane.hex] = plane;
}
}
NumPlanes = data.length;
NumPlanes = data.aircraft.length;
/* Remove idle planes. */
for (var p in Planes) {
@ -171,7 +171,7 @@
refreshGeneralInfo();
}).always(function() {
setTimeout(fetchData, 500);
setTimeout(fetchData, 1000);
});
}

View File

@ -40,8 +40,8 @@
index index.html;
charset utf-8;
'';
locations."/data.json" = {
proxyPass = "http://${config.c3d2.hosts.radiobert.ip4}:8080/data.json";
locations."/aircraft.json" = {
proxyPass = "http://radiobert.serv.zentralwerk.org/aircraft.json";
};
};
};

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
lat = "51.081";
@ -69,25 +69,6 @@ in {
verifyPeer = false;
};
};
users.users.sbs2json = {
isSystemUser = true;
group = "adsb";
};
systemd.services.sbs2json = {
wantedBy = [ "multi-user.target" ];
requires = [ "dump1090.service" ];
serviceConfig = {
ExecStart = "${pkgs.heliwatch.http-json}/bin/http-json";
User = "sbs2json";
Group = "adsb";
ProtectSystem = "full";
ProtectHome = true;
Restart = "always";
RestartSec = "10s";
};
};
systemd.services.feed-chaos-consulting = {
wantedBy = [ "multi-user.target" ];
requires = [ "sbs2json.service" ];
@ -136,6 +117,19 @@ in {
Exec "${config.services.collectd.user}" "${pkgs.heliwatch.collectd-stats}/bin/collectd-stats"
'';
# serve dump1090 json data via http
services.nginx = {
enable = true;
virtualHosts."radiobert.serv.zentralwerk.org" = {
default = true;
root = statsDir;
extraConfig = ''
autoindex on;
'';
};
};
systemd.services.nginx.serviceConfig.PrivateTmp = lib.mkForce false;
environment.systemPackages = with pkgs; [
dump1090
#dump1090_rs