Skip to content

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

fix(devices): rename this computer without a paired phone

skygunner9b881302c54e
diff --git a/src/components/settings/pages/DevicesPage.dom.test.ts b/src/components/settings/pages/DevicesPage.dom.test.ts
index a5081ca045..dbe1227c73 100644
--- a/src/components/settings/pages/DevicesPage.dom.test.ts
+++ b/src/components/settings/pages/DevicesPage.dom.test.ts
@@ -175,6 +175,27 @@ async function render(over: Partial<SettingsShell["ctx"]> = {}, shellOver: Parti
}
describe("the Devices page", () => {
+ it("shows the paired-phone computer name on this computer when Advanced is enabled", async () => {
+ session = { kind: "loopback", trust: "owner" };
+ companion = { ...companion, routes: { wifi: off, relay: off, tailscale: { on: true, since: NOW, name: "ada.tail1.ts.net", computers: true }, https: off }, tailnetShare: { on: true, origin: "https://ada.tail1.ts.net:8799", https: true, problem: null } };
+ vi.mocked(fetch).mockImplementation(async (input, init) => {
+ const path = new URL(String(input), "http://127.0.0.1").pathname;
+ requests.push(`${init?.method ?? "GET"} ${path} ${init?.body ?? ""}`);
+ if (path === "/api/auth/session") return Response.json(session);
+ if (path === "/api/config") return Response.json({ membership: { authority: "local", pairingCodes: true }, computerName: "garage" });
+ return Response.json({ sessions: [], current: null, pairings: [] });
+ });
+
+ await render({ here: true, advanced: true });
+
+ expect($<HTMLInputElement>("[data-computer-name] input")?.value).toBe("garage");
+ await act(async () => $<HTMLInputElement>("[data-computer-name] input")!.focus());
+ await type("[data-computer-name] input", "garage-voice");
+ await act(async () => $<HTMLInputElement>("[data-computer-name] input")!.blur());
+ await settle();
+ expect(requests).toContain('PATCH /api/config {"computerName":"garage-voice"}');
+ });
+
it("lists this computer first, then each group by what a person calls it, every row with its state in a mark and words", async () => {
await render();
expect($("[data-device-node=here]")?.textContent).toContain("This computer");
diff --git a/src/components/settings/pages/DevicesPage.tsx b/src/components/settings/pages/DevicesPage.tsx
index 1e6d5abd14..fda33571e1 100644
--- a/src/components/settings/pages/DevicesPage.tsx
+++ b/src/components/settings/pages/DevicesPage.tsx
@@ -329,7 +329,7 @@ export function DevicesPage() {
{mapShown && <DeviceMap devices={devices} mark={mark} network={network} loaded={loaded} onOpen={openRow} now={now} />}
<HereSection device={here} mark={mark} opened={opened} onAction={onAction} now={now} titled={!mapShown}
network={network && { network, line: blocked ?? (network.state === "ready" && !network.shared ? null : networkLine(network)), action: network.state === "ready" ? null : networkAction, secondary, share }} pending={ctx.here}
- more={!ctx.here && ctx.advanced && !ctx.cloud && access.pairingCodes === true && canPairDevices(access.session) ? <ComputerNameMore /> : null} />
+ more={ctx.advanced && !ctx.cloud && (ctx.here || access.pairingCodes === true) && canPairDevices(access.session) ? <ComputerNameMore /> : null} />
{groups.map((entry) => {
const phones = entry.group === "phones";
return <div key={entry.group} className="contents">