fix(striker-ui-api): correct defaults in get host connection; patches #593

main
Tsu-ba-me 9 months ago
parent f506ec4ac8
commit 56fb79e041
  1. 15
      striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts
  2. 4
      striker-ui-api/src/types/GetAnvilDataFunction.d.ts

@ -14,8 +14,19 @@ const buildHostConnections = (
}: { defaultPort?: number; defaultUser?: string } = {},
) =>
Object.entries(databaseHash).reduce<HostConnectionOverview>(
(previous, [hostUUID, { host: ipAddress, ping, port: rawPort, user }]) => {
const port = Number(rawPort);
(
previous,
[
hostUUID,
{
host: ipAddress,
ping,
port: rPort = defaultPort,
user = defaultUser,
},
],
) => {
const port = Number(rPort);
if (hostUUID === fromHostUUID) {
previous.inbound.port = port;

@ -25,11 +25,11 @@ type AnvilDataAnvilListHash = {
type AnvilDataDatabaseHash = {
[hostUUID: string]: {
host: string;
name: string;
name?: string;
password: string;
ping: string;
port: string;
user: string;
user?: string;
};
};

Loading…
Cancel
Save