From 781cbbb026f11458aafaf0d991314f1e5d39c9e6 Mon Sep 17 00:00:00 2001 From: Dmitriy Petrov Date: Fri, 8 May 2026 21:57:54 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=85=D0=B5=D1=88=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B0=20=D0=BA=D0=B5=D1=88=D0=B0=20?= =?UTF-8?q?Refs:=20None?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server/index.js b/src/server/index.js index 1ecef6c..2449aa6 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -1,6 +1,7 @@ import http from "node:http"; import fs from "node:fs"; import path from "node:path"; +import crypto from "node:crypto"; import { spawn, spawnSync } from "node:child_process"; import { settings } from "./config.js"; import { fetchSubscription } from "./subscription.js"; @@ -625,7 +626,8 @@ async function handleApi(req, res) { return sendJson(res, 400, { success: false, error: "Укажите url" }); // Кеш — файл рядом с custom-rule-sets.json - const cacheKey = Buffer.from(url).toString("base64url").slice(0, 48); + // Используем crypto hash чтобы избежать коллизий при одинаковом префиксе URL + const cacheKey = crypto.createHash("sha1").update(url).digest("hex"); const cacheFile = path.join( settings.dataDir, `ruleset-cache-${cacheKey}.json`,