Compare commits
3
Commits
466458a664
...
20989987f6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20989987f6 | ||
|
|
9dc45f751a | ||
|
|
d3e3360d6e |
+6
-4
@@ -1,6 +1,5 @@
|
||||
import "./src/bootstrap/async-local-storage-polyfill";
|
||||
import { createServer } from "node:http";
|
||||
import { parse } from "node:url";
|
||||
import next from "next";
|
||||
import { WebSocketServer } from "ws";
|
||||
import { getConfig } from "./src/lib/config/load";
|
||||
@@ -24,17 +23,20 @@ const app = next({ dev, hostname, port });
|
||||
const handle = app.getRequestHandler();
|
||||
|
||||
app.prepare().then(() => {
|
||||
const nextUpgradeHandler = app.getUpgradeHandler();
|
||||
|
||||
const httpServer = createServer((req, res) => {
|
||||
handle(req, res, parse(req.url ?? "/", true));
|
||||
handle(req, res);
|
||||
});
|
||||
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
attachWsServer(wss);
|
||||
|
||||
httpServer.on("upgrade", (req, socket, head) => {
|
||||
const { pathname } = parse(req.url ?? "/");
|
||||
const { pathname } = new URL(req.url ?? "/", "http://internal");
|
||||
if (pathname !== "/ws/runs") {
|
||||
socket.destroy();
|
||||
// Anything else (e.g. Next's own dev-mode HMR websocket at /_next/hmr) is Next's to handle.
|
||||
nextUpgradeHandler(req, socket, head).catch(() => socket.destroy());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export default function RootLayout({
|
||||
lang="en"
|
||||
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
||||
>
|
||||
<body className="bg-background text-foreground flex min-h-full flex-col">
|
||||
<body className="bg-background text-foreground flex min-h-full flex-col" suppressHydrationWarning>
|
||||
<TooltipProvider>
|
||||
{children}
|
||||
<Toaster />
|
||||
|
||||
Reference in New Issue
Block a user