1 files changed, 5 insertions, 0 deletions
diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts
index 269cc2ed..5d7f8d87 100644
--- a/src/gateway/Server.ts
+++ b/src/gateway/Server.ts
@@ -28,6 +28,7 @@ import ws from "ws";
import { Connection } from "./events/Connection";
import http from "http";
import { cleanupOnStartup } from "./util/Utils";
+import { randomString } from "@spacebar/api";
export class Server {
public ws: ws.Server;
@@ -50,6 +51,10 @@ export class Server {
if (server) this.server = server;
else {
this.server = http.createServer(function (req, res) {
+ if(!req.headers.cookie?.split("; ").find(x => x.startsWith("__sb_sessid="))) {
+ res.setHeader("Set-Cookie", `__sb_sessid=${randomString(32)}; Secure; HttpOnly; SameSite=None`);
+ }
+
res.writeHead(200).end("Online");
});
}
|