feat(sdk): support for plugin icons

This commit is contained in:
jubnl
2026-07-13 15:48:01 +02:00
parent ebc98f0a3f
commit bae98d1144
18 changed files with 1709 additions and 30 deletions
@@ -68,6 +68,8 @@ export interface RegistryEntry {
homepage?: string;
tags?: string[];
type: string;
/** A lucide icon name for the store tile; absent means the client's default (Blocks). */
icon?: string;
reviewedAt?: string | null;
/** base64 minisign author public key — stable across versions, TOFU-pinned. */
authorPublicKey?: string;
@@ -176,7 +178,7 @@ export class PluginRegistryService {
const latest = p.versions[0] ?? null;
return {
id: p.id, name: p.name, author: p.author, description: p.description, repo: p.repo,
homepage: p.homepage, tags: p.tags, type: p.type, reviewedAt: p.reviewedAt ?? null,
homepage: p.homepage, tags: p.tags, type: p.type, icon: p.icon, reviewedAt: p.reviewedAt ?? null,
downloadCount: p.downloadCount ?? null,
latest: latest?.version ?? null, minTrekVersion: latest?.minTrekVersion ?? null,
requiredAddons: latest?.requiredAddons ?? [], pluginDependencies: latest?.pluginDependencies ?? [],
@@ -68,7 +68,7 @@ const REGISTRY = {
plugins: [
{
id: 'flight-tracker', name: 'Flight', author: 'Acme', description: 'flights', repo: 'acme/trek-flight',
type: 'widget', reviewedAt: '2026-06-20',
type: 'widget', icon: 'Plane', reviewedAt: '2026-06-20',
versions: [{ version: '1.0.0', gitTag: 'v1.0.0', commitSha: 'a'.repeat(40), downloadUrl: 'https://codeload.github.com/acme/trek-flight/tar.gz/aaaa', sha256: '', minTrekVersion: '3.2.0' }],
},
],
@@ -124,6 +124,13 @@ describe('PluginRegistryService', () => {
]);
});
// The store tile has no manifest to read (the aggregated index carries no manifests), so
// the entry's icon is the only thing standing between it and a generic Blocks glyph.
it('browse carries the entry icon through to the store tile', async () => {
const [entry] = await svc.browse();
expect(entry.icon).toBe('Plane');
});
it('browse exposes a screenshot url pinned at the reviewed commit', async () => {
const list = await svc.browse();
expect(list[0].screenshotUrl).toBe(`https://raw.githubusercontent.com/acme/trek-flight/${'a'.repeat(40)}/docs/screenshot.png`);