Skip to content

statusfile.tcl is not setting type = "flightfeeder" #100

@chuckwolber

Description

@chuckwolber

This commit made to dump1090-fa turned on a check in the dump1090-fa web interface to look for a type variable in status.json. When type = "flightfeeder", a "FlightFeeder SkyAware" logo should appear on the web page and the page title will change to "FlightFeeder SkyAware". Otherwise a "PiAware SkyAware" logo appears and the page title is set to "PiAware SkyAware".

Since piaware is acting in the role of flight feeder by consuming data from dump1090-fa and pushing it to FlightAware, is it reasonable to expect that the status.json produced by piaware is indeed the same status.json being consumed by dump1090-fa?

If so, it does not appear as if piaware is actually adding the type variable to the status.json, nor does it appear as if dump1090-fa is able to properly access the status.json produced by piaware.

The following three patches will resolve the issue and get the correct logo and page title to appear. The first patch applies to the latest version of the piaware project. The latter two patches are intended for the latest version of dump1090-fa. I can submit a separate issue to the dump1090-fa project if desired.

diff --git a/programs/piaware/statusfile.tcl b/programs/piaware/statusfile.tcl
index ed7241c..8bb7002 100644
--- a/programs/piaware/statusfile.tcl
+++ b/programs/piaware/statusfile.tcl
@@ -69,7 +69,9 @@ proc build_status {} {
        # site UUID, if unclaimed
        if {[info exists ::feederID] && [info exists ::loggedInUser] && $::loggedInUser eq "guest"} {
                set data(unclaimed_feeder_id) [::json::write string $::feederID]
-       }
+       } else {
+        set data(type) [::json::write string "flightfeeder"]
+    }
 
        # piaware: our own health
        set data(piaware) [status_entry "green" "PiAware $::piawareVersionFull is running"]
diff --git a/public_html/script.js b/public_html/script.js
index 7217613..2ed02ed 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -2527,7 +2527,7 @@ function toggleLayer(element, layer) {
 
 // check status.json if it has a serial number for a flightfeeder
 function flightFeederCheck() {
-    $.ajax('/status.json', {
+    $.ajax('status.json', {
         success: function(data) {
             if (data.type === "flightfeeder") {
                 isFlightFeeder = true;
@@ -2538,7 +2538,7 @@ function flightFeederCheck() {
 }
 
 function setStatsLink() {
-        $.ajax('/status.json', {
+        $.ajax('status.json', {
                 success: function(data) {
                     if (data.unclaimed_feeder_id) {
                         var claim_link = "https://flightaware.com/adsb/piaware/claim/" + data.unclaimed_feeder_id;
diff --git a/debian/lighttpd/89-skyaware.conf b/debian/lighttpd/89-skyaware.conf
index 56f44d1..3d108f8 100644
--- a/debian/lighttpd/89-skyaware.conf
+++ b/debian/lighttpd/89-skyaware.conf
@@ -21,6 +21,7 @@
 # server.modules += ( "mod_alias" )
 
 alias.url += (
+  "/skyaware/status.json" => "/run/piaware/status.json",
   "/skyaware/data/" => "/run/dump1090-fa/",
   "/skyaware/data-978/" => "/run/skyaware978/",
   "/skyaware/" => "/usr/share/skyaware/html/"
@@ -34,6 +35,7 @@ url.redirect += (
 # Listen on port 8080 and serve the map there, too.
 $SERVER["socket"] == ":8080" {
   alias.url += (
+    "/status.json" => "/run/piaware/status.json",
     "/data/" => "/run/dump1090-fa/",
     "/data-978/" => "/run/skyaware978/",
     "/" => "/usr/share/skyaware/html/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions