mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 08:52:21 +00:00
* fix(og): render org profile images in publisher OG cards Pass publisher avatar, kind, and installs into OG meta URLs and allow safely fetching public HTTPS org logos when generating profile images. * fix: render org profile images in publisher OG cards Org logos use public HTTPS URLs outside the GitHub/gravatar allowlist, so OG generation fell back to the default mark. Allow SSRF-safe public fetches for publisher profile avatars and embed avatar/kind metadata in OG URLs. * fix(og): show Downloads instead of Installs on OG cards Switch skill, plugin, and publisher OG image generators to read and label download counts, with legacy installs query param fallback. * fix(og): type skill API payload for canonical stat reads Export SkillStatReadable so fetchSkillOgMeta can pass API skill stats through readCanonicalStat without a TypeScript error. * fix(og): format compact downloads in OG cards Query-param download counts were rendered as raw integers on publisher OG images. Reuse formatCompactStat, add download icon + lowercase label, bump layout versions, and refresh org profile visual proof. * fix(og): use Downloads label without icon on OG cards Remove the download SVG from OG stat blocks and show only a muted "Downloads" label above compact values. Bump skill/plugin/publisher layout versions to bust cached social previews.
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { ConvexHttpClient } from "convex/browser";
|
|
import { api } from "../../convex/_generated/api";
|
|
|
|
export type PublisherOgMeta = {
|
|
handle: string | null;
|
|
kind: "user" | "org";
|
|
displayName: string | null;
|
|
bio: string | null;
|
|
image: string | null;
|
|
stats: {
|
|
downloads: number;
|
|
};
|
|
};
|
|
|
|
type PublisherProfileResult = {
|
|
handle?: string | null;
|
|
kind?: "user" | "org";
|
|
displayName?: string | null;
|
|
bio?: string | null;
|
|
image?: string | null;
|
|
stats?: {
|
|
downloads?: number;
|
|
installs?: number;
|
|
};
|
|
} | null;
|
|
|
|
export async function fetchPublisherOgMeta(
|
|
handle: string,
|
|
convexUrl: string,
|
|
): Promise<PublisherOgMeta | null> {
|
|
try {
|
|
const client = new ConvexHttpClient(convexUrl);
|
|
const profile = (await client.query(api.publishers.getProfileByHandle, {
|
|
handle,
|
|
})) as PublisherProfileResult;
|
|
if (!profile) return null;
|
|
return {
|
|
handle: profile.handle ?? null,
|
|
kind: profile.kind === "org" ? "org" : "user",
|
|
displayName: profile.displayName ?? null,
|
|
bio: profile.bio ?? null,
|
|
image: profile.image ?? null,
|
|
stats: {
|
|
downloads: readNumber(profile.stats?.downloads),
|
|
},
|
|
};
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
function readNumber(value: unknown) {
|
|
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
}
|