diff --git a/backend/src/controllers/dynamicApiController.ts b/backend/src/controllers/dynamicApiController.ts index 9fddd9c..8b7523c 100644 --- a/backend/src/controllers/dynamicApiController.ts +++ b/backend/src/controllers/dynamicApiController.ts @@ -2,7 +2,7 @@ import { Response } from 'express'; import { ApiKeyRequest } from '../middleware/apiKey'; import { mainPool } from '../config/database'; import { sqlExecutor } from '../services/SqlExecutor'; -import { scriptExecutor } from '../services/ScriptExecutor'; +import { scriptExecutor } from '../services/scriptExecutor'; import { EndpointParameter, ScriptQuery } from '../types'; export const executeDynamicEndpoint = async (req: ApiKeyRequest, res: Response) => { diff --git a/backend/src/server.ts b/backend/src/server.ts index f0f5a70..766dceb 100644 --- a/backend/src/server.ts +++ b/backend/src/server.ts @@ -42,6 +42,9 @@ const limiter = rateLimit({ windowMs: config.rateLimit.windowMs, max: config.rateLimit.maxRequests, message: 'Too many requests from this IP, please try again later.', + validate: { trustProxy: false }, // Отключаем валидацию trust proxy + standardHeaders: true, + legacyHeaders: false, }); app.use('/api/', limiter); diff --git a/backend/src/services/ScriptExecutor.ts b/backend/src/services/ScriptExecutor.ts index 9f455b8..1662b4a 100644 --- a/backend/src/services/ScriptExecutor.ts +++ b/backend/src/services/ScriptExecutor.ts @@ -112,7 +112,9 @@ result = __user_script() print(json.dumps(result)) `; - const python = spawn('python', ['-c', wrapperCode]); + // Try python3 first (Linux), fallback to python (Windows) + const pythonCommand = process.platform === 'win32' ? 'python' : 'python3'; + const python = spawn(pythonCommand, ['-c', wrapperCode]); let output = ''; let errorOutput = ''; let queryRequests: any[] = [];