@@ -220,11 +220,14 @@ public static void RefreshDownloadableModuleList()
220220 /// from the ModuleConfig.
221221 /// </summary>
222222 /// <param name="module">A ModuleConfig object</param>
223+ /// <param name="moduleStorageUrl">The location of the module download
224+ /// packages</param>
223225 /// <param name="isInstalled">Is this module currently installed?</param>
224226 /// <param name="serverVersion">The version of the current server, or null to ignore
225227 /// version checks</param>
226228 /// <returns>A ModuleDescription object</returns>
227229 public static ModuleDescription ModuleDescriptionFromModuleConfig ( ModuleConfig module ,
230+ string moduleStorageUrl ,
228231 bool isInstalled ,
229232 string serverVersion )
230233 {
@@ -240,7 +243,8 @@ public static ModuleDescription ModuleDescriptionFromModuleConfig(ModuleConfig m
240243
241244 // Set initial properties. Most importantly it sets the status.
242245 moduleDescription . Initialise ( serverVersion , module . ModuleDirPath ,
243- module . InstallOptions ! . ModuleLocation ) ;
246+ moduleStorageUrl ,
247+ module . InstallOptions ! . ModuleLocation ) ;
244248
245249 // if a module is installed then that beats any other status
246250 if ( isInstalled )
@@ -323,6 +327,7 @@ public async Task<List<ModuleDescription>> GetInstallableModulesAsync()
323327 + Path . DirectorySeparatorChar
324328 + downloadableModule . ModuleId ;
325329 downloadableModule . Initialise ( currentServerVersion , moduleDirPath ,
330+ _moduleOptions . ModuleStorageUrl ! ,
326331 ModuleLocation . Internal ) ;
327332 }
328333
@@ -467,6 +472,7 @@ public async Task<List<ModuleDescription>> GetInstallableModulesAsync()
467472 // "module.InstallOptions?.PreInstalled" is the setting for the currently installed
468473 // module, not the module that can be downloaded.
469474 // GIVEN ALL THAT: who cares. We can totally uninstall / reinstall something pre-installed.
475+
470476 // if (module is not null && module.InstallOptions?.PreInstalled == true)
471477 // return (false, $"Module description for '{moduleId}' is invalid. A 'pre-installed' module can't be downloaded");
472478
@@ -484,6 +490,7 @@ public async Task<List<ModuleDescription>> GetInstallableModulesAsync()
484490 // Download and unpack the module's installation package FOR THE REQUESTED VERSION
485491 // string moduleDirName = _moduleSettings.GetModuleDirPath(moduleDownload);
486492 // string moduleDirName = moduleDownload.ModuleDirPath;
493+ // TODO: Generalise this in a utility method
487494 string downloadDirPath = _moduleSettings . DownloadedModulePackagesDirPath
488495 + Path . DirectorySeparatorChar + moduleId + "-" + version + ".zip" ;
489496
@@ -843,7 +850,9 @@ await logWriter.WriteLineAsync($"Unable to install Module '{moduleId}' ({e.Messa
843850 // to the download list so at least we can provide updates on it disappearing.
844851 if ( moduleDownload is null )
845852 {
846- moduleDownload = ModuleDescriptionFromModuleConfig ( module , true ,
853+ moduleDownload = ModuleDescriptionFromModuleConfig ( module ,
854+ _moduleOptions . ModuleStorageUrl ! ,
855+ true ,
847856 _versionConfig . VersionInfo ! . Version ) ;
848857 moduleDownload . IsDownloadable = false ;
849858 }
0 commit comments