Skip to content

Commit

Permalink
deps: pilot nextjs 15, add more people to credits (#9)
Browse files Browse the repository at this point in the history
* deps: pilot nextjs 15
credits: add nextjs and rare

* Update next.config.mjs

* chore: seems good

---------

Co-authored-by: yosoof <160648427+yosoof3@users.noreply.github.com>
IncognitoTGT and yosoof3 authored May 24, 2024
1 parent 168b7f1 commit 37edef6
Showing 5 changed files with 955 additions and 630 deletions.
11 changes: 5 additions & 6 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import NextBundleAnalyzer from "@next/bundle-analyzer";
import { execSync } from "node:child_process";
const withBundleAnalyzer = NextBundleAnalyzer();
const withBundleAnalyzer = NextBundleAnalyzer({ enabled: process.env.ANALYZE === "true" });
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
@@ -19,9 +19,11 @@ const nextConfig = {
BUILD_DATE: Date.now().toString(),
},
experimental: {
ppr: true,
typedRoutes: true,
instrumentationHook: true,
webpackBuildWorker: true,
reactCompiler: true,
serverActions: {
allowedOrigins: ["localhost:3000", "*.use.devtunnels.ms"],
},
@@ -48,8 +50,5 @@ const nextConfig = {
return config;
},
};
let config = nextConfig;
if (process.env.ANALYZE) {
config = withBundleAnalyzer(nextConfig);
}
export default config;

export default withBundleAnalyzer(nextConfig);
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -36,20 +36,21 @@
"@tanstack/react-table": "^8.16.0",
"@types/dockerode": "^3.3.26",
"@types/ws": "^8.5.10",
"babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"consola": "^3.2.3",
"dockerode": "^4.0.2",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.30.4",
"lucide-react": "^0.358.0",
"next": "14.2.3",
"next": "15.0.0-rc.0",
"next-auth": "5.0.0-beta.18",
"next-themes": "^0.3.0",
"node-loader": "^2.0.0",
"postgres": "^3.4.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.0.0-rc-4c2e457c7c-20240522",
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
"server-only": "^0.0.1",
"sharp": "^0.33.3",
"sonner": "^1.4.41",
@@ -64,8 +65,8 @@
"@types/node": "^20.11.30",
"@types/novnc__novnc": "^1.3.5",
"@types/pg": "^8.11.4",
"@types/react": "^18.2.67",
"@types/react-dom": "^18.2.22",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.19",
"drizzle-kit": "^0.21.1",
"postcss": "^8.4.38",
1,466 changes: 893 additions & 573 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

91 changes: 46 additions & 45 deletions server.ts
Original file line number Diff line number Diff line change
@@ -2,14 +2,15 @@ import "dotenv/config";

import { createServer } from "node:http";
import { Socket } from "node:net";
import docker from "@/lib/docker";
import { consola } from "consola";
import next from "next";
import { WebSocketServer } from "ws";
import docker from "@/lib/docker";
const port = Number.parseInt(process.env.PORT as string) || 3000;
const dev = process.env.NODE_ENV !== "production";
if (process.argv.includes("--turbo")) {
process.env.TURBOPACK = "1";
process.env.TURBOPACK = "1";

}
const server = createServer();
const app = next({ dev, port, httpServer: server, hostname: process.env.HOSTNAME });
@@ -19,55 +20,55 @@ const nextRequest = app.getRequestHandler();
const nextUpgrade = app.getUpgradeHandler();
const websockify = new WebSocketServer({ noServer: true });
websockify.on("connection", async (ws, req) => {
try {
const id = req.url?.split("/")[2];
if (!id) {
ws.close(1008, "Missing ID");
return;
}
const container = docker.getContainer(id);
const ip = await container
.inspect()
.then((data) => data.NetworkSettings.Networks[data.HostConfig.NetworkMode as string].IPAddress);
const socket = new Socket();
socket.connect(5901, ip);
ws.on("message", (message: Uint8Array) => {
socket.write(message);
});
ws.on("close", (code, reason) => {
consola.info(
`✨ Stardust: Connection closed with code ${code} and ${reason ? `reason ${reason.toString()}` : "no reason"}`,
);
socket.end();
});
try {
const id = req.url?.split("/")[2];
if (!id) {
ws.close(1008, "Missing ID");
return;
}
const container = docker.getContainer(id);
const ip = await container
.inspect()
.then((data) => data.NetworkSettings.Networks[data.HostConfig.NetworkMode as string].IPAddress);
const socket = new Socket();
socket.connect(5901, ip);
ws.on("message", (message: Uint8Array) => {
socket.write(message);
});
ws.on("close", (code, reason) => {
consola.info(
`✨ Stardust: Connection closed with code ${code} and ${reason ? `reason ${reason.toString()}` : "no reason"}`,
);
socket.end()
});

socket.on("data", (data) => {
ws.send(data);
});
socket.on("data", (data) => {
ws.send(data);
});

socket.on("error", (err) => {
consola.warn(`✨ Stardust: ${err.message}`);
ws.close();
});
socket.on("error", (err) => {
consola.warn(`✨ Stardust: ${err.message}`);
ws.close();
});

socket.on("close", () => {
ws.close();
});
} catch (error) {
ws.close(1008, "Server error");
consola.error(`✨ Stardust: ${(error as Error).message}`);
}
socket.on("close", () => {
ws.close();
});
} catch (error) {
ws.close(1008, "Server error");
consola.error(`✨ Stardust: ${(error as Error).message}`);
}
});
server.on("request", nextRequest);
server.on("upgrade", async (req, socket, head) => {
if (req.url?.includes("websockify")) {
websockify.handleUpgrade(req, socket, head, (ws) => {
websockify.emit("connection", ws, req, websockify);
});
} else {
nextUpgrade(req, socket, head);
}
if (req.url?.includes("websockify")) {
websockify.handleUpgrade(req, socket, head, (ws) => {
websockify.emit("connection", ws, req, websockify);
});
} else {
nextUpgrade(req, socket, head);
}
});
server.listen(port, () => {
consola.success(`✨ Stardust: Server listening on ${port}`);
consola.success(`✨ Stardust: Server listening on ${port}`);
});
6 changes: 5 additions & 1 deletion src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -69,6 +69,10 @@ export default function Navigation({
},
];
const projectsUsed = [
{
name: "Next.js",
url: "https://nextjs.org/",
},
{
name: "noVNC",
url: "https://github.com/noVNC/noVNC",
@@ -78,7 +82,7 @@ export default function Navigation({
url: "https://ui.shadcn.com/",
},
];
const developers = ["incognitotgt", "yosoof3"];
const developers = ["incognitotgt", "yosoof3", "rare1k"];
return (
<nav className="flex h-16 min-w-full items-center justify-between bg-transparent px-4">
<div className="flex items-center justify-start gap-2">

0 comments on commit 37edef6

Please sign in to comment.