fix: wevbsocket url is always localhost (#1072)
This commit is contained in:
@@ -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) {
|
||||
|
||||
10
apps/nextjs/src/app/[locale]/manage/tools/logs/client.tsx
Normal file
10
apps/nextjs/src/app/[locale]/manage/tools/logs/client.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
export const ClientSideTerminalComponent = dynamic(
|
||||
() => import("./terminal").then(({ TerminalComponent }) => TerminalComponent),
|
||||
{
|
||||
ssr: false,
|
||||
},
|
||||
);
|
||||
@@ -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");
|
||||
@@ -18,10 +17,6 @@ export async function generateMetadata() {
|
||||
};
|
||||
}
|
||||
|
||||
const ClientSideTerminalComponent = dynamic(() => import("./terminal"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export default function LogsManagementPage() {
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -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>();
|
||||
@@ -54,4 +54,4 @@ export default function TerminalComponent() {
|
||||
};
|
||||
}, []);
|
||||
return <Box ref={ref} id="terminal" className={classes.outerTerminal} h="100%"></Box>;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user