fix: explain TeamSpeak connection failures

This commit is contained in:
illusia committed 2026-09-10 16:11:18 +08:00
1 parent 06e5cc6d8b
commit aef1f68875
9 files changed
+234 -24

No files matched your search

+4 -2
View File
@@ -189,7 +189,7 @@ export class AdminService {
};
}
async testConnection(targetText: string, password: string, persistResult: boolean): Promise<{ ok: boolean; latencyMs: number; serverName: string | null; requiresPassword: boolean; packetLossPercent?: number; attempts?: number; successfulAttempts?: number; errorCode?: string }> {
async testConnection(targetText: string, password: string, persistResult: boolean): Promise<{ ok: boolean; checkType: "network" | "protocol"; passwordVerified: boolean; latencyMs: number; serverName: string | null; requiresPassword: boolean; packetLossPercent?: number; attempts?: number; successfulAttempts?: number; errorCode?: string }> {
let target: TeamSpeakTarget;
try {
target = parseTeamSpeakTarget(targetText);
@@ -205,6 +205,8 @@ export class AdminService {
const result = await pingTeamSpeakHost(target.host, { attempts: 4 });
const publicResult = {
ok: result.ok,
checkType: "network" as const,
passwordVerified: false,
latencyMs: result.latencyMs ?? 0,
serverName: null,
requiresPassword: false,
@@ -229,7 +231,7 @@ export class AdminService {
this.database.addAudit("CONNECTION_TEST_SUCCEEDED", { protocol: result.protocol, latencyMs: result.latencyMs });
}
const { protocol: _protocol, ...publicResult } = result;
return publicResult;
return { ...publicResult, checkType: "protocol", passwordVerified: true };
} catch (error: unknown) {
const probeError = error instanceof TeamSpeakProbeError
? error