Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(desktop): Settings → Servers can look up and connect to a server (#4846)
Bugfixer 274b77afb2870
diff --git a/electron/cloud-rail.mjs b/electron/cloud-rail.mjsindex b81bdd6b39..156b25e4a5 100644--- a/electron/cloud-rail.mjs+++ b/electron/cloud-rail.mjs@@ -232,13 +232,14 @@ export function installCloudRail({ ipcMain, guard, trusted, lists = trusted, bes});listed("workspaces:local-remove", (_event, id) => local.remove(profileListed(id)));// The Connect sheet's address (a link, or an address with the code typed apart): main finds the server there first,- // then connects only to what it found.- listed("workspaces:add", (_event, choice, link, code) => {+ // then connects only to what it found. The sheet runs on the rail's page and in Settings → Servers on this computer's+ // own page (#4846), so both channels take a page main vouches for, not only the rail's.+ handle("workspaces:add", (_event, choice, link, code) => {if (!CHOICES.includes(choice) || !add.choices()[choice]) throw new Error(t("native.places.cannotAdd"));const pasted = choice === "link" ? plain(link).trim().slice(0, 4096) : "";return pasted ? add.run(choice, pasted, typeof code === "string" ? code.trim().slice(0, 256) : null) : add.run(choice);});- listed("workspaces:probe", (_event, address, code) => {+ handle("workspaces:probe", (_event, address, code) => {if (!add.choices().link || !add.probe) throw new Error(t("native.places.cannotAdd"));return add.probe(plain(address).trim().slice(0, 4096), plain(code).trim().slice(0, 256));});diff --git a/electron/cloud-rail.node-test.mjs b/electron/cloud-rail.node-test.mjsindex 2fe751e3f5..6ab722c05b 100644--- a/electron/cloud-rail.node-test.mjs+++ b/electron/cloud-rail.node-test.mjs@@ -131,7 +131,6 @@ test("the rail's channels: the list only for the rail's own page, a circle onlyr.w.beside = false;assert.deepEqual(await r.call("workspaces:places"), { places: [], add: { cloud: false, link: false, address: false, organization: false } });assert.throws(() => r.call("workspaces:open", "a"), /only available/);- assert.throws(() => r.call("workspaces:add", "link"), /only available/);assert.equal(typeof await r.call("cloud-add:state"), "object", "+'s buying sheet still runs on a page main vouches for (this computer's own)");r.w.lists = true;r.call("workspaces:open", "a");@@ -155,6 +154,19 @@ test("the rail's channels: the list only for the rail's own page, a circle onlyassert.deepEqual(r.sent.slice(2), ["page:workspaces:changed", "rail:workspaces:changed"], "the rail came beside the page (or went): the page reads it again");});+test("Settings → Servers on this computer's own page looks a server up and connects to it; a page main doesn't vouch for can't (#4846)", () => {+ const r = rail();+ r.w.lists = false;+ r.call("workspaces:probe", " 192.168.1.20:8799 ", " abcd-efgh-jklm ");+ r.call("workspaces:add", "link", "192.168.1.20:8799", " abcd-efgh-jklm ");+ assert.deepEqual(r.ran, [["probe", "192.168.1.20:8799", "abcd-efgh-jklm"], ["link", "192.168.1.20:8799", "abcd-efgh-jklm"]],+ "the Connect sheet in Settings → Servers runs in the main window, beside the rail, not on it");+ r.w.trusted = false;+ assert.throws(() => r.call("workspaces:probe", "192.168.1.20:8799", "x"), /only available/, "a server's own page can't make main look anywhere up");+ assert.throws(() => r.call("workspaces:add", "link", "192.168.1.20:8799", "x"), /only available/);+ assert.equal(r.ran.length, 2);+});+test("buying another Cloud from a page: the plan must be on sale, the name is checked, and the page gets only what the sheet says", async () => {const r = rail();await assert.rejects(r.call("cloud-add:start", "max", "Client B", "rose"), /Choose a plan/);