weather icons
This commit is contained in:
@@ -35,7 +35,13 @@ app.use(helmet({
|
||||
scriptSrc: ["'self'", "'unsafe-inline'", "https://maps.googleapis.com"],
|
||||
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
|
||||
fontSrc: ["'self'", "https://fonts.gstatic.com"],
|
||||
imgSrc: ["'self'", "data:", "https://maps.googleapis.com", "https://maps.gstatic.com"],
|
||||
imgSrc: [
|
||||
"'self'",
|
||||
"data:",
|
||||
"https://maps.googleapis.com",
|
||||
"https://maps.gstatic.com",
|
||||
"https://openweathermap.org"
|
||||
],
|
||||
connectSrc: ["'self'", "https://api.openweathermap.org"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ router.get('/:propertyId/forecast', async (req, res, next) => {
|
||||
windSpeed: [],
|
||||
precipitation: 0,
|
||||
conditions: [],
|
||||
icons: [],
|
||||
timestamps: []
|
||||
};
|
||||
}
|
||||
@@ -229,6 +230,7 @@ router.get('/:propertyId/forecast', async (req, res, next) => {
|
||||
dailyForecast[date].windSpeed.push(item.wind?.speed || 0);
|
||||
dailyForecast[date].precipitation += item.rain?.['3h'] || 0;
|
||||
dailyForecast[date].conditions.push(item.weather[0].description);
|
||||
dailyForecast[date].icons.push(item.weather[0].icon);
|
||||
dailyForecast[date].timestamps.push(new Date(item.dt * 1000));
|
||||
});
|
||||
|
||||
@@ -246,6 +248,7 @@ router.get('/:propertyId/forecast', async (req, res, next) => {
|
||||
maxWindSpeed: Math.round(Math.max(...windSpeeds)),
|
||||
totalPrecipitation: Math.round(day.precipitation * 100) / 100,
|
||||
conditions: day.conditions[0], // Use first condition of the day
|
||||
icon: day.icons[0],
|
||||
timestamps: day.timestamps
|
||||
};
|
||||
}).slice(0, 5); // Limit to 5 days
|
||||
|
||||
Reference in New Issue
Block a user