Files
vault/backend/src/detect.js
T
2026-01-26 19:24:43 +00:00

32 lines
749 B
JavaScript

export function detectServerType({ host = '', port }) {
const normalizedHost = String(host).toLowerCase();
const numericPort = Number(port);
const hasPort = Number.isFinite(numericPort);
if (hasPort && numericPort === 8007) {
return 'pbs';
}
if (hasPort && numericPort === 8006) {
return 'proxmox';
}
if (hasPort && (numericPort === 443 || numericPort === 444)) {
return 'truenas';
}
if (normalizedHost.includes('pbs') || normalizedHost.includes('backup')) {
return 'pbs';
}
if (normalizedHost.includes('pve') || normalizedHost.includes('proxmox')) {
return 'proxmox';
}
if (normalizedHost.includes('truenas') || normalizedHost.includes('tn')) {
return 'truenas';
}
return 'proxmox';
}