MCPcopy
hub / github.com/ZToolsCenter/ZTools / getAllPlugins

Method getAllPlugins

src/main/api/renderer/plugins.ts:303–339  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301
302 // 获取所有插件列表(包括 system 插件,用于生成搜索指令)
303 public async getAllPlugins(): Promise<any[]> {
304 try {
305 const data = databaseAPI.dbGet('plugins')
306 const plugins = data || []
307
308 // 合并动态 features 和网页快开搜索引擎
309 const webSearchFeatures = await webSearchAPI.getSearchEngineFeatures()
310 for (const plugin of plugins) {
311 const dynamicFeatures = pluginFeatureAPI.loadDynamicFeatures(plugin.name)
312 plugin.features = [...(plugin.features || []), ...dynamicFeatures]
313
314 // 将网页快开搜索引擎作为系统插件的动态 features
315 if (plugin.name === 'system' && webSearchFeatures.length > 0) {
316 plugin.features = [...plugin.features, ...webSearchFeatures]
317 }
318
319 // 处理插件 logo 路径
320 if (plugin.logo) {
321 plugin.logo = normalizeIconPath(plugin.logo, plugin.path)
322 }
323
324 // 处理每个 feature 的 icon 路径
325 if (plugin.features && Array.isArray(plugin.features)) {
326 for (const feature of plugin.features) {
327 if (feature.icon) {
328 feature.icon = normalizeIconPath(feature.icon, plugin.path)
329 }
330 }
331 }
332 }
333
334 return plugins
335 } catch (error) {
336 console.error('[Plugins] 获取插件列表失败:', error)
337 return []
338 }
339 }
340
341 private readInstalledPlugins(): any[] {
342 const plugins = databaseAPI.dbGet('plugins')

Callers 7

setupIPCMethod · 0.95
getPluginsMethod · 0.95
loadPinnedDataFunction · 0.80
reloadPluginCommandsFunction · 0.80
loadCommandsFunction · 0.80
setupIPCMethod · 0.80
getCommandsMethod · 0.80

Calls 4

normalizeIconPathFunction · 0.90
loadDynamicFeaturesMethod · 0.80
dbGetMethod · 0.45

Tested by

no test coverage detected