From 4ea0cd8c176593cfde1d8094fc1c3b3bd8e88269 Mon Sep 17 00:00:00 2001 From: gnezim Date: Thu, 30 Apr 2026 09:16:18 +0300 Subject: [PATCH] Use real API in dev full proxy --- Makefile | 4 +++- scripts/dev-server.mjs | 20 +------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 1cdccf73..99f8779d 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ help: PNPM := pnpm PID_FILE := .dev.pid LOG_FILE := .dev.log +API_TARGET ?= https://flights.test.aeroflot.ru # Development dev: @@ -46,9 +47,10 @@ dev: dev-full: @echo "Starting dev server with API proxy in background..." - @nohup $(PNPM) dev:full > $(LOG_FILE) 2>&1 & echo $$! > $(PID_FILE) + @API_TARGET="$(API_TARGET)" nohup $(PNPM) dev:full > $(LOG_FILE) 2>&1 & echo $$! > $(PID_FILE) @echo "Dev server started (PID: $$(cat $(PID_FILE)))" @echo " App & API: http://localhost:8080" + @echo " API target: $(API_TARGET)" @echo "View logs: make logs" stop: diff --git a/scripts/dev-server.mjs b/scripts/dev-server.mjs index 300096ee..fd48d282 100644 --- a/scripts/dev-server.mjs +++ b/scripts/dev-server.mjs @@ -17,7 +17,7 @@ import { tmpdir } from "node:os"; const PUBLIC_PORT = 8080; const MODERNJS_PORT = 8081; -const API_TARGET = "https://flights.test.aeroflot.ru"; +const API_TARGET = process.env.API_TARGET || "https://flights.test.aeroflot.ru"; // Shared cookie jar so the Ngenix WAF cookie challenge (`ngenix_valid` + // 307-to-self) only runs once per dev-server lifetime, not per request. @@ -50,24 +50,6 @@ await new Promise((r) => setTimeout(r, 18000)); const app = express(); -// --- Mock fallback for /api/appSettings when WAF blocks requests --- -app.get("/api/appSettings", (req, res) => { - res.json({ - showDebugVersion: "False", - uiOptions: { - isTestVersion: "", - filter: { - schedule: { searchFrom: "30d", searchTo: "30d", timeStep: "" }, - onlineboard: { searchFrom: "2d", searchTo: "14d", timeStep: "" }, - }, - buttons: { - buyTicket: { period: { min: "2h", max: "72h" } }, - flightStatus: { availableFrom: "24h", visible: "" }, - }, - }, - }); -}); - // --- Tile proxy via curl (binary JPEG, pipe stdout straight to response) --- const TILE_CONTENT_TYPES = { ".jpeg": "image/jpeg",