Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
fix(cloud): let Linux and Windows desktop apps sign in
leepokaia82351158f2b
diff --git a/cloud/migrations/0003_desktop_devices.sql b/cloud/migrations/0003_desktop_devices.sqlnew file mode 100644index 00000000..fa809378--- /dev/null+++ b/cloud/migrations/0003_desktop_devices.sql@@ -0,0 +1,55 @@+-- Desktop apps on Linux and Windows sign in too: devices.platform also takes 'linux' and+-- 'windows'. As in 0002, the table is rebuilt together with the tables that reference it+-- (access_requests, grants), children first, so no referencing row is ever orphaned.++CREATE TABLE devices_new (+ id TEXT PRIMARY KEY, -- dev_…+ owner_user_id TEXT NOT NULL REFERENCES accounts(user_id),+ sign_pub TEXT NOT NULL,+ name TEXT NOT NULL,+ platform TEXT NOT NULL CHECK (platform IN ('ios','macos','linux','windows')),+ created_at INTEGER NOT NULL,+ last_used_at INTEGER,+ revoked_at INTEGER,+ UNIQUE (owner_user_id, sign_pub)+);+INSERT INTO devices_new SELECT * FROM devices;++CREATE TABLE access_requests_new (+ id TEXT PRIMARY KEY, -- req_…+ computer_id TEXT NOT NULL REFERENCES computers(id),+ device_id TEXT NOT NULL REFERENCES devices_new(id),+ user_id TEXT NOT NULL REFERENCES accounts(user_id),+ status TEXT NOT NULL CHECK (status IN ('pending','approved','denied','expired','cancelled')),+ commit_hash TEXT NOT NULL, -- SHA-256("codync/sascommit/v1" ‖ dk ‖ nD)+ host_nonce TEXT, -- nH,host 設一次+ device_nonce TEXT, -- nD,host_nonce 存在後裝置才可設+ created_at INTEGER NOT NULL,+ expires_at INTEGER NOT NULL, -- created_at + 10 min+ decided_at INTEGER,+ grant_id TEXT+);+INSERT INTO access_requests_new SELECT * FROM access_requests;++CREATE TABLE grants_new (+ id TEXT PRIMARY KEY, -- grt_…+ computer_id TEXT NOT NULL REFERENCES computers(id),+ device_id TEXT NOT NULL REFERENCES devices_new(id),+ scopes TEXT NOT NULL, -- JSON array+ status TEXT NOT NULL CHECK (status IN ('active','revoked')),+ created_at INTEGER NOT NULL,+ revoked_at INTEGER,+ revoked_reason TEXT -- owner|deviceRevoked|unclaimed|accountDeleted+);+INSERT INTO grants_new SELECT * FROM grants;++DROP TABLE access_requests;+DROP TABLE grants;+DROP TABLE devices;+ALTER TABLE devices_new RENAME TO devices;+ALTER TABLE access_requests_new RENAME TO access_requests;+ALTER TABLE grants_new RENAME TO grants;++CREATE INDEX access_requests_computer ON access_requests(computer_id, status);+CREATE UNIQUE INDEX access_requests_one_pending ON access_requests(computer_id, device_id) WHERE status = 'pending';+CREATE UNIQUE INDEX grants_active ON grants(computer_id, device_id) WHERE status = 'active';diff --git a/cloud/src/routes/account.ts b/cloud/src/routes/account.tsindex b1fde809..b30557e3 100644--- a/cloud/src/routes/account.ts+++ b/cloud/src/routes/account.ts@@ -58,7 +58,7 @@ export async function registerDevice(c: Ctx) {const s = await signed(c);const b = body(c);const name = str(b, "name");- const platform = oneOf(b, "platform", ["ios", "macos"] as const);+ const platform = oneOf(b, "platform", ["ios", "macos", "linux", "windows"] as const);const existing = await c.env.DB.prepare("SELECT * FROM devices WHERE owner_user_id = ? AND sign_pub = ?").bind(u.userId, s.kid).first<DeviceRow>();diff --git a/cloud/test/api.test.ts b/cloud/test/api.test.tsindex bcdd4fd9..ef984eda 100644--- a/cloud/test/api.test.ts+++ b/cloud/test/api.test.ts@@ -217,6 +217,15 @@ describe("devices", () => {expect(revoked.status).toBe(403);});+ it("registers the desktop app on every platform, and no unknown one", async () => {+ const u = await newUser();+ for (const platform of ["macos", "linux", "windows"]) {+ const r = await call("POST", "/v1/devices", { token: u.token, key: ref.signKey(), body: { name: "Desktop", platform } });+ expect(r.status, platform).toBe(200);+ }+ expect((await call("POST", "/v1/devices", { token: u.token, key: ref.signKey(), body: { name: "x", platform: "beos" } })).status).toBe(400);+ });+it("requires the device key's signature", async () => {const userId = uid("nosig");const r = await call("POST", "/v1/devices", { token: await clerkToken(userId), body: { name: "x", platform: "ios" } });