add long and lat to events

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-09 21:49:56 +02:00
parent 4936ba1d40
commit 0975a20e17
6 changed files with 40 additions and 16 deletions

View File

@@ -7,21 +7,24 @@ interface RemoteIpLookupResponse {
country: string | undefined;
city: string | undefined;
stateprov: string | undefined;
continent: string | undefined;
longitude: number | undefined;
latitude: number | undefined;
}
interface GeoLocation {
country: string | undefined;
city: string | undefined;
region: string | undefined;
continent: string | undefined;
longitude: number | undefined;
latitude: number | undefined;
}
const geo: GeoLocation = {
country: undefined,
city: undefined,
region: undefined,
continent: undefined,
longitude: undefined,
latitude: undefined,
};
const ignore = ['127.0.0.1', '::1'];
@@ -45,7 +48,8 @@ export async function parseIp(ip?: string): Promise<GeoLocation> {
country: res.country,
city: res.city,
region: res.stateprov,
continent: res.continent,
longitude: res.longitude,
latitude: res.latitude,
};
} catch (e) {
logger.error('Failed to fetch geo location for ip', e);