mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 12:02:50 +08:00
fix: preserve invites on nickname lookup failure
This commit is contained in:
1 parent
75893339c5
commit
efa0b85a0e
4 files changed
+45
-2
No files matched your search
+11
-2
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user