diff --git a/islands/Chat.tsx b/islands/Chat.tsx index dbc5e71..3723016 100644 --- a/islands/Chat.tsx +++ b/islands/Chat.tsx @@ -20,7 +20,10 @@ export default function Chat() { setUsername(`User${randomNum}`); } - const ws = new WebSocket(`ws://${globalThis.location.host}/api/chat`); + const wsProtocol = window.location.protocol === "https:" ? "wss:" : "ws:"; + const ws = new WebSocket( + `${wsProtocol}//${globalThis.location.host}/api/chat`, + ); ws.onopen = () => { console.log("Connected to chat"); diff --git a/islands/NavigationBar.tsx b/islands/NavigationBar.tsx index 359f8df..a1ec68c 100644 --- a/islands/NavigationBar.tsx +++ b/islands/NavigationBar.tsx @@ -53,48 +53,50 @@ export default function NavigationBar({ currentPath }: NavigationBarProps) { isScrolling.value ? "opacity-30" : "opacity-100" } ${isVisible.value ? "translate-y-0" : "translate-y-20"}`} > -