This commit is contained in:
2026-09-10 22:52:44 -04:00
parent 2c25251864
commit 79acad8c07
9 changed files with 314 additions and 30 deletions

View File

@@ -108,11 +108,14 @@ export async function queryDaily(start, end) {
export async function getCoords() {
const c = cfg();
if(c.LATITUDE !== 0 && c.LONGITUDE !== 0 && c.ALTITUDE !== 0)
return {latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE};
const results = await queryInstant(c, `{__name__=~"latitude|longitude|altitude"}`);
const fields = metricToFields(results);
if (fields.latitude && fields.longitude) {
if(fields.latitude && fields.longitude) {
return {latitude: fields.latitude, longitude: fields.longitude, altitude: fields.altitude || c.ALTITUDE};
}
return {latitude: c.LATITUDE, longitude: c.LONGITUDE, altitude: c.ALTITUDE};
return {latitude: 0, longitude: 0, altitude: 0};
}