Files
gooseek/apps/geo-device-service/README.md
home 8ba3f5495a feat: geo-device-service, Weather по геопозиции, Discover вкладка GooSeek
Geo Device Service:
- Новый сервис определения геопозиции, устройства, браузера
- geoip-lite, ua-parser-js, CORS
- GET/POST /api/context

Frontend:
- /api/geo-context — прокси к geo-device, fallback при недоступности
- geoDevice.ts — fetchContextWithClient, fetchContextWithGeolocation
- Weather: геопозиция через geo-device + GeoJS + ipwhois fallback
- Weather API: поддержка city (геокодинг Open-Meteo)
- Discover: вкладка GooSeek по умолчанию

Документация:
- MICROSERVICES.md — секция 3.9 Geo Device Service

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 17:20:14 +03:00

58 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Geo Device Service
Сервис определения геопозиции, устройства и браузера пользователя.
## Возможности
- **Геолокация по IP** — offline lookup через geoip-lite (MaxMind GeoLite)
- **Device** — тип (desktop/mobile/tablet), vendor, model
- **Browser** — имя, версия
- **OS** — операционная система и версия
- **Client context** — при POST с body: screen size, timezone, language, hardwareConcurrency, deviceMemory, doNotTrack
## API
### GET /api/context
Возвращает контекст на основе IP и заголовков запроса.
### POST /api/context
Принимает дополнительные данные от клиента (geo из Geolocation API, размер экрана, timezone и т.д.) и объединяет с серверными данными.
**Body:**
```json
{
"geo": {
"latitude": 55.7558,
"longitude": 37.6173,
"city": "Moscow",
"country": "Russia",
"timezone": "Europe/Moscow"
},
"client": {
"screenWidth": 1920,
"screenHeight": 1080,
"viewportWidth": 1920,
"viewportHeight": 969,
"devicePixelRatio": 2,
"timezone": "Europe/Moscow",
"language": "en",
"languages": ["en", "ru"],
"platform": "MacIntel",
"hardwareConcurrency": 8,
"deviceMemory": 8,
"cookieEnabled": true,
"doNotTrack": null
}
}
```
## Запуск
```bash
npm run dev
# или
PORT=4002 npm start
```