mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-07-18 16:25:43 +00:00
Display location on map node details
This commit is contained in:
@@ -4,6 +4,7 @@ import { Maybe, Types } from '@dotstats/common';
|
||||
export interface Location {
|
||||
lat: Types.Latitude;
|
||||
lon: Types.Longitude;
|
||||
city: Types.City;
|
||||
}
|
||||
|
||||
const cache = new Map<string, Location>();
|
||||
@@ -12,7 +13,8 @@ export async function locate(ip: string): Promise<Maybe<Location>> {
|
||||
if (ip === '127.0.0.1') {
|
||||
return Promise.resolve({
|
||||
lat: 52.5166667 as Types.Latitude,
|
||||
lon: 13.4 as Types.Longitude
|
||||
lon: 13.4 as Types.Longitude,
|
||||
city: 'Berlin' as Types.City,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,8 +32,8 @@ export async function locate(ip: string): Promise<Maybe<Location>> {
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
const { latitude: lat, longitude: lon } = result;
|
||||
const location = { lat, lon } as Location;
|
||||
const { latitude: lat, longitude: lon, city } = result;
|
||||
const location = { lat, lon, city } as Location;
|
||||
|
||||
cache.set(ip, location);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user