fix: MikroTik hardcoded slug map for + models (crs305/312/317/326)
This commit is contained in:
parent
9618a4f0e0
commit
c9333ab5ea
@ -124,10 +124,25 @@ function buildExtremeUrl(model: string): string | null {
|
|||||||
return `https://www.extremenetworks.com/product/${slug}/`;
|
return `https://www.extremenetworks.com/product/${slug}/`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MikroTik product URL slugs for models containing '+' are not derivable from
|
||||||
|
// the model name — their website uses opaque suffixes (_in, _rm, …).
|
||||||
|
// The models without '+' follow a simple pattern (lowercase, dashes→underscore).
|
||||||
|
const MIKROTIK_SLUG_MAP: Record<string, string> = {
|
||||||
|
"CRS305-1G-4S+": "crs305_1g_4s_in",
|
||||||
|
"CRS312-4C+8XG": "crs312_4c_8xg_rm",
|
||||||
|
"CRS317-1G-16S+": "crs317_1g_16s_rm",
|
||||||
|
"CRS326-24G-2S+": "crs326_24g_2s_in",
|
||||||
|
// CRS354-48G-4S+2Q+: URL not discoverable — MikroTik's product listing is JS-rendered
|
||||||
|
};
|
||||||
|
|
||||||
function buildMikroTikUrl(model: string): string | null {
|
function buildMikroTikUrl(model: string): string | null {
|
||||||
// CRS504-4XQ-IN → https://mikrotik.com/product/crs504_4xq_in (lowercase required)
|
if (model in MIKROTIK_SLUG_MAP) {
|
||||||
|
return `https://mikrotik.com/product/${MIKROTIK_SLUG_MAP[model]}`;
|
||||||
|
}
|
||||||
|
if (model.includes("+")) return null; // other + models — URL unknown
|
||||||
|
// Simple lowercase + dashes→underscores for models without '+'
|
||||||
const slug = model.toLowerCase().replace(/[-\s]+/g, "_").replace(/[^a-z0-9_]/g, "");
|
const slug = model.toLowerCase().replace(/[-\s]+/g, "_").replace(/[^a-z0-9_]/g, "");
|
||||||
return `https://mikrotik.com/product/${slug}`;
|
return slug ? `https://mikrotik.com/product/${slug}` : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildUbiquitiUrl(model: string): string | null {
|
function buildUbiquitiUrl(model: string): string | null {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user