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`,