Rename Server to GatewayServer/WebrtcServer

This commit is contained in:
Rory&
2026-07-29 01:59:56 +02:00
parent fda2bdd2e1
commit 0be7c4322e
5 changed files with 13 additions and 12 deletions
+6 -6
View File
@@ -22,12 +22,12 @@ import cluster from "node:cluster";
import morgan from "morgan";
import express from "express";
import { green, bold } from "picocolors";
import * as Api from "@spacebar/api";
import { SpacebarServer } from "@spacebar/api";
import { CDNServer } from "@spacebar/cdn";
import { initDatabase } from "@spacebar/database";
import * as Gateway from "@spacebar/gateway";
import { GatewayServer } from "@spacebar/gateway";
import { Config } from "@spacebar/util";
import * as Webrtc from "@spacebar/webrtc";
import { WebrtcServer } from "@spacebar/webrtc";
import { ProcessLifecycle } from "../util/util/ProcessLifecycle";
import { Monitoring } from "../util/monitoring/Monitoring";
@@ -38,10 +38,10 @@ const wrtcWsPort = Number(process.env.WRTC_WS_PORT) || 3004;
const production = process.env.NODE_ENV == "development" ? false : true;
server.on("request", app);
const api = new Api.SpacebarServer({ server, port, production, app });
const api = new SpacebarServer({ server, port, production, app });
const cdn = new CDNServer({ server, port, production, app });
const gateway = new Gateway.Server({ server, port, production });
const webrtc = new Webrtc.Server({
const gateway = new GatewayServer({ server, port, production });
const webrtc = new WebrtcServer({
server: undefined,
port: wrtcWsPort,
production,
+2 -1
View File
@@ -27,7 +27,7 @@ import { Monitoring } from "../util/monitoring/Monitoring";
import { Connection, openConnections } from "./events/Connection";
import { cleanupOnStartup } from "./util";
export class Server {
export class GatewayServer {
public ws: ws.Server;
public port: number;
public server: http.Server;
@@ -64,6 +64,7 @@ export class Server {
}
}, 1000);
this.server = http.createServer();
this.server = http.createServer(async (req, res) => {
if (!req.headers.cookie?.split("; ").find((x) => x.startsWith("__sb_sessid="))) {
res.setHeader(
+2 -2
View File
@@ -24,14 +24,14 @@ moduleAlias(__dirname + "../../../package.json");
import { config } from "dotenv";
config({ quiet: true });
import { Server } from "./Server";
import { GatewayServer } from "./Server";
import fs from "node:fs";
import cluster from "node:cluster";
let port = Number(process.env.PORT);
if (isNaN(port)) port = 3002;
const server = new Server({
const server = new GatewayServer({
port,
});
+1 -1
View File
@@ -26,7 +26,7 @@ import { Monitoring } from "../util/monitoring/Monitoring";
import { Connection } from "./events/Connection";
import { loadWebRtcLibrary, mediaServer, WRTC_PORT_MAX, WRTC_PORT_MIN, WRTC_PUBLIC_IP } from "./util";
export class Server {
export class WebrtcServer {
public ws: ws.Server;
public port: number;
public server: http.Server;
+2 -2
View File
@@ -26,11 +26,11 @@ config({ quiet: true });
import fs from "node:fs";
import cluster from "node:cluster";
import { Server } from "./Server";
import { WebrtcServer } from "./Server";
const port = Number(process.env.PORT) || 3004;
const server = new Server({
const server = new WebrtcServer({
port,
});