updated positioning labels
This commit is contained in:
@@ -144,5 +144,5 @@ export async function getCoords() {
|
|||||||
if (rows.length && rows[0].latitude && rows[0].longitude) {
|
if (rows.length && rows[0].latitude && rows[0].longitude) {
|
||||||
return { lat: rows[0].latitude, lon: rows[0].longitude, alt: rows[0].altitude || c.ALTITUDE }
|
return { lat: rows[0].latitude, lon: rows[0].longitude, alt: rows[0].altitude || c.ALTITUDE }
|
||||||
}
|
}
|
||||||
return { lat: c.LATITUDE, lon: c.LONGITUDE, alt: c.ALTITUDE }
|
return { latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,15 +69,15 @@ app.get('/api/space', async (req, res) => {
|
|||||||
const coords = await getCoords();
|
const coords = await getCoords();
|
||||||
if(mode === 'hourly') {
|
if(mode === 'hourly') {
|
||||||
const space = await getSpaceWeather();
|
const space = await getSpaceWeather();
|
||||||
Object.assign(space, getCelestialHourly(coords.lat, coords.lon, start, end));
|
Object.assign(space, getCelestialHourly(coords.latitude, coords.longitude, start, end));
|
||||||
res.json(filterFields(space, fields));
|
res.json(filterFields(space, fields));
|
||||||
} else if(mode === 'daily') {
|
} else if(mode === 'daily') {
|
||||||
const space = await getSpaceWeather();
|
const space = await getSpaceWeather();
|
||||||
Object.assign(space, getCelestialDaily(coords.lat, coords.lon, start, end));
|
Object.assign(space, getCelestialDaily(coords.latitude, coords.longitude, start, end));
|
||||||
res.json(filterFields(space, fields));
|
res.json(filterFields(space, fields));
|
||||||
} else {
|
} else {
|
||||||
const space = await getSpaceWeather();
|
const space = await getSpaceWeather();
|
||||||
Object.assign(space, getCelestialCurrent(coords.lat, coords.lon));
|
Object.assign(space, getCelestialCurrent(coords.latitude, coords.longitude));
|
||||||
res.json(filterFields(space, fields));
|
res.json(filterFields(space, fields));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -92,7 +92,7 @@ app.get('/api/hourly', async (req, res) => {
|
|||||||
const coords = await getCoords();
|
const coords = await getCoords();
|
||||||
const [sensor, meteo] = await Promise.allSettled([
|
const [sensor, meteo] = await Promise.allSettled([
|
||||||
queryHourly(start, now),
|
queryHourly(start, now),
|
||||||
getOpenMeteo(coords.lat, coords.lon, now, end),
|
getOpenMeteo(coords.latitude, coords.longitude, now, end),
|
||||||
]);
|
]);
|
||||||
const history = sensor.status === 'fulfilled' ? sensor.value : [];
|
const history = sensor.status === 'fulfilled' ? sensor.value : [];
|
||||||
const forecast = meteo.status === 'fulfilled' ? meteo.value.hourly : [];
|
const forecast = meteo.status === 'fulfilled' ? meteo.value.hourly : [];
|
||||||
@@ -109,7 +109,7 @@ app.get('/api/daily', async (req, res) => {
|
|||||||
const coords = await getCoords();
|
const coords = await getCoords();
|
||||||
const [sensor, meteo] = await Promise.allSettled([
|
const [sensor, meteo] = await Promise.allSettled([
|
||||||
queryDaily(start, now),
|
queryDaily(start, now),
|
||||||
getOpenMeteo(coords.lat, coords.lon, now, end),
|
getOpenMeteo(coords.latitude, coords.longitude, now, end),
|
||||||
]);
|
]);
|
||||||
const history = sensor.status === 'fulfilled' ? sensor.value : [];
|
const history = sensor.status === 'fulfilled' ? sensor.value : [];
|
||||||
const forecast = meteo.status === 'fulfilled' ? meteo.value.daily : [];
|
const forecast = meteo.status === 'fulfilled' ? meteo.value.daily : [];
|
||||||
|
|||||||
Reference in New Issue
Block a user