feat: report live voice status and harden target handling

This commit is contained in:
illusia committed 2026-09-28 22:28:16 +08:00
1 parent e0d5916a86
commit 0a4fff6f6f
19 files changed
+1003 -101

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import assert from "node:assert/strict";
import test from "node:test";
import { isSafeOpenTargetForPrefill } from "./open-target-policy.js";
test("open-mode target prefill follows the same allow/deny result as the join policy", async () => {
assert.equal(await isSafeOpenTargetForPrefill({ host: "198.51.100.24", port: 9987 }, {
resolveTarget: async (target) => target,
}), true);
assert.equal(await isSafeOpenTargetForPrefill({ host: "teamspeak", port: 9987 }, {
resolveTarget: async () => { throw new Error("private or unresolved target"); },
}), false);
});
test("open-mode target prefill fails closed when DNS validation stalls", async () => {
const result = await isSafeOpenTargetForPrefill({ host: "internal.example", port: 9987 }, {
timeoutMs: 10,
resolveTarget: async () => new Promise(() => undefined),
});
assert.equal(result, false);
});