Small bug fixes
This commit is contained in:
@@ -97,7 +97,7 @@ exports.getWeather = function( req, res ) {
|
|||||||
weatherUndergroundKey = req.query.key,
|
weatherUndergroundKey = req.query.key,
|
||||||
outputFormat = req.query.format,
|
outputFormat = req.query.format,
|
||||||
firmwareVersion = req.query.fwv,
|
firmwareVersion = req.query.fwv,
|
||||||
remoteAddress = req.headers[ "x-forwarded-for" ].split(",")[0] || req.connection.remoteAddress,
|
remoteAddress = req.headers[ "x-forwarded-for" ] || req.connection.remoteAddress,
|
||||||
weather = {},
|
weather = {},
|
||||||
|
|
||||||
// After the location is resolved, this function will run to complete the weather request
|
// After the location is resolved, this function will run to complete the weather request
|
||||||
@@ -161,7 +161,7 @@ exports.getWeather = function( req, res ) {
|
|||||||
rh = weather.observation.imperial.rh || 0,
|
rh = weather.observation.imperial.rh || 0,
|
||||||
|
|
||||||
// The absolute precipitation in the past 48 hours
|
// The absolute precipitation in the past 48 hours
|
||||||
precip = weather.observation.imperial.precip_2day;
|
precip = weather.observation.imperial.precip_2day || weather.observation.imperial.precip_24hour;
|
||||||
|
|
||||||
if ( typeof temp !== "number" ) {
|
if ( typeof temp !== "number" ) {
|
||||||
|
|
||||||
@@ -218,6 +218,8 @@ exports.getWeather = function( req, res ) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
remoteAddress = remoteAddress.split(",")[0];
|
||||||
|
|
||||||
// Parse weather adjustment options
|
// Parse weather adjustment options
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ var express = require( "express" ),
|
|||||||
port = process.env.PORT || 3000;
|
port = process.env.PORT || 3000;
|
||||||
app = express();
|
app = express();
|
||||||
|
|
||||||
|
if ( !process.env.PORT ) {
|
||||||
|
require( "dotenv" ).load();
|
||||||
|
}
|
||||||
|
|
||||||
// Handle requests matching /weatherID.py where ID corresponds to the
|
// Handle requests matching /weatherID.py where ID corresponds to the
|
||||||
// weather adjustment method selector.
|
// weather adjustment method selector.
|
||||||
// This endpoint is considered deprecated and supported for prior firmware
|
// This endpoint is considered deprecated and supported for prior firmware
|
||||||
|
|||||||
Reference in New Issue
Block a user