Skip to content

Commit

Permalink
fix: wevbsocket url is always localhost (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf committed Sep 6, 2024
1 parent 753d091 commit 8c20553
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/nextjs/src/app/[locale]/_client-providers/trpc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { AppRouter } from "@homarr/api";
import { clientApi } from "@homarr/api/client";

const wsClient = createWSClient({
url: "ws://localhost:3001",
url: typeof window === "undefined" ? "ws://localhost:3001" : `ws://${window.location.hostname}:3001`,
});

export function TRPCReactProvider(props: PropsWithChildren) {
Expand Down
10 changes: 10 additions & 0 deletions apps/nextjs/src/app/[locale]/manage/tools/logs/client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use client";

import dynamic from "next/dynamic";

export const ClientSideTerminalComponent = dynamic(
() => import("./terminal").then(({ TerminalComponent }) => TerminalComponent),
{
ssr: false,
},
);
7 changes: 1 addition & 6 deletions apps/nextjs/src/app/[locale]/manage/tools/logs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { getScopedI18n } from "@homarr/translation/server";

import "@xterm/xterm/css/xterm.css";

import dynamic from "next/dynamic";

import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
import { fullHeightWithoutHeaderAndFooter } from "~/constants";
import { createMetaTitle } from "~/metadata";
import { ClientSideTerminalComponent } from "./client";

export async function generateMetadata() {
const t = await getScopedI18n("management");
Expand All @@ -18,10 +17,6 @@ export async function generateMetadata() {
};
}

const ClientSideTerminalComponent = dynamic(() => import("./terminal"), {
ssr: false,
});

export default function LogsManagementPage() {
return (
<>
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/src/app/[locale]/manage/tools/logs/terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { clientApi } from "@homarr/api/client";

import classes from "./terminal.module.css";

export default function TerminalComponent() {
export const TerminalComponent = () => {
const ref = useRef<HTMLDivElement>(null);

const terminalRef = useRef<Terminal>();
Expand Down Expand Up @@ -54,4 +54,4 @@ export default function TerminalComponent() {
};
}, []);
return <Box ref={ref} id="terminal" className={classes.outerTerminal} h="100%"></Box>;
}
};

0 comments on commit 8c20553

Please sign in to comment.