Loading cli/webfinger.ts +2 −2 Original line number Diff line number Diff line import { Command } from "@cliffy/command"; import { convertFediverseHandle } from "@fedify/fedify/vocab"; import { toAcctUrl } from "@fedify/fedify/vocab"; import { lookupWebFinger } from "@fedify/fedify/webfinger"; import ora from "ora"; import { printJson } from "./utils.ts"; Loading Loading @@ -102,6 +102,6 @@ class NotFoundError extends Error { * ``` */ function convertHandleToUrl(handle: string): URL { return convertFediverseHandle(handle) ?? // Convert the handle to a URL return toAcctUrl(handle) ?? // Convert the handle to a URL new InvalidHandleError(handle).throw(); // or throw an error if invalid } fedify/vocab/handle.ts +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ export function isFediverseHandle( * console.log(identifier?.href); // "acct:username@example.com" * ``` */ export function convertFediverseHandle(handle: string): URL | null { export function toAcctUrl(handle: string): URL | null { const parsed = parseFediverseHandle(handle); if (!parsed) return null; const identifier = new URL(`acct:${parsed.username}@${parsed.host}`); Loading fedify/vocab/lookup.ts +2 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { type GetUserAgentOptions, } from "../runtime/docloader.ts"; import { lookupWebFinger } from "../webfinger/lookup.ts"; import { convertFediverseHandle } from "./handle.ts"; import { toAcctUrl } from "./handle.ts"; import { getTypeId } from "./type.ts"; import { type Collection, type Link, Object } from "./vocab.ts"; Loading Loading @@ -128,7 +128,7 @@ async function lookupObjectInternal( const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent }); if (typeof identifier === "string") { identifier = convertFediverseHandle(identifier) ?? new URL(identifier); identifier = toAcctUrl(identifier) ?? new URL(identifier); } let document: unknown | null = null; if (identifier.protocol === "http:" || identifier.protocol === "https:") { Loading Loading
cli/webfinger.ts +2 −2 Original line number Diff line number Diff line import { Command } from "@cliffy/command"; import { convertFediverseHandle } from "@fedify/fedify/vocab"; import { toAcctUrl } from "@fedify/fedify/vocab"; import { lookupWebFinger } from "@fedify/fedify/webfinger"; import ora from "ora"; import { printJson } from "./utils.ts"; Loading Loading @@ -102,6 +102,6 @@ class NotFoundError extends Error { * ``` */ function convertHandleToUrl(handle: string): URL { return convertFediverseHandle(handle) ?? // Convert the handle to a URL return toAcctUrl(handle) ?? // Convert the handle to a URL new InvalidHandleError(handle).throw(); // or throw an error if invalid }
fedify/vocab/handle.ts +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ export function isFediverseHandle( * console.log(identifier?.href); // "acct:username@example.com" * ``` */ export function convertFediverseHandle(handle: string): URL | null { export function toAcctUrl(handle: string): URL | null { const parsed = parseFediverseHandle(handle); if (!parsed) return null; const identifier = new URL(`acct:${parsed.username}@${parsed.host}`); Loading
fedify/vocab/lookup.ts +2 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ import { type GetUserAgentOptions, } from "../runtime/docloader.ts"; import { lookupWebFinger } from "../webfinger/lookup.ts"; import { convertFediverseHandle } from "./handle.ts"; import { toAcctUrl } from "./handle.ts"; import { getTypeId } from "./type.ts"; import { type Collection, type Link, Object } from "./vocab.ts"; Loading Loading @@ -128,7 +128,7 @@ async function lookupObjectInternal( const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent }); if (typeof identifier === "string") { identifier = convertFediverseHandle(identifier) ?? new URL(identifier); identifier = toAcctUrl(identifier) ?? new URL(identifier); } let document: unknown | null = null; if (identifier.protocol === "http:" || identifier.protocol === "https:") { Loading