From dd2a6cfa1af19089efd3a39aa54971e5e6fcfc19 Mon Sep 17 00:00:00 2001 From: Fovway Date: Fri, 24 Oct 2025 23:48:53 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=D0=A3=D0=BB=D1=83=D1=87=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20IP-=D0=B0=D0=B4=D1=80=D0=B5=D1=81=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20=D1=81=D1=82=D0=B8=D0=BB=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=BC?= =?UTF-8?q?=D0=BE=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20=D1=83=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B9=D1=81=D1=82=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Обновлена функция получения IP-адреса клиента с учетом различных заголовков и удалением порта из IPv6 и IPv4 адресов. - Добавлены стили для кнопок и интерактивных элементов, чтобы убрать выделение при нажатии на мобильных устройствах. --- .continue/agents/new-config.yaml | 13 +++++++++++++ .continue/mcpServers/new-mcp-server.yaml | 10 ++++++++++ public/style.css | 18 ++++++++++++++++++ server.js | 21 ++++++++++++++++++--- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .continue/agents/new-config.yaml create mode 100644 .continue/mcpServers/new-mcp-server.yaml diff --git a/.continue/agents/new-config.yaml b/.continue/agents/new-config.yaml new file mode 100644 index 0000000..a1a43ed --- /dev/null +++ b/.continue/agents/new-config.yaml @@ -0,0 +1,13 @@ +# This is an example configuration file +# To learn more, see the full config.yaml reference: https://docs.continue.dev/reference + +name: Example Config +version: 1.0.0 +schema: v1 + +models: + - name: qwen/qwen3-235b-a22b:free + provider: openrouter + model: qwen/qwen3-235b-a22b:free + apiBase: https://openrouter.ai/api/v1 + apiKey: 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 diff --git a/.continue/mcpServers/new-mcp-server.yaml b/.continue/mcpServers/new-mcp-server.yaml new file mode 100644 index 0000000..0e32aa6 --- /dev/null +++ b/.continue/mcpServers/new-mcp-server.yaml @@ -0,0 +1,10 @@ +name: New MCP server +version: 0.0.1 +schema: v1 +mcpServers: + - name: New MCP server + command: npx + args: + - -y + - + env: {} diff --git a/public/style.css b/public/style.css index 258b6e6..4e57d1d 100644 --- a/public/style.css +++ b/public/style.css @@ -33,6 +33,24 @@ body { height: 1em; } +/* Убираем выделение при нажатии на кнопки на мобильных устройствах */ +button { + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; +} + +/* Применяем к другим интерактивным элементам */ +input[type="button"], +input[type="submit"], +input[type="reset"], +a, +div[role="button"] { + -webkit-tap-highlight-color: transparent; + -moz-tap-highlight-color: transparent; + tap-highlight-color: transparent; +} + iconify-icon { font-size: 16px; vertical-align: middle; diff --git a/server.js b/server.js index 1914f1c..940ab4d 100644 --- a/server.js +++ b/server.js @@ -292,14 +292,29 @@ function logAction(userId, actionType, details, ipAddress) { // Функция для получения IP-адреса клиента function getClientIP(req) { - return ( + // Проверяем различные заголовки, которые могут содержать внешний IP-адрес + // Приоритет: x-forwarded-for, x-real-ip, cf-connecting-ip (Cloudflare) + let ip = req.headers["x-forwarded-for"]?.split(",")[0].trim() || req.headers["x-real-ip"] || + req.headers["cf-connecting-ip"] || // Для Cloudflare + req.headers["x-forwarded-for"]?.split(",")[0].trim() || // Повтор для надежности + req.headers["x-cluster-client-ip"] || // Для кластеров req.connection?.remoteAddress || req.socket?.remoteAddress || req.connection?.socket?.remoteAddress || - "unknown" - ); + "unknown"; + + // Убираем порт из IPv6 адреса, если есть + if (ip.includes(":") && ip.split(":").length > 2) { + // Это IPv6 адрес, убираем порт + ip = ip.split(":").slice(0, -1).join(":").replace(/[[\]]/g, ""); + } else if (ip.includes(":")) { + // Это IPv4 адрес с портом, убираем порт + ip = ip.split(":")[0]; + } + + return ip; } // Миграции базы данных