diff --git a/.env.example b/.env.example index 08d7d29..e6bc0ea 100644 --- a/.env.example +++ b/.env.example @@ -6,11 +6,14 @@ # # Every variable is OPTIONAL. When unset, the SPA falls back to production- # default behavior: -# - VITE_API_BASE_URL : '' (relative paths; SPA and suite share nginx) -# - VITE_OWM_API_KEY : undefined → getWeatherData returns null -# - VITE_OWM_BASE_URL : https://api.openweathermap.org/data/2.5 -# - VITE_OSM_TILE_URL : https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png -# - VITE_ESRI_TILE_URL : https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x} +# - VITE_API_BASE_URL : '' (relative paths; SPA and suite share nginx) +# - VITE_OWM_API_KEY : undefined → getWeatherData returns null +# - VITE_OWM_BASE_URL : https://api.openweathermap.org/data/2.5 +# - VITE_SATELLITE_TILE_URL : http://localhost:5100/tiles/{z}/{x}/{y} +# (dev default; production builds MUST override +# to the same-origin nginx path so cookie auth +# is honored — AZ-498 / contract @ +# _docs/02_document/contracts/satellite-provider/tiles.md) # Prefix for every API request (production: empty; tests / alt deployments: set). # A trailing slash is stripped automatically. @@ -26,10 +29,7 @@ VITE_OWM_API_KEY= # Example for the e2e profile: http://owm-stub:8081/data/2.5 VITE_OWM_BASE_URL= -# OSM map tile URL template (Leaflet TileLayer.url). -# Example for the e2e profile: http://tile-stub:8082/{z}/{x}/{y}.png -VITE_OSM_TILE_URL= - -# Esri satellite tile URL template (Leaflet TileLayer.url for the satellite layer). -# Example for the e2e profile: http://tile-stub:8082/sat/{z}/{y}/{x} -VITE_ESRI_TILE_URL= +# Suite satellite-provider tile URL template (Leaflet TileLayer.url). +# Production: same-origin path (`/tiles/{z}/{x}/{y}`) so the auth cookie rides. +# E2E profile: http://tile-stub:8082/tiles/{z}/{x}/{y} +VITE_SATELLITE_TILE_URL= diff --git a/_docs/02_document/modules/mission-planner.md b/_docs/02_document/modules/mission-planner.md index df82072..006ae22 100644 --- a/_docs/02_document/modules/mission-planner.md +++ b/_docs/02_document/modules/mission-planner.md @@ -35,7 +35,7 @@ mission-planner/src/ ├── services/ │ ├── calculateDistance.ts Haversine + plane climb/cruise/descend │ ├── AircraftService.ts mockGetAirplaneParams (returns hardcoded fixed-wing) -│ ├── WeatherService.ts OpenWeatherMap fetch +│ ├── WeatherService.ts OpenWeatherMap fetch (env-vars: VITE_OWM_API_KEY + VITE_OWM_BASE_URL; fail-soft `null` when key unset, AZ-499) │ └── calculateBatteryUsage.ts Drag + thrust lookup; same algorithm as src/features/flights/flightPlanUtils.calculateBatteryPercentUsed ├── icons/ │ ├── MapIcons.tsx Leaflet icon factories @@ -82,10 +82,10 @@ The React 19 port translates module-for-module wherever possible. Status as of t | `flightPlanning/Aircraft.ts` | (no equivalent) | Aircraft is server-side; the SPA fetches `/api/flights/aircrafts`. | | `services/calculateDistance.ts` | `flightPlanUtils.calculateDistance` | Ported. | | `services/calculateBatteryUsage.ts` | `flightPlanUtils.calculateBatteryPercentUsed` + `calculateAllPoints` | Ported. | -| `services/WeatherService.ts` | `flightPlanUtils.getWeatherData` | Ported (with the same hardcoded API key — Step 4 fix). | +| `services/WeatherService.ts` | `flightPlanUtils.getWeatherData` | Ported. Env-vars `VITE_OWM_API_KEY` + `VITE_OWM_BASE_URL` since AZ-499 (mirrors AZ-448 / AZ-449); same fail-soft `null` contract. | | `services/AircraftService.ts` | `flightPlanUtils.getMockAircraftParams` (mock only) | Real fetch is `/api/flights/aircrafts` in `FlightsPage`. | | `constants/translations.ts` + `LanguageContext.tsx` | `src/i18n/{en,ua}.json` + `i18n/i18n.ts` | Migrated to i18next. | -| `constants/{actionModes,maptypes,tileUrls,purposes,languages}.ts` | `features/flights/types.ts` (`PURPOSES`, `TILE_URLS`, `ActionMode`) | Consolidated into one file. | +| `constants/{actionModes,maptypes,tileUrls,purposes,languages}.ts` | `features/flights/types.ts` (`PURPOSES`, `TILE_URL`, `ActionMode`) | Consolidated into one file. `TILE_URL` collapsed from the prior classic/satellite pair to a single self-hosted satellite URL by AZ-498. | | `icons/{MapIcons,PointIcons,SidebarIcons,PhoneIcon}.tsx` | `features/flights/mapIcons.ts` | Only the marker icons survived; SidebarIcons + PhoneIcon dropped (no rotate-phone overlay in the SPA today). | | `utils.ts` (`newGuid`) | `flightPlanUtils.newGuid` | Ported. | | `config.ts` | `features/flights/types.COORDINATE_PRECISION` | Single constant migrated. | @@ -98,7 +98,7 @@ The React 19 port translates module-for-module wherever possible. Status as of t - **Rotate-phone overlay** (`icons/PhoneIcon.tsx`): MP shows a rotate-phone hint when held in portrait. The SPA does not. - **Per-purpose marker icons** (`icons/PointIcons.tsx`): MP draws a different marker per `meta` purpose. The SPA uses three colour-coded icons (start / mid / end). - **`Aircraft.ts` helper class**: never used in the SPA — aircraft state is fetched and treated as a plain DTO. -- **OpenWeather call directly from `WeatherService.ts`**: same flaw as the SPA port (hardcoded key, no proxy). Both flagged for Step 4. +- **OpenWeather call directly from `WeatherService.ts`**: same flaw as the SPA port (no proxy). Hardcoded key fixed by AZ-499 (env-vars + fail-soft); proxy story still owned by the broader F1 mission-planner deduplication track. - **MUI 5**: MP uses MUI for dialogs / inputs / icons. The SPA replaced everything with hand-rolled Tailwind components matching `_docs/ui_design/README.md`. MUI is not a dep of the workspace. ## Findings carried into Step 4 / 6 / 8 diff --git a/_docs/02_document/modules/src__features__flights.md b/_docs/02_document/modules/src__features__flights.md index 8b5de2c..1813267 100644 --- a/_docs/02_document/modules/src__features__flights.md +++ b/_docs/02_document/modules/src__features__flights.md @@ -17,7 +17,7 @@ Currently handles only the planning surface; the gps-denied orthophoto upload / | Module | Layer | Responsibility | |---|---|---| -| `types.ts` | leaf | All flight-feature-only types (`FlightPoint`, `CalculatedPointInfo`, `MapRectangle`, `WindParams`, `AircraftParams`, `MovingPointInfo`, `ActionMode`), plus tile URLs (`TILE_URLS`), `PURPOSES` (`tank` / `artillery`), and `COORDINATE_PRECISION = 8`. | +| `types.ts` | leaf | All flight-feature-only types (`FlightPoint`, `CalculatedPointInfo`, `MapRectangle`, `WindParams`, `AircraftParams`, `MovingPointInfo`, `ActionMode`), plus the single self-hosted satellite tile URL (`TILE_URL`, AZ-498 — env-var `VITE_SATELLITE_TILE_URL`, dev default `http://localhost:5100/tiles/{z}/{x}/{y}`), `PURPOSES` (`tank` / `artillery`), and `COORDINATE_PRECISION = 8`. | | `mapIcons.ts` | leaf | Three coloured Leaflet `Icon` instances + the default Leaflet pin (loaded from a CDN — see Findings). | | `flightPlanUtils.ts` | leaf | Pure-ish helpers: `newGuid`, haversine `calculateDistance` (with plane climb/cruise/descend profile), OpenWeatherMap fetch, semi-empirical `calculateBatteryPercentUsed`, `calculateAllPoints` (sequential reduce), `parseCoordinates`, `getMockAircraftParams`. | | `WaypointList.tsx` | sub-component | `@hello-pangea/dnd` reorderable list, hover-only Edit/Remove buttons, shows distance / time / battery / altitude per point. | @@ -30,7 +30,7 @@ Currently handles only the planning surface; the gps-denied orthophoto upload / | `FlightListSidebar.tsx` | sub-component | Left rail: flight list, "+ Create", inline-create row, telemetry date stub. | | `JsonEditorDialog.tsx` | sub-component | Modal `