Files
gooseek/services/geo-device-svc/README.md
home cd6b7857ba feat: default locale Russian, geo determines language for other countries
- localization-svc: defaultLocale ru, resolveLocale only by geo
- web-svc: DEFAULT_LOCALE ru, layout lang=ru, embeddedTranslations fallback ru
- countryToLocale: default ru when no country or unknown country

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-23 15:10:38 +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
Deploy via ./deploy/k3s/deploy.sh (K8s)
# или
PORT=4002 npm start
```