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";
|
import { clientApi } from "@homarr/api/client";
|
||||||
|
|
||||||
const wsClient = createWSClient({
|
const wsClient = createWSClient({
|
||||||
url: "ws://localhost:3001",
|
url: typeof window === "undefined" ? "ws://localhost:3001" : `ws://${window.location.hostname}:3001`,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function TRPCReactProvider(props: PropsWithChildren) {
|
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 "@xterm/xterm/css/xterm.css";
|
||||||
|
|
||||||
import dynamic from "next/dynamic";
|
|
||||||
|
|
||||||
import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
|
import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
|
||||||
import { fullHeightWithoutHeaderAndFooter } from "~/constants";
|
import { fullHeightWithoutHeaderAndFooter } from "~/constants";
|
||||||
import { createMetaTitle } from "~/metadata";
|
import { createMetaTitle } from "~/metadata";
|
||||||
|
import { ClientSideTerminalComponent } from "./client";
|
||||||
|
|
||||||
export async function generateMetadata() {
|
export async function generateMetadata() {
|
||||||
const t = await getScopedI18n("management");
|
const t = await getScopedI18n("management");
|
||||||
@@ -18,10 +17,6 @@ export async function generateMetadata() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const ClientSideTerminalComponent = dynamic(() => import("./terminal"), {
|
|
||||||
ssr: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default function LogsManagementPage() {
|
export default function LogsManagementPage() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { clientApi } from "@homarr/api/client";
|
|||||||
|
|
||||||
import classes from "./terminal.module.css";
|
import classes from "./terminal.module.css";
|
||||||
|
|
||||||
export default function TerminalComponent() {
|
export const TerminalComponent = () => {
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const terminalRef = useRef<Terminal>();
|
const terminalRef = useRef<Terminal>();
|
||||||
@@ -54,4 +54,4 @@ export default function TerminalComponent() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
return <Box ref={ref} id="terminal" className={classes.outerTerminal} h="100%"></Box>;
|
return <Box ref={ref} id="terminal" className={classes.outerTerminal} h="100%"></Box>;
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user