fix: preserve invites on nickname lookup failure

This commit is contained in:
illusia committed 2026-10-09 00:26:21 +08:00
1 parent 75893339c5
commit efa0b85a0e
4 files changed
+45 -2

No files matched your search

+11 -2
View File
@@ -183,14 +183,14 @@ export function createWebServer(options: WebServerOptions): WebServer {
}
const policy = options.adminService.getConnectionPolicy();
const managedInvite = inviteToken ? options.adminService.consumeManagedInvite(inviteToken) : null;
const managedInvite = inviteToken ? options.adminService.getManagedInvite(inviteToken) : null;
if (inviteToken && !managedInvite) {
response.status(400).json({ ok: false, code: "INVITE_INVALID" });
return;
}
let targetText = managedInvite?.target ?? policy.defaultTarget;
let target: TeamSpeakTarget;
let serverPassword = managedInvite?.serverPassword ?? policy.serverPassword;
let serverPassword = policy.serverPassword;
const channel = requestedChannel || managedInvite?.channel || "";
const requestedRelayId = typeof body.accelerationRelayId === "string" ? body.accelerationRelayId.trim().slice(0, 110) : "";
const accelerationRequested = body.accelerated === true || Boolean(requestedRelayId);
@@ -226,6 +226,15 @@ export function createWebServer(options: WebServerOptions): WebServer {
return;
}
if (inviteToken) {
const consumedInvite = options.adminService.consumeManagedInvite(inviteToken);
if (!consumedInvite) {
response.status(400).json({ ok: false, code: "INVITE_INVALID" });
return;
}
serverPassword = consumedInvite.serverPassword;
}
const ticket = options.voiceBridgeOptions.joinTickets.create({
target,
serverPassword,