mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-25 02:32:47 +00:00
* fix(plugins): restrict overview content to safe Markdown and HTTPS destinations Registry overviews are author-controlled content read away from their repositories. Apply a shared presentation policy instead of the documentation renderer so relative links, non-HTTPS URLs, raw HTML, and author styles never become active overview content. * fix(plugins): choose the first allowed screenshot for previews
24 lines
802 B
TypeScript
24 lines
802 B
TypeScript
import { pluginOverviewUrl } from "@getpaseo/protocol/plugin-overview";
|
|
import type { Plugin } from "./registry";
|
|
|
|
const SIZE_CLASS = {
|
|
sm: "h-9 w-9 rounded-lg text-sm",
|
|
lg: "h-14 w-14 rounded-xl text-xl",
|
|
} as const;
|
|
|
|
/** PNG icon with a letter tile when no icon is published. */
|
|
export function PluginTile({ plugin, size }: { plugin: Plugin; size: keyof typeof SIZE_CLASS }) {
|
|
return (
|
|
<div
|
|
aria-hidden
|
|
className={`flex flex-shrink-0 items-center justify-center border border-white/10 bg-white/[0.06] font-medium text-white/80 ${SIZE_CLASS[size]}`}
|
|
>
|
|
{pluginOverviewUrl(plugin.icon) ? (
|
|
<img src={plugin.icon} alt="" className="h-full w-full rounded-[inherit] object-cover" />
|
|
) : (
|
|
plugin.name.charAt(0).toUpperCase()
|
|
)}
|
|
</div>
|
|
);
|
|
}
|