mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-22 12:26:08 +00:00
fix(marketplace): use external icon URL when icon field is absolute
Many MCP / skill records store their icon as an absolute external URL (simpleicons.org / iconify.design) rather than an uploaded file, so the /resources/icon endpoint 404s and the card icon breaks. Add resolveMarketplaceIconURL() which prefers an absolute http(s) icon field and otherwise falls back to the resources endpoint.
This commit is contained in:
@@ -184,11 +184,12 @@ function AddExtensionContent() {
|
||||
const cloud = getCloudServiceClientSync();
|
||||
const a = installInfo.plugin_author || '';
|
||||
const n = installInfo.plugin_name || '';
|
||||
if (installExtensionType === 'mcp')
|
||||
return cloud.getMCPMarketplaceIconURL(a, n);
|
||||
if (installExtensionType === 'skill')
|
||||
return cloud.getSkillMarketplaceIconURL(a, n);
|
||||
return cloud.getPluginIconURL(a, n);
|
||||
return cloud.resolveMarketplaceIconURL(
|
||||
installExtensionType,
|
||||
a,
|
||||
n,
|
||||
installInfo.plugin_icon,
|
||||
);
|
||||
})();
|
||||
|
||||
const [popoverOpen, setPopoverOpen] = useState(false);
|
||||
@@ -326,6 +327,7 @@ function AddExtensionContent() {
|
||||
plugin_version: plugin.latest_version,
|
||||
plugin_label: extractI18nObject(plugin.label) || plugin.name,
|
||||
plugin_description: extractI18nObject(plugin.description) || '',
|
||||
plugin_icon: plugin.icon || '',
|
||||
});
|
||||
setInstallExtensionType(plugin.type || 'plugin');
|
||||
setPluginInstallStatus(PluginInstallStatus.ASK_CONFIRM);
|
||||
|
||||
@@ -216,12 +216,12 @@ function MarketPageContent({
|
||||
const transformToVO = useCallback(
|
||||
(plugin: PluginV4): PluginMarketCardVO => {
|
||||
const cloudClient = getCloudServiceClientSync();
|
||||
const iconURL =
|
||||
plugin.type === 'mcp'
|
||||
? cloudClient.getMCPMarketplaceIconURL(plugin.author, plugin.name)
|
||||
: plugin.type === 'skill'
|
||||
? cloudClient.getSkillMarketplaceIconURL(plugin.author, plugin.name)
|
||||
: cloudClient.getPluginIconURL(plugin.author, plugin.name);
|
||||
const iconURL = cloudClient.resolveMarketplaceIconURL(
|
||||
plugin.type,
|
||||
plugin.author,
|
||||
plugin.name,
|
||||
plugin.icon,
|
||||
);
|
||||
|
||||
return new PluginMarketCardVO({
|
||||
pluginId: plugin.author + ' / ' + plugin.name,
|
||||
|
||||
@@ -23,13 +23,14 @@ function pluginToVO(
|
||||
t: (key: string) => string,
|
||||
): PluginMarketCardVO {
|
||||
const cloudClient = getCloudServiceClientSync();
|
||||
// Recommendation lists are mixed-type; resolve the icon per extension type.
|
||||
const iconURL =
|
||||
plugin.type === 'mcp'
|
||||
? cloudClient.getMCPMarketplaceIconURL(plugin.author, plugin.name)
|
||||
: plugin.type === 'skill'
|
||||
? cloudClient.getSkillMarketplaceIconURL(plugin.author, plugin.name)
|
||||
: cloudClient.getPluginIconURL(plugin.author, plugin.name);
|
||||
// Recommendation lists are mixed-type; resolve the icon per extension type,
|
||||
// preferring an absolute external icon URL when the record carries one.
|
||||
const iconURL = cloudClient.resolveMarketplaceIconURL(
|
||||
plugin.type,
|
||||
plugin.author,
|
||||
plugin.name,
|
||||
plugin.icon,
|
||||
);
|
||||
|
||||
return new PluginMarketCardVO({
|
||||
pluginId: plugin.author + ' / ' + plugin.name,
|
||||
|
||||
Reference in New Issue
Block a user