From 1ccec2a6751d0495754788e7e1b007d9ccedcd9d Mon Sep 17 00:00:00 2001 From: 1011025m <37438176+1011025m@users.noreply.github.com> Date: Sun, 29 Oct 2023 20:04:28 +0800 Subject: [PATCH 1/3] Handle error when channel is not available to user --- Bloxstrap/Bootstrapper.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index d68c50c..eafb5c7 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -229,10 +229,19 @@ namespace Bloxstrap } catch (HttpResponseException ex) { - if (ex.ResponseMessage.StatusCode != HttpStatusCode.NotFound) + if (ex.ResponseMessage.StatusCode != HttpStatusCode.NotFound && ex.ResponseMessage.StatusCode != HttpStatusCode.Unauthorized) throw; - App.Logger.WriteLine(LOG_IDENT, $"Reverting enrolled channel to {RobloxDeployment.DefaultChannel} because a WindowsPlayer build does not exist for {App.Settings.Prop.Channel}"); + if (ex.ResponseMessage.StatusCode == HttpStatusCode.NotFound) + App.Logger.WriteLine(LOG_IDENT, $"Reverting enrolled channel to {RobloxDeployment.DefaultChannel} because a WindowsPlayer build does not exist for {App.Settings.Prop.Channel}"); + // Janky fix for error 401 ~25/10/2023 + if (ex.ResponseMessage.StatusCode == HttpStatusCode.Unauthorized) + { + App.Logger.WriteLine(LOG_IDENT, $"Setting channel to {RobloxDeployment.DefaultChannel} because channel {App.Settings.Prop.Channel} is unavailable to the user."); + Controls.ShowMessageBox( + $"Release channel {App.Settings.Prop.Channel} is not available to you. It has been reset to {RobloxDeployment.DefaultChannel}.", MessageBoxImage.Information); + } + App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel; clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel); } From a3798f4a546f1996e742c414f9fab5194de065d7 Mon Sep 17 00:00:00 2001 From: 1011025m <37438176+1011025m@users.noreply.github.com> Date: Sun, 29 Oct 2023 20:46:03 +0800 Subject: [PATCH 2/3] Respect user setting for changing release channels Added a few prompts --- Bloxstrap/Bootstrapper.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index eafb5c7..bc8d4cf 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -237,9 +237,24 @@ namespace Bloxstrap // Janky fix for error 401 ~25/10/2023 if (ex.ResponseMessage.StatusCode == HttpStatusCode.Unauthorized) { - App.Logger.WriteLine(LOG_IDENT, $"Setting channel to {RobloxDeployment.DefaultChannel} because channel {App.Settings.Prop.Channel} is unavailable to the user."); - Controls.ShowMessageBox( - $"Release channel {App.Settings.Prop.Channel} is not available to you. It has been reset to {RobloxDeployment.DefaultChannel}.", MessageBoxImage.Information); + App.Logger.WriteLine(LOG_IDENT, $"Channel {App.Settings.Prop.Channel} is unavailable to the user."); + if (App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Automatic) + Controls.ShowMessageBox($"Release channel {App.Settings.Prop.Channel} is not available to you. It has been reset to {RobloxDeployment.DefaultChannel}.", MessageBoxImage.Information); + else + { + MessageBoxResult channelChangeResult = Controls.ShowMessageBox( + $"Release channel {App.Settings.Prop.Channel} is not available to you. Would you like to reset to {RobloxDeployment.DefaultChannel}?", + MessageBoxImage.Warning, + MessageBoxButton.YesNo); + + if (channelChangeResult != MessageBoxResult.Yes) + { + Controls.ShowMessageBox($"Client cannot be launched as you are enrolled into an unavailable release channel and refused to reset.", MessageBoxImage.Error); + App.Logger.WriteLine(LOG_IDENT, $"User refused to reset channel. Aborting."); + App.Terminate(ErrorCode.ERROR_CANCELLED); + } + } + App.Logger.WriteLine(LOG_IDENT, $"Resetting release channel to {RobloxDeployment.DefaultChannel} as {App.Settings.Prop.Channel} is unavailable to the user."); } App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel; From e62f8784a6cd1444fb4c1fc743862b6e1dd8b918 Mon Sep 17 00:00:00 2001 From: 1011025m <37438176+1011025m@users.noreply.github.com> Date: Wed, 1 Nov 2023 00:06:18 +0800 Subject: [PATCH 3/3] Code cleanup + small regression don't prompt if channel switching is auto --- Bloxstrap/Bootstrapper.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index bc8d4cf..2fe3a0c 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -229,18 +229,15 @@ namespace Bloxstrap } catch (HttpResponseException ex) { - if (ex.ResponseMessage.StatusCode != HttpStatusCode.NotFound && ex.ResponseMessage.StatusCode != HttpStatusCode.Unauthorized) - throw; - + // If channel does not exist if (ex.ResponseMessage.StatusCode == HttpStatusCode.NotFound) App.Logger.WriteLine(LOG_IDENT, $"Reverting enrolled channel to {RobloxDeployment.DefaultChannel} because a WindowsPlayer build does not exist for {App.Settings.Prop.Channel}"); - // Janky fix for error 401 ~25/10/2023 - if (ex.ResponseMessage.StatusCode == HttpStatusCode.Unauthorized) + // If channel is not available to the user (private/internal release channel) + else if (ex.ResponseMessage.StatusCode == HttpStatusCode.Unauthorized) { App.Logger.WriteLine(LOG_IDENT, $"Channel {App.Settings.Prop.Channel} is unavailable to the user."); - if (App.Settings.Prop.ChannelChangeMode == ChannelChangeMode.Automatic) - Controls.ShowMessageBox($"Release channel {App.Settings.Prop.Channel} is not available to you. It has been reset to {RobloxDeployment.DefaultChannel}.", MessageBoxImage.Information); - else + // Only prompt if user has channel switching mode set to something other than Automatic. + if (App.Settings.Prop.ChannelChangeMode != ChannelChangeMode.Automatic) { MessageBoxResult channelChangeResult = Controls.ShowMessageBox( $"Release channel {App.Settings.Prop.Channel} is not available to you. Would you like to reset to {RobloxDeployment.DefaultChannel}?", @@ -256,6 +253,7 @@ namespace Bloxstrap } App.Logger.WriteLine(LOG_IDENT, $"Resetting release channel to {RobloxDeployment.DefaultChannel} as {App.Settings.Prop.Channel} is unavailable to the user."); } + else throw; App.Settings.Prop.Channel = RobloxDeployment.DefaultChannel; clientVersion = await RobloxDeployment.GetInfo(App.Settings.Prop.Channel);