@@ -24,13 +24,13 @@ namespace GeneralUpdate.Core;
2424/// Unified update bootstrap — single entry point for Client, Upgrade, and OSS roles.
2525/// Use <see cref="AppType"/> to select the workflow:
2626/// <list type="bullet">
27- /// <item><see cref="AppType.ClientApp "/> — validate versions, download, start upgrade process</item>
28- /// <item><see cref="AppType.UpgradeApp "/> — receive ProcessInfo, apply updates, start main app</item>
29- /// <item><see cref="AppType.OSSApp "/> — OSS-based cloud storage update</item>
27+ /// <item><see cref="AppType.Client "/> — validate versions, download, start upgrade process</item>
28+ /// <item><see cref="AppType.Upgrade "/> — receive ProcessInfo, apply updates, start main app</item>
29+ /// <item><see cref="AppType.OSS "/> — OSS-based cloud storage update</item>
3030/// </list>
3131/// </summary>
3232/// <remarks>
33- /// For Client mode, use <c>Option(UpdateOptions.AppType, AppType.ClientApp )</c>.
33+ /// For Client mode, use <c>Option(UpdateOptions.AppType, AppType.Client )</c>.
3434/// </remarks>
3535public class GeneralUpdateBootstrap : AbstractBootstrap < GeneralUpdateBootstrap , IStrategy >
3636{
@@ -58,20 +58,20 @@ public void Cancel()
5858
5959 public override async Task < GeneralUpdateBootstrap > LaunchAsync ( )
6060 {
61- int appType = GetOption ( UpdateOptions . AppType ) ;
61+ var appType = GetOption ( UpdateOptions . AppType ) ;
6262
6363 // Silent mode: start background poll and return immediately
64- if ( appType == AppType . ClientApp && GetOption ( UpdateOptions . Silent ) )
64+ if ( appType == AppType . Client && GetOption ( UpdateOptions . Silent ) )
6565 {
6666 await LaunchSilentAsync ( ) . ConfigureAwait ( false ) ;
6767 return this ;
6868 }
6969
7070 return appType switch
7171 {
72- AppType . ClientApp => await LaunchWithStrategy ( new ClientUpdateStrategy ( ) ) ,
73- AppType . UpgradeApp => await LaunchWithStrategy ( new UpgradeUpdateStrategy ( ) ) ,
74- AppType . OSSApp => await LaunchOssAsync ( ) ,
72+ AppType . Client => await LaunchWithStrategy ( new ClientUpdateStrategy ( ) ) ,
73+ AppType . Upgrade => await LaunchWithStrategy ( new UpgradeUpdateStrategy ( ) ) ,
74+ AppType . OSS => await LaunchOssAsync ( ) ,
7575 _ => await LaunchWithStrategy ( new ClientUpdateStrategy ( ) )
7676 } ;
7777 }
@@ -94,6 +94,14 @@ private async Task<GeneralUpdateBootstrap> LaunchWithStrategy(IStrategy roleStra
9494 {
9595 clientStrat . Hooks = hooks ;
9696 clientStrat . Reporter = reporter ;
97+ // Inject SignalR Hub download source if configured
98+ var hubConfig = GetOption ( UpdateOptions . Hub ) ;
99+ if ( hubConfig != null && ! string . IsNullOrEmpty ( hubConfig . Url ) )
100+ {
101+ clientStrat . DownloadSource = new Download . Sources . HubDownloadSource (
102+ hubConfig . Url , GetOption ( UpdateOptions . Token ) , GetOption ( UpdateOptions . AppSecretKey ) ) ;
103+ GeneralTracer . Info ( "GeneralUpdateBootstrap: HubDownloadSource injected from HubConfig." ) ;
104+ }
97105 if ( _updatePrecheck != null )
98106 clientStrat . UseUpdatePrecheck ( _updatePrecheck ) ;
99107 foreach ( var opt in _customOptions )
@@ -201,7 +209,7 @@ public GeneralUpdateBootstrap SetConfig(Configinfo configInfo)
201209 _configInfo = ConfigurationMapper . MapToGlobalConfigInfo ( configInfo ) ;
202210
203211 var appType = GetOption ( UpdateOptions . AppType ) ;
204- if ( appType != AppType . UpgradeApp )
212+ if ( appType != AppType . Upgrade )
205213 {
206214 _configInfo . TempPath = StorageManager . GetTempDirectory ( "upgrade_temp" ) ;
207215 InitBlackList ( ) ;
0 commit comments