diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index e18ecad2..8ebe1a8e 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
- <data-source source="LOCAL" name="spacebar@localhost" uuid="61e66448-285a-4205-a1d7-c2704d5afb2c">
+ <data-source source="LOCAL" name="sb-testing@localhost" uuid="61e66448-285a-4205-a1d7-c2704d5afb2c">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
diff --git a/.idea/runConfigurations/Start_separated.xml b/.idea/runConfigurations/Start_separated.xml
index 89715363..660c03a1 100644
--- a/.idea/runConfigurations/Start_separated.xml
+++ b/.idea/runConfigurations/Start_separated.xml
@@ -3,6 +3,7 @@
<toRun name="Start API" type="js.build_tools.npm" />
<toRun name="Start CDN" type="js.build_tools.npm" />
<toRun name="Start Gateway" type="js.build_tools.npm" />
+ <toRun name="Start WebRTC" type="js.build_tools.npm" />
<method v="2" />
</configuration>
</component>
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f2c77cea..5038192a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -65,64 +65,54 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
- <component name="PropertiesComponent">{
- "keyToString": {
- "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
- "NIXITCH_NIX_CONF_DIR": "",
- "NIXITCH_NIX_OTHER_STORES": "",
- "NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
- "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
- "NIXITCH_NIX_REMOTE": "",
- "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
- "Node.js.Server.ts.executor": "Debug",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.git.unshallow": "true",
- "RunOnceActivity.typescript.service.memoryLimit.init": "true",
- "git-widget-placeholder": "master",
- "javascript.nodejs.core.library.configured.version": "24.11.1",
- "javascript.nodejs.core.library.typings.version": "24.10.9",
- "last_opened_file_path": "/home/Rory/git/spacebar/server-master/nix/modules/default",
- "node.js.detected.package.eslint": "true",
- "node.js.detected.package.standard": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.standard": "",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_interpreter_path": "node",
- "nodejs_package_manager_path": "npm",
- "npm.Start API.executor": "Run",
- "npm.Start CDN.executor": "Run",
- "npm.Start Gateway.executor": "Run",
- "npm.build.executor": "Run",
- "npm.build:src.executor": "Run",
- "npm.build:src:tsgo.executor": "Run",
- "npm.build:tsgo.executor": "Run",
- "npm.start.executor": "Debug",
- "prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server-master/node_modules/prettier",
- "ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
+ <component name="PropertiesComponent"><![CDATA[{
+ "keyToString": {
+ "NIXITCH_NIXPKGS_CONFIG": "/etc/nix/nixpkgs-config.nix",
+ "NIXITCH_NIX_CONF_DIR": "",
+ "NIXITCH_NIX_OTHER_STORES": "",
+ "NIXITCH_NIX_PATH": "/home/Rory/.nix-defexpr/channels:nixpkgs=/nix/store/wb6agba4kfsxpbnb5hzlq58vkjzvbsk6-source",
+ "NIXITCH_NIX_PROFILES": "/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/Rory /home/Rory/.local/state/nix/profile /nix/profile /home/Rory/.nix-profile",
+ "NIXITCH_NIX_REMOTE": "",
+ "NIXITCH_NIX_USER_PROFILE_DIR": "/nix/var/nix/profiles/per-user/Rory",
+ "Node.js.Server.ts.executor": "Debug",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.git.unshallow": "true",
+ "RunOnceActivity.typescript.service.memoryLimit.init": "true",
+ "git-widget-placeholder": "master",
+ "javascript.nodejs.core.library.configured.version": "24.11.1",
+ "javascript.nodejs.core.library.typings.version": "24.11.2",
+ "last_opened_file_path": "/home/Rory/git/spacebar/server-master/nix/modules/default",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.standard": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.standard": "",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_interpreter_path": "node",
+ "nodejs_package_manager_path": "npm",
+ "npm.Start API.executor": "Run",
+ "npm.Start CDN.executor": "Run",
+ "npm.Start Gateway.executor": "Run",
+ "npm.Start WebRTC.executor": "Run",
+ "npm.build.executor": "Run",
+ "npm.build:src.executor": "Run",
+ "npm.build:src:tsgo.executor": "Run",
+ "npm.build:tsgo.executor": "Run",
+ "npm.start.executor": "Debug",
+ "prettierjs.PrettierConfiguration.Package": "/home/Rory/git/spacebar/server-master/node_modules/prettier",
+ "settings.editor.selected.configurable": "com.maddyhome.idea.vim.ui.VimEmulationConfigurable",
+ "ts.external.directory.path": "/home/Rory/git/spacebar/server-master/node_modules/typescript/lib"
},
- "keyToStringList": {
- "DatabaseDriversLRU": [
- "postgresql"
+ "keyToStringList": {
+ "DatabaseDriversLRU": [
+ "postgresql"
],
- "GitStage.ChangesTree.GroupingKeys": [
- "directory",
- "module",
- "repository"
+ "GitStage.ChangesTree.GroupingKeys": [
+ "directory",
+ "module",
+ "repository"
]
}
-}</component>
- <component name="QodanaHighlightedReportService">
- <option name="localRunNotPublishedPersistedInfo">
- <LocalReportPersistedInfo>
- <option name="path" value="/tmp/qodana_output1/qodana.sarif.json" />
- <option name="reportGuid" value="ffc75f9a-8af2-4039-9caf-5031bc73d78a" />
- <option name="reportName" value="server-master/qodana/2026-03-14" />
- </LocalReportPersistedInfo>
- </option>
- </component>
- <component name="QodanaIsSelectedPersistenceService">
- <option name="selectedOrLoading" value="true" />
- </component>
+}]]></component>
<component name="QodanaReportsService">
<option name="descriptions">
<ReportDescription localRun="true" path="/tmp/qodana_output/qodana.sarif.json" reportGuid="23b693fa-9bcf-42d2-b172-3372ba9c21ff" reportId="server-master/qodana/2026-03-14" />
@@ -159,26 +149,30 @@
<entry key="Start API" value="STOPPED" />
<entry key="Start CDN" value="STOPPED" />
<entry key="Start Gateway" value="STOPPED" />
+ <entry key="Start WebRTC" value="STOPPED" />
<entry key="Start bundle" value="STOPPED" />
+ <entry key="build:src:tsgo" value="STOPPED" />
+ <entry key="build:tsgo" value="STOPPED" />
</map>
</value>
</entry>
</map>
</option>
</component>
- <component name="RunManager" selected="npm.Start API">
+ <component name="RunManager" selected="Compound.Start separated">
<list>
<item itemvalue="Compound.Start separated" />
<item itemvalue="npm.Start API" />
<item itemvalue="npm.Start CDN" />
<item itemvalue="npm.Start Gateway" />
+ <item itemvalue="npm.Start WebRTC" />
<item itemvalue="npm.Start bundle" />
</list>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
- <option value="bundled-js-predefined-d6986cc7102b-9b0f141eb926-JavaScript-WS-253.30387.83" />
+ <option value="bundled-js-predefined-d6986cc7102b-31caf2ab9e3c-JavaScript-WS-261.24374.125" />
</set>
</attachedChunks>
</component>
@@ -223,6 +217,7 @@
<workItem from="1772830175841" duration="4576000" />
<workItem from="1772918744394" duration="70646000" />
<workItem from="1773448797192" duration="8146000" />
+ <workItem from="1780499674298" duration="54973000" />
</task>
<servers />
</component>
diff --git a/src/api/middlewares/ErrorHandler.ts b/src/api/middlewares/ErrorHandler.ts
index 7b85d5e1..2d17f1a2 100644
--- a/src/api/middlewares/ErrorHandler.ts
+++ b/src/api/middlewares/ErrorHandler.ts
@@ -31,6 +31,8 @@ export function ErrorHandler(error: Error & { type?: string }, req: Request, res
let errors = undefined;
let _ajvErrors = undefined;
+ if (process.env.LOG_API_ERRORS === "true") console.error("[ErrorHandler] Uncaught exception:", error);
+
if (error instanceof HTTPError && error.code) code = httpcode = error.code;
else if (error instanceof ApiError) {
code = error.code;
diff --git a/src/util/monitoring/Monitoring.ts b/src/util/monitoring/Monitoring.ts
index 55790122..0d734e82 100644
--- a/src/util/monitoring/Monitoring.ts
+++ b/src/util/monitoring/Monitoring.ts
@@ -18,7 +18,7 @@
import { IncomingMessage, ServerResponse } from "node:http";
import * as client from "prom-client";
-import { Application, Router } from "express";
+import { Application } from "express";
import { Metric } from "prom-client";
export class Monitoring {
diff --git a/src/webrtc/opcodes/Identify.ts b/src/webrtc/opcodes/Identify.ts
index e62fc7af..5068e42b 100644
--- a/src/webrtc/opcodes/Identify.ts
+++ b/src/webrtc/opcodes/Identify.ts
@@ -79,7 +79,11 @@ export async function onIdentify(this: WebRtcWebSocket, data: VoicePayload) {
this.type = type;
const voiceRoomId = type === "stream" ? server_id : voiceState!.channel_id;
- this.webRtcClient = await mediaServer.join(voiceRoomId, this.user_id, this, type!);
+ try {
+ this.webRtcClient = await mediaServer.join(voiceRoomId, this.user_id, this, type!);
+ } catch (e) {
+ return this.close(4013);
+ }
this.on("close", () => {
// ice-lite media server relies on this to know when the peer went away
|