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>
This commit is contained in:
home
2026-02-20 17:20:14 +03:00
parent 783569b8e7
commit 8ba3f5495a
18 changed files with 958 additions and 96 deletions

View File

@@ -233,6 +233,29 @@
---
### 3.9 Geo Device Service (реализован)
**Назначение:** Определение геопозиции пользователя, типа устройства, браузера и ОС.
**Расположение:** `apps/geo-device-service/`
**API:**
- `GET /api/context` — контекст по IP и заголовкам (User-Agent, Accept-Language)
- `POST /api/context` — контекст с дополнительными данными от клиента (screen, timezone, Geolocation API)
**Данные:**
- **geo** — latitude, longitude, city, country, timezone (geoip-lite по IP или из body)
- **device** — type (desktop/mobile/tablet), vendor, model
- **browser** — name, version (ua-parser-js)
- **os** — name, version
- **client** — screenWidth, viewportHeight, timezone, language, hardwareConcurrency, deviceMemory, doNotTrack (из POST body)
**Запуск:** `npm run dev:geo` или `PORT=4002 npm run start -w geo-device-service`
**Интеграция:** Frontend вызывает `/api/geo-context` (проксирует к сервису), клиент — `fetchContextWithClient()` из `@/lib/geoDevice`.
---
## 4. Матрица зависимостей
| Сервис | От кого получает вызовы | Кого вызывает |
@@ -262,6 +285,7 @@ gooseek/
│ ├── uploads-service/ # UploadManager, UploadStore
│ ├── storage-service/ # DB, config
│ ├── llm-proxy/ # Models registry, providers
│ ├── geo-device-service/ # Геопозиция, устройство, браузер
│ ├── shared-types/ # Общие типы, DTO
│ └── shared-utils/ # formatHistory, splitText, computeSimilarity
├── docker-compose.yaml