/* the Soulseek listener: the port other peers dial when they download from you. Unset means the client's own 50300, read at connect — bind walks forward a few ports if it is taken. `set_settings` only assigns a port that is Some, so a number typed here can be changed but never taken back to unset. */ const DEFAULT_LISTEN_PORT = 50300; function portPrompt() { openHalf("prompt", { title: "Listening port", value: cfg?.listen_port != null ? String(cfg.listen_port) : "", placeholder: String(DEFAULT_LISTEN_PORT), ok: "Save", numeric: true, onsubmit: (v) => { const n = Number(v); if (!Number.isInteger(n) || n < 1024 || n > 65535) { player.error = "A port is a number between 1024 and 65535."; return; } void saveCfg({ listenPort: n }); }, }); }