feat: wigle proxy call added
This commit is contained in:
		| @ -3,4 +3,7 @@ DB_USER="" | ||||
| DB_PASSWORD="" | ||||
| DB_HOST="" | ||||
| DB_DIALECT="" | ||||
| DB_PORT="" | ||||
| DB_PORT="" | ||||
| WIGLE_TOKEN="" | ||||
| WIGLE_BASE_URL="https://api.wigle.net" | ||||
| WIGLE_NETWORK_SEARCH="/api/v2/network/search" | ||||
							
								
								
									
										61
									
								
								server/src/proxy/wigle.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								server/src/proxy/wigle.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | ||||
| interface WifiLocationResponse { | ||||
|   success: boolean; | ||||
|   totalResults: number; | ||||
|   first: number; | ||||
|   last: number; | ||||
|   resultCount: number; | ||||
|   results: Result[]; | ||||
|   searchAfter: string; | ||||
|   search_after: number; | ||||
| } | ||||
|  | ||||
| interface Result { | ||||
|   trilat: number; | ||||
|   trilong: number; | ||||
|   ssid: string; | ||||
|   qos: number; | ||||
|   transid: string; | ||||
|   firsttime: string; | ||||
|   lasttime: string; | ||||
|   lastupdt: string; | ||||
|   netid: string; | ||||
|   name?: string; | ||||
|   type: string; | ||||
|   comment?: string; | ||||
|   wep: string; | ||||
|   bcninterval: number; | ||||
|   freenet: string; | ||||
|   dhcp: string; | ||||
|   paynet: string; | ||||
|   userfound: boolean; | ||||
|   channel: number; | ||||
|   rcois: string; | ||||
|   encryption: string; | ||||
|   country: string; | ||||
|   region: string; | ||||
|   road: string; | ||||
|   city?: string; | ||||
|   housenumber?: string; | ||||
|   postalcode: string; | ||||
| } | ||||
|  | ||||
| export const getLocationForWifi = async ( | ||||
|   mac: string | ||||
| ): Promise<WifiLocationResponse | undefined> => { | ||||
|   try { | ||||
|     console.log(process.env.WIGLE_BASE_URL); | ||||
|     const url = `${process.env.WIGLE_BASE_URL!}${process.env | ||||
|       .WIGLE_NETWORK_SEARCH!}?netid=${encodeURIComponent(mac)}`; | ||||
|     const response = await fetch(url, { | ||||
|       method: "GET", | ||||
|       headers: { | ||||
|         "Content-Type": "application/json", | ||||
|         Cookie: `auth=${process.env.WIGLE_TOKEN}`, | ||||
|       }, | ||||
|     }); | ||||
|  | ||||
|     return await response.json(); | ||||
|   } catch (error) { | ||||
|     console.error("Fehler beim Aufruf des Services:", error); | ||||
|   } | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user