diff --git a/src/ui/src/app/page.tsx b/src/ui/src/app/page.tsx index a446a82..c461551 100644 --- a/src/ui/src/app/page.tsx +++ b/src/ui/src/app/page.tsx @@ -9,16 +9,13 @@ import bong from '../../public/bong.mp3'; // @ts-ignore import bloop from '../../public/bloop.mp3'; -const URI = "192.168.42.121"; - export default function Home() { - const ws = new WebSocket(`ws://${URI}:8000/ws`); const canvasRef = useRef(null); const [bongSfx] = useSound(bong); const [bloopSfx] = useSound(bloop); const playBong = () => { - fetch(`http://${URI}:8000/sfx`, { + fetch(`http://${ip}:8000/sfx`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -31,7 +28,7 @@ export default function Home() { }; const playBloop = () => { - fetch(`http://${URI}:8000/sfx`, { + fetch(`http://${ip}:8000/sfx`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -49,8 +46,10 @@ export default function Home() { const [down, setDown] = useState(0); const [rotateleft, setRotateLeft] = useState(0); const [rotateright, setRotateRight] = useState(0); + const [ip, setIp] = useState("localhost"); useInsertionEffect(() => { + const ws = new WebSocket(`ws://${ip}:8000/ws`); ws.onmessage = (event) => { if (event.data instanceof Blob) { const reader = new FileReader(); @@ -148,7 +147,7 @@ export default function Home() { }, []) useEffect(() => { - fetch(`http://${URI}:8000/command`, { + fetch(`http://${ip}:8000/command`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -208,6 +207,14 @@ export default function Home() {
+
+ +