INNER CODE UNIT · JavaScript

parseDevices

bostrot/wsl2-distro-manager · n8n/licensing/seat_check.js:35

function parseDevices(raw) {
  if (Array.isArray(raw)) return raw.filter((d) => d && typeof d.id === 'string');
  if (typeof raw !== 'string' || !raw.trim()) return [];
  try {
    const parsed = JSON.parse(raw);
    return Array.isArray(parsed)
      ? parsed.filter((d) => d && typeof d.id === 'string')
      : [];
  } catch (e) {
    return [];
  }
}

function clientIp(headers) {
  const h = headers || {};
  const forwarded = String(h['x-forwarded-for'] || '').split(',')[0].trim();
  return String(h['cf-connecting-ip'] || h['x-real-ip'] || forwarded || 'unknown');
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…