add long and lat to events
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -122,13 +122,6 @@ export function EventDetails({ event, open, setOpen }: Props) {
|
||||
setFilter('country', event.country ?? '');
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Continent',
|
||||
value: event.continent,
|
||||
onClick() {
|
||||
setFilter('continent', event.continent ?? '');
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Device',
|
||||
value: event.device,
|
||||
|
||||
@@ -68,7 +68,8 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
||||
country: event?.country || geo.country || '',
|
||||
city: event?.city || geo.city || '',
|
||||
region: event?.region || geo.region || '',
|
||||
continent: event?.continent || geo.continent || '',
|
||||
longitude: geo.longitude,
|
||||
latitude: geo.latitude,
|
||||
os: event?.os ?? '',
|
||||
osVersion: event?.osVersion ?? '',
|
||||
browser: event?.browser ?? '',
|
||||
@@ -150,7 +151,8 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
||||
country: geo.country,
|
||||
city: geo.city,
|
||||
region: geo.region,
|
||||
continent: geo.continent,
|
||||
longitude: geo.longitude,
|
||||
latitude: geo.latitude,
|
||||
os: uaInfo?.os ?? '',
|
||||
osVersion: uaInfo?.osVersion ?? '',
|
||||
browser: uaInfo?.browser ?? '',
|
||||
|
||||
Reference in New Issue
Block a user