Better addresses

This commit is contained in:
2025-10-04 13:58:46 +02:00
parent 93d42633b8
commit 2ed915a082
3 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -3,6 +3,10 @@ import Server from "@/types/server";
import axios from "axios";
import { Dispatch, RefObject, SetStateAction } from "react";
export function makeAddress(ip: string, defaultPort = 7080) {
return ip.includes(":") ? `${ip}` : `${ip}:${defaultPort}`;
}
export default async function auth(
ip: string,
wsRef: RefObject<WebSocket | null>,
@@ -14,7 +18,7 @@ export default async function auth(
).token;
// Open the WebSocket connection
const ws = new WebSocket(`ws://${ip}:7080`);
const ws = new WebSocket(`ws://${ip}`);
wsRef.current = ws;
ws.onopen = () => {