@@ -24,7 +24,14 @@ import url from 'url';
2424import yargs from 'yargs' ;
2525import { hideBin } from 'yargs/helpers' ;
2626import i18n from './i18next.config' ;
27- import { PluginManager } from './plugin-management' ;
27+ import {
28+ addToPath ,
29+ ArtifactHubHeadlampPkg ,
30+ defaultPluginsDir ,
31+ getMatchingExtraFiles ,
32+ getPluginBinDirectories ,
33+ PluginManager ,
34+ } from './plugin-management' ;
2835import { handleRunCommand } from './runCmd' ;
2936import windowSize from './windowSize' ;
3037
@@ -189,7 +196,6 @@ class PluginManagerEventListeners {
189196 ipcMain . on ( 'plugin-manager' , async ( event , data ) => {
190197 const eventData = JSON . parse ( data ) as Action ;
191198 const { identifier, action } = eventData ;
192-
193199 const updateCache = ( progress : ProgressResp ) => {
194200 const percentage = this . convertProgressToPercentage ( progress ) ;
195201 this . cache [ identifier ] . progress = progress ;
@@ -248,7 +254,7 @@ class PluginManagerEventListeners {
248254 controller,
249255 } ;
250256
251- let pluginInfo ;
257+ let pluginInfo : ArtifactHubHeadlampPkg | undefined = undefined ;
252258 try {
253259 pluginInfo = await PluginManager . fetchPluginInfo ( URL , { signal : controller . signal } ) ;
254260 } catch ( error ) {
@@ -260,14 +266,20 @@ class PluginManagerEventListeners {
260266 return { type : 'error' , message : 'Failed to fetch plugin info' } ;
261267 }
262268
269+ const { matchingExtraFiles } = getMatchingExtraFiles (
270+ pluginInfo ?. extraFiles ? pluginInfo ?. extraFiles : { }
271+ ) ;
272+ const extraUrls = matchingExtraFiles . map ( file => file . url ) ;
273+ const allUrls = [ pluginInfo . archiveURL , ...extraUrls ] . join ( ', ' ) ;
274+
263275 const dialogOptions : MessageBoxOptions = {
264276 type : 'question' ,
265277 buttons : [ i18n . t ( 'Yes' ) , i18n . t ( 'No' ) ] ,
266278 defaultId : 1 ,
267279 title : i18n . t ( 'Plugin Installation' ) ,
268280 message : i18n . t ( 'Do you want to install the plugin "{{ pluginName }}"?' , { pluginName } ) ,
269281 detail : i18n . t ( 'You are about to install a plugin from: {{ url }}\nDo you want to proceed?' , {
270- url : pluginInfo . archiveURL ,
282+ url : allUrls ,
271283 } ) ,
272284 } ;
273285
@@ -529,7 +541,6 @@ async function getShellEnv(): Promise<NodeJS.ProcessEnv> {
529541 } ;
530542
531543 const envVars = isEnvNull ? processLines ( '\0' ) : processLines ( '\n' ) ;
532-
533544 const mergedEnv = { ...process . env , ...envVars } ;
534545 return mergedEnv ;
535546 } catch ( error ) {
@@ -1324,6 +1335,19 @@ function startElecron() {
13241335 attachServerEventHandlers ( serverProcess ) ;
13251336 }
13261337
1338+ // Also add bundled plugin bin directories to PATH
1339+ const bundledPlugins = path . join ( process . resourcesPath , '.plugins' ) ;
1340+ const bundledPluginBinDirs = getPluginBinDirectories ( bundledPlugins ) ;
1341+ if ( bundledPluginBinDirs . length > 0 ) {
1342+ addToPath ( bundledPluginBinDirs , 'bundled plugin' ) ;
1343+ }
1344+
1345+ // Add the installed plugins as well
1346+ const userPluginBinDirs = getPluginBinDirectories ( defaultPluginsDir ( ) ) ;
1347+ if ( userPluginBinDirs . length > 0 ) {
1348+ addToPath ( userPluginBinDirs , 'userPluginBinDirs plugin' ) ;
1349+ }
1350+
13271351 // Finally load the frontend
13281352 mainWindow . loadURL ( startUrl ) ;
13291353 }
0 commit comments