Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

companion: a restricted device's descriptor says routes local

milind-sonic459638cc8d9
diff --git a/companion/src/e2e/registry.ts b/companion/src/e2e/registry.ts
index c12e802a24..369177a344 100644
--- a/companion/src/e2e/registry.ts
+++ b/companion/src/e2e/registry.ts
@@ -108,8 +108,7 @@ export class E2ERegistry {
descriptor(deviceId: string | null): E2EDescriptor | null {
if (!this.#key) return null;
const device = deviceId ? this.#devices.records().find((candidate) => candidate.id === deviceId) : null;
- const relay = this.#relay && device?.routes !== "local" ? this.#relay : undefined;
- return descriptorFor(this.#key.publicKey, relay);
+ return descriptorFor(this.#key.publicKey, this.#relay ?? undefined, device?.routes === "local" ? "local" : undefined);
}
/** One WebSocket that just opened, on a direct route or a relay data socket. Null when refused. */
diff --git a/companion/test/e2e/sidecar.test.ts b/companion/test/e2e/sidecar.test.ts
index db8973d238..bbf7134a99 100644
--- a/companion/test/e2e/sidecar.test.ts
+++ b/companion/test/e2e/sidecar.test.ts
@@ -309,7 +309,7 @@ describe("the sidecar's end-to-end connection", () => {
await expect(viaRelay(state, deviceToken)).rejects.toEqual(new SessionClosed(4404));
const session = await direct(state, deviceToken);
const endpoints = json(await http(session, "GET", "/api/companion/endpoints", { token: deviceToken }));
- expect(endpoints.e2e).toEqual({ v: 1, k: state.e2e.descriptor!.k });
+ expect(endpoints.e2e).toEqual({ v: 1, k: state.e2e.descriptor!.k, routes: "local" });
session.shutdown();
await control("PUT", `/devices/${deviceId}/routes`, { routes: "any" });
await waitFor(() => relay.admitted(hid).has(adm));