fix(backend): полноценное сопоставление всех ID правил, учет отсутствующих профилей и проверка активности секций

This commit is contained in:
Dushnilin
2026-08-13 08:43:52 +03:00
parent 79df32ef7c
commit b39efa02ae
2 changed files with 88 additions and 9 deletions
@@ -1916,28 +1916,43 @@ function tachyon_get_targets(all_mode) {
// Active mode (default): Check targets in active enabled UCI sections
let seen_domains = {};
const profile_aliases = {
"meta": "instagram",
"twitter": "x",
"cloudflare": "baseline",
"google_ai": "gemini",
"geoblock": "blocked_ru",
"russia_inside": "blocked_ru",
"russia_outside": "blocked_ru",
"hodca": "hdrezka"
};
cursor.foreach("tachyon", "section", function(s) {
if (s.enabled != "1") return;
if (s.enabled == "0" || s.enabled == "false") return;
let profiles_to_check = [];
let raw_community = s.community_lists;
const resolve_profile = function(id) {
let real_id = profile_aliases[id] || id;
if (profiles_map[real_id]) return profiles_map[real_id];
return null;
};
if (type(raw_community) == "array") {
for (let item in raw_community) {
if (!item) continue;
for (let part in split(as_string(item), /[\s,]+/)) {
let id = trim(part);
if (id != "" && profiles_map[id]) {
push(profiles_to_check, profiles_map[id]);
}
let p = resolve_profile(id);
if (p) push(profiles_to_check, p);
}
}
} else if (type(raw_community) == "string") {
for (let part in split(as_string(raw_community), /[\s,]+/)) {
let id = trim(part);
if (id != "" && profiles_map[id]) {
push(profiles_to_check, profiles_map[id]);
}
let p = resolve_profile(id);
if (p) push(profiles_to_check, p);
}
}
@@ -1980,7 +1995,7 @@ function tachyon_get_targets(all_mode) {
if (!d) continue;
for (let line in split(as_string(d), /[\n\r,]+/)) {
let domain_str = trim(replace(line, /^\*?\./, ""));
if (domain_str != "" && substr(domain_str, 0, 1) != "#")
if (domain_str != "" && substr(domain_str, 0, 1) != "#" && substr(domain_str, 0, 2) != "//")
push(custom_domains, domain_str);
}
}
@@ -1988,7 +2003,7 @@ function tachyon_get_targets(all_mode) {
if (s.user_domains_text) {
for (let line in split(as_string(s.user_domains_text), /[\n\r,]+/)) {
let domain_str = trim(replace(line, /^\*?\./, ""));
if (domain_str != "" && substr(domain_str, 0, 1) != "#")
if (domain_str != "" && substr(domain_str, 0, 1) != "#" && substr(domain_str, 0, 2) != "//")
push(custom_domains, domain_str);
}
}
@@ -215,6 +215,70 @@
{ "kind": "udp", "host": "google.com", "port": 443, "label": "Google QUIC :443" },
{ "kind": "udp", "host": "g.whatsapp.net", "port": 443, "label": "WhatsApp UDP :443", "optional": true }
]
},
{
"id": "news",
"title": "📰 Новости и СМИ",
"group": "media",
"description": "Новостные и медиа-ресурсы.",
"targets": [
{ "kind": "https", "host": "meduza.io", "path": "/", "expect": [200, 301, 302] },
{ "kind": "https", "host": "bbc.com", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "porn",
"title": "🔞 Adult Content",
"group": "media",
"description": "Ресурсы для взрослых.",
"targets": [
{ "kind": "https", "host": "pornhub.com", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "hdrezka",
"title": "🎬 HDRezka",
"group": "video",
"description": "Онлайн-кинотеатр HDRezka.",
"targets": [
{ "kind": "https", "host": "hdrezka.me", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "google_play",
"title": "📱 Google Play Store",
"group": "system",
"description": "Магазин приложений Google Play.",
"targets": [
{ "kind": "https", "host": "play.google.com", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "hetzner",
"title": "🖥️ Hetzner ASN",
"group": "hosting",
"description": "Инфраструктура Hetzner.",
"targets": [
{ "kind": "https", "host": "hetzner.com", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "ovh",
"title": "🖥️ OVH ASN",
"group": "hosting",
"description": "Инфраструктура OVH.",
"targets": [
{ "kind": "https", "host": "ovh.com", "path": "/", "expect": [200, 301, 302] }
]
},
{
"id": "digitalocean",
"title": "🖥️ DigitalOcean ASN",
"group": "hosting",
"description": "Инфраструктура DigitalOcean.",
"targets": [
{ "kind": "https", "host": "digitalocean.com", "path": "/", "expect": [200, 301, 302] }
]
}
]
}