From a1106fd50c4e9cec80de162b8ddecfcf93ce4902 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Thu, 19 Feb 2026 12:28:33 -0600 Subject: [PATCH] chore(tlon): remove unused http-api.ts After restoring SSRF protection, probeAccount uses UrbitChannelClient instead of @urbit/http-api. The http-api.ts wrapper is no longer needed. --- extensions/tlon/src/channel.ts | 1 - extensions/tlon/src/urbit/http-api.ts | 38 --------------------------- 2 files changed, 39 deletions(-) delete mode 100644 extensions/tlon/src/urbit/http-api.ts diff --git a/extensions/tlon/src/channel.ts b/extensions/tlon/src/channel.ts index d7bced25c6d..c431e2b6621 100644 --- a/extensions/tlon/src/channel.ts +++ b/extensions/tlon/src/channel.ts @@ -19,7 +19,6 @@ import { resolveTlonAccount, listTlonAccountIds } from "./types.js"; import { authenticate } from "./urbit/auth.js"; import { UrbitChannelClient } from "./urbit/channel-client.js"; import { ssrfPolicyFromAllowPrivateNetwork } from "./urbit/context.js"; -import { ensureUrbitConnectPatched, Urbit } from "./urbit/http-api.js"; import { buildMediaStory, sendDm, diff --git a/extensions/tlon/src/urbit/http-api.ts b/extensions/tlon/src/urbit/http-api.ts deleted file mode 100644 index 13edb97b805..00000000000 --- a/extensions/tlon/src/urbit/http-api.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Urbit } from "@urbit/http-api"; - -let patched = false; - -export function ensureUrbitConnectPatched() { - if (patched) { - return; - } - patched = true; - Urbit.prototype.connect = async function patchedConnect() { - const resp = await fetch(`${this.url}/~/login`, { - method: "POST", - body: `password=${this.code}`, - credentials: "include", - }); - - if (resp.status >= 400) { - throw new Error(`Login failed with status ${resp.status}`); - } - - const cookie = resp.headers.get("set-cookie"); - if (cookie) { - const match = /urbauth-~([\w-]+)/.exec(cookie); - if (match) { - if (!(this as unknown as { ship?: string | null }).ship) { - (this as unknown as { ship?: string | null }).ship = match[1]; - } - (this as unknown as { nodeId?: string }).nodeId = match[1]; - } - (this as unknown as { cookie?: string }).cookie = cookie; - } - - await (this as typeof Urbit.prototype).getShipName(); - await (this as typeof Urbit.prototype).getOurName(); - }; -} - -export { Urbit };