Refactor icon extraction to include port information in tags

This commit is contained in:
2026-02-19 00:07:15 +03:00
parent 30c3e29a19
commit b9e61b3653

View File

@@ -319,6 +319,10 @@ function extractIconTagsAndStrip(name) {
let s = String(name || ""); let s = String(name || "");
const tags = []; const tags = [];
const typ = safeStr(proxy && proxy.type) || "";
const port = safeStr(proxy && proxy.port);
tags.push(portToFancy(port, typ))
for (const r of ICON_RULES) { for (const r of ICON_RULES) {
if (r.regex.test(s)) { if (r.regex.test(s)) {
tags.push(r.icon); tags.push(r.icon);
@@ -333,12 +337,7 @@ function extractIconTagsAndStrip(name) {
} }
} }
const typ = safeStr(proxy && proxy.type) || ""; return { stripped: s.replace(/\s+/g, " ").trim(), tags: uniq(tags) };
const port = safeStr(proxy && proxy.port);
const portSup = portToFancy(port, typ);
return portSup & { stripped: s.replace(/\s+/g, " ").trim(), tags: uniq(tags) };
} }
function detectCountryByName(name) { function detectCountryByName(name) {