diff --git a/lib/DDG/Spice/Metar.pm b/lib/DDG/Spice/Metar.pm index 8ad0e04603..e60be2bea1 100644 --- a/lib/DDG/Spice/Metar.pm +++ b/lib/DDG/Spice/Metar.pm @@ -7,7 +7,7 @@ package DDG::Spice::Metar; use DDG::Spice; use Geo::ICAO qw{ :airport }; -spice to => 'http://avwx.rest/api/metar.php?station=$1&format=JSON&options=info,translate'; +spice to => 'https://avwx.rest/api/metar/$1?options=info,translate'; spice proxy_cache_valid => "418 1d"; # Do not cache responses. spice wrap_jsonp_callback => 1; diff --git a/share/spice/metar/metar.js b/share/spice/metar/metar.js index 7552c54eef..a8eba499e5 100644 --- a/share/spice/metar/metar.js +++ b/share/spice/metar/metar.js @@ -12,13 +12,15 @@ data: api_result, meta: { sourceName: "Aviation Weather REST API", - sourceUrl: "http://avwx.rest" + sourceUrl: "https://avwx.rest" }, normalize: function(item) { var airport_desc = [item["Info"]["City"], item["Info"]["Country"]]; - if (item["Info"]["Name"] != "") // Name is empty for some places. - airport_desc.unshift(item["Info"]["Name"]); + + if (item["Info"]["Name"] !== "") { + airport_desc.unshift(item["Info"]["Name"]); // Name is empty for some places. + } var interpreted_data = [ {label: "Time of Observation", @@ -39,11 +41,15 @@ value: item["Flight-Rules"]} ]; - if (item["Translations"]["Other"] != "") { + if (item["Translations"]["Other"] !== "") { interpreted_data.push({label: "Other Remarks", value: item["Translations"]["Other"]}); } + if (item["Raw-Report"].indexOf('$') !== -1) { + interpreted_data.unshift({label: "Maintenance Check Indicator", value: "On"}); + } + return { title: item["Station"], subtitle: [airport_desc.join(", "),