From d4d41bdd4f4bb419738864fb5ad71c74d8a39fd1 Mon Sep 17 00:00:00 2001 From: Matt <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:03:25 +0100 Subject: [PATCH 01/42] add in logging to HandleConnectionError (#3185) --- Bloxstrap/Bootstrapper.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 7e0b5ab..7a42594 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -116,8 +116,13 @@ namespace Bloxstrap private void HandleConnectionError(Exception exception) { + const string LOG_IDENT = "Bootstrapper::HandleConnectionError"; + _noConnection = true; + App.Logger.WriteLine(LOG_IDENT, "Connectivity check failed"); + App.Logger.WriteException(LOG_IDENT, exception); + string message = Strings.Dialog_Connectivity_Preventing; if (exception.GetType() == typeof(AggregateException)) From f19cc05ffbcfe83fd43756e0c36ec5fe8ff3816b Mon Sep 17 00:00:00 2001 From: Matt <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:03:41 +0100 Subject: [PATCH 02/42] fix connectivity check cancellation (#3184) --- Bloxstrap/RobloxInterfaces/Deployment.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/RobloxInterfaces/Deployment.cs b/Bloxstrap/RobloxInterfaces/Deployment.cs index 383cab4..698be79 100644 --- a/Bloxstrap/RobloxInterfaces/Deployment.cs +++ b/Bloxstrap/RobloxInterfaces/Deployment.cs @@ -86,7 +86,7 @@ if (finishedTask.IsFaulted) exceptions.Add(finishedTask.Exception!.InnerException!); - else + else if (!finishedTask.IsCanceled) BaseUrl = finishedTask.Result; } @@ -94,7 +94,11 @@ tokenSource.Cancel(); if (string.IsNullOrEmpty(BaseUrl)) - return exceptions[0]; + { + if (exceptions.Any()) + return exceptions[0]; + return new TaskCanceledException("All tasks have been cancelled"); // we can't add TaskCanceledExceptions to the list + } App.Logger.WriteLine(LOG_IDENT, $"Got {BaseUrl} as the optimal base URL"); From 19b59adbcef05b028ec2928e426b04efdefccf2f Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 17 Oct 2024 01:36:49 +0100 Subject: [PATCH 03/42] Update bug_report.yaml --- .github/ISSUE_TEMPLATE/bug_report.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 12e90d4..49746b2 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -5,6 +5,10 @@ body: - type: markdown attributes: value: | + > [!IMPORTANT] + > Do NOT open an issue if you're getting an error saying "The given key 'redist.zip' was not present in the dictionary." error. + > This problem has been fixed in the latest version of Bloxstrap. You either have auto-updates disabled or are using someone's custom build of an old version. + > Download the latest version [here](https://github.com/pizzaboxer/bloxstrap/releases/latest). ### **Preliminary instructions** - Before opening an issue, please [check the Wiki first](https://github.com/pizzaboxer/bloxstrap/wiki/) to see if your problem has been addressed there. - If it isn't, please confirm which pages that you read that were relevant to your issue. From 0be35391ae10f7ea49ea7df612b18542dbbc3ed2 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 17 Oct 2024 01:37:04 +0100 Subject: [PATCH 04/42] Update bug_report.yaml --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 49746b2..26c0c86 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Do NOT open an issue if you're getting an error saying "The given key 'redist.zip' was not present in the dictionary." error. + > Do NOT open an issue if you're getting an error saying "The given key 'redist.zip' was not present in the dictionary." > This problem has been fixed in the latest version of Bloxstrap. You either have auto-updates disabled or are using someone's custom build of an old version. > Download the latest version [here](https://github.com/pizzaboxer/bloxstrap/releases/latest). ### **Preliminary instructions** From be47b60effffc086504d6f4988818ec51845d293 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 17 Oct 2024 01:39:54 +0100 Subject: [PATCH 05/42] Update bug_report.yaml --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 26c0c86..d0602ae 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Do NOT open an issue if you're getting an error saying "The given key 'redist.zip' was not present in the dictionary." + > Do NOT open an issue if you're getting an error saying `The given key 'redist.zip' was not present in the dictionary.`, or if you're getting stuck on "Configuring Roblox...". > This problem has been fixed in the latest version of Bloxstrap. You either have auto-updates disabled or are using someone's custom build of an old version. > Download the latest version [here](https://github.com/pizzaboxer/bloxstrap/releases/latest). ### **Preliminary instructions** From 8babc09af80ee41a536b918b6c4425c405b65459 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 17 Oct 2024 01:43:05 +0100 Subject: [PATCH 06/42] Update bug_report.yaml --- .github/ISSUE_TEMPLATE/bug_report.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index d0602ae..c2d6686 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -6,7 +6,7 @@ body: attributes: value: | > [!IMPORTANT] - > Do NOT open an issue if you're getting an error saying `The given key 'redist.zip' was not present in the dictionary.`, or if you're getting stuck on "Configuring Roblox...". + > Do NOT open an issue if you're getting an error saying "`The given key 'redist.zip' was not present in the dictionary.`", or if you're getting stuck on "Configuring Roblox...". > This problem has been fixed in the latest version of Bloxstrap. You either have auto-updates disabled or are using someone's custom build of an old version. > Download the latest version [here](https://github.com/pizzaboxer/bloxstrap/releases/latest). ### **Preliminary instructions** From 8c5a0047329b8f12d7ed8759c2528bdd4cc850c8 Mon Sep 17 00:00:00 2001 From: Matt <97983689+bluepilledgreat@users.noreply.github.com> Date: Thu, 17 Oct 2024 15:34:03 +0100 Subject: [PATCH 07/42] Enhance the error experience (#3259) * set taskbar state to error upon failing * add version text to the exception dialog * vertically align version text --- Bloxstrap/App.xaml.cs | 11 +++++++++++ Bloxstrap/LaunchHandler.cs | 8 ++++---- Bloxstrap/Resources/Strings.Designer.cs | 9 +++++++++ Bloxstrap/Resources/Strings.resx | 3 +++ Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml | 14 +++++++++----- .../UI/Elements/Dialogs/ExceptionDialog.xaml.cs | 2 ++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index ce40e07..f5bcefb 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Security.Cryptography; using System.Windows; +using System.Windows.Shell; using System.Windows.Threading; using Microsoft.Win32; @@ -35,6 +36,8 @@ namespace Bloxstrap public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2]; + public static Bootstrapper? Bootstrapper { get; set; } = null!; + public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef); public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal); @@ -104,6 +107,14 @@ namespace Bloxstrap _showingExceptionDialog = true; + if (Bootstrapper?.Dialog != null) + { + if (Bootstrapper.Dialog.TaskbarProgressValue == 0) + Bootstrapper.Dialog.TaskbarProgressValue = 1; // make sure it's visible + + Bootstrapper.Dialog.TaskbarProgressState = TaskbarItemProgressState.Error; + } + Frontend.ShowExceptionDialog(ex); Terminate(ErrorCode.ERROR_INSTALL_FAILURE); diff --git a/Bloxstrap/LaunchHandler.cs b/Bloxstrap/LaunchHandler.cs index cf7f165..35739fd 100644 --- a/Bloxstrap/LaunchHandler.cs +++ b/Bloxstrap/LaunchHandler.cs @@ -202,18 +202,18 @@ namespace Bloxstrap // start bootstrapper and show the bootstrapper modal if we're not running silently App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper"); - var bootstrapper = new Bootstrapper(launchMode); + App.Bootstrapper = new Bootstrapper(launchMode); IBootstrapperDialog? dialog = null; if (!App.LaunchSettings.QuietFlag.Active) { App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper dialog"); dialog = App.Settings.Prop.BootstrapperStyle.GetNew(); - bootstrapper.Dialog = dialog; - dialog.Bootstrapper = bootstrapper; + App.Bootstrapper.Dialog = dialog; + dialog.Bootstrapper = App.Bootstrapper; } - Task.Run(bootstrapper.Run).ContinueWith(t => + Task.Run(App.Bootstrapper.Run).ContinueWith(t => { App.Logger.WriteLine(LOG_IDENT, "Bootstrapper task has finished"); diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index cf5e6a6..ad28195 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -974,6 +974,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Version {0}. + /// + public static string Dialog_Exception_Version { + get { + return ResourceManager.GetString("Dialog.Exception.Version", resourceCulture); + } + } + /// /// Looks up a localized string similar to The chosen bootstrapper icon could not be loaded. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 4d9d54b..6b7fe31 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1236,4 +1236,7 @@ Would you like to enable test mode? Icons Name of the folder that gets created according to the "create shortcut icons" option. Ensure that it is a valid folder name. + + Version {0} + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml index 1debcfd..b98372d 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml +++ b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml @@ -40,11 +40,15 @@ - - public partial class ExceptionDialog { + const int MAX_GITHUB_URL_LENGTH = 8192; + public ExceptionDialog(Exception exception) { InitializeComponent(); @@ -27,12 +29,19 @@ namespace Bloxstrap.UI.Elements.Dialogs string repoUrl = $"https://github.com/{App.ProjectRepository}"; string wikiUrl = $"{repoUrl}/wiki"; - string issueUrl = String.Format( - "{0}/issues/new?template=bug_report.yaml&title={1}&log={2}", - repoUrl, - HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}"), - HttpUtility.UrlEncode(String.Join('\n', App.Logger.History)) - ); + string title = HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}"); + string log = HttpUtility.UrlEncode(String.Join('\n', App.Logger.History)); + + string issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}&log={log}"; + + if (issueUrl.Length > MAX_GITHUB_URL_LENGTH) + { + // url is way too long for github. remove the log parameter. + issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}"; + + if (issueUrl.Length > MAX_GITHUB_URL_LENGTH) + issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml"; // bruh + } string helpMessage = String.Format(Strings.Dialog_Exception_Info_2, wikiUrl, issueUrl); From b3a1b1c55e18e7123c2980a23d58da4dccc0b9a7 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 26 Oct 2024 23:03:47 +0100 Subject: [PATCH 28/42] Dynamically resize supporter grid columns + fix bootstrapper bug from yesterday --- Bloxstrap/Bootstrapper.cs | 3 +++ .../Elements/About/Pages/SupportersPage.xaml | 5 ++-- .../About/Pages/SupportersPage.xaml.cs | 11 +++++++-- .../ViewModels/About/SupportersViewModel.cs | 24 ++++++++++++++++++- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 381965a..a0d9963 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -629,6 +629,9 @@ namespace Bloxstrap if (Directory.Exists(AppData.Directory)) { + if (Directory.Exists(AppData.OldDirectory)) + Directory.Delete(AppData.OldDirectory, true); + try { // test to see if any files are in use diff --git a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml index 925a520..9620493 100644 --- a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml +++ b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml @@ -10,6 +10,7 @@ xmlns:resources="clr-namespace:Bloxstrap.Resources" mc:Ignorable="d" d:DesignHeight="1500" d:DesignWidth="800" + SizeChanged="UiPage_SizeChanged" Title="AboutPage" Scrollable="True"> @@ -93,7 +94,7 @@ - + @@ -122,7 +123,7 @@ - + diff --git a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs index c824558..546d2e4 100644 --- a/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs +++ b/Bloxstrap/UI/Elements/About/Pages/SupportersPage.xaml.cs @@ -1,4 +1,6 @@ -using Bloxstrap.UI.ViewModels.About; +using System.Windows; + +using Bloxstrap.UI.ViewModels.About; namespace Bloxstrap.UI.Elements.About.Pages { @@ -7,10 +9,15 @@ namespace Bloxstrap.UI.Elements.About.Pages /// public partial class SupportersPage { + private readonly SupportersViewModel _viewModel = new(); + public SupportersPage() { - DataContext = new SupportersViewModel(); + DataContext = _viewModel; InitializeComponent(); } + + private void UiPage_SizeChanged(object sender, SizeChangedEventArgs e) + => _viewModel.WindowResizeEvent?.Invoke(sender, e); } } diff --git a/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs b/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs index cc5afbc..8fca94b 100644 --- a/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs +++ b/Bloxstrap/UI/ViewModels/About/SupportersViewModel.cs @@ -1,4 +1,6 @@ -namespace Bloxstrap.UI.ViewModels.About +using System.Windows; + +namespace Bloxstrap.UI.ViewModels.About { public class SupportersViewModel : NotifyPropertyChangedViewModel { @@ -8,12 +10,32 @@ public string LoadError { get; set; } = ""; + public int Columns { get; set; } = 3; + + public SizeChangedEventHandler? WindowResizeEvent; + public SupportersViewModel() { + WindowResizeEvent += OnWindowResize; + // this will cause momentary freezes only when ran under the debugger LoadSupporterData(); } + private void OnWindowResize(object sender, SizeChangedEventArgs e) + { + if (!e.WidthChanged) + return; + + int newCols = (int)Math.Floor(e.NewSize.Width / 200); + + if (Columns == newCols) + return; + + Columns = newCols; + OnPropertyChanged(nameof(Columns)); + } + public async void LoadSupporterData() { const string LOG_IDENT = "AboutViewModel::LoadSupporterData"; From aab9e153d16f96ddc27a830a7ff1c892701152ad Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sat, 26 Oct 2024 23:51:40 +0100 Subject: [PATCH 29/42] Add support for running RobloxPlayerBeta as Admin for some reason, i'm unable to delete the appcompatflags entry programatically in the uninstall process? weird --- Bloxstrap/Bootstrapper.cs | 32 +++++++++++++++++++++++++++- Bloxstrap/Utility/WindowsRegistry.cs | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index a0d9963..6b73caa 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -11,6 +11,8 @@ #warning "Automatic updater debugging is enabled" #endif +using System.ComponentModel; +using System.Data; using System.Windows; using System.Windows.Forms; using System.Windows.Shell; @@ -337,7 +339,12 @@ namespace Bloxstrap WorkingDirectory = AppData.Directory }; - if (_launchMode == LaunchMode.StudioAuth) + if (_launchMode == LaunchMode.Player && ShouldRunAsAdmin()) + { + startInfo.Verb = "runas"; + startInfo.UseShellExecute = true; + } + else if (_launchMode == LaunchMode.StudioAuth) { Process.Start(startInfo); return; @@ -372,6 +379,11 @@ namespace Bloxstrap using var process = Process.Start(startInfo)!; _appPid = process.Id; } + catch (Win32Exception ex) when (ex.NativeErrorCode == 1223) + { + // 1223 = ERROR_CANCELLED, gets thrown if a UAC prompt is cancelled + return; + } catch (Exception) { // attempt a reinstall on next launch @@ -456,6 +468,24 @@ namespace Bloxstrap Thread.Sleep(1000); } + private bool ShouldRunAsAdmin() + { + foreach (var root in WindowsRegistry.Roots) + { + using var key = root.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"); + + if (key is null) + continue; + + string? flags = (string?)key.GetValue(AppData.ExecutablePath); + + if (flags is not null && flags.Contains("RUNASADMIN", StringComparison.OrdinalIgnoreCase)) + return true; + } + + return false; + } + public void Cancel() { const string LOG_IDENT = "Bootstrapper::Cancel"; diff --git a/Bloxstrap/Utility/WindowsRegistry.cs b/Bloxstrap/Utility/WindowsRegistry.cs index 23ca712..c13cd65 100644 --- a/Bloxstrap/Utility/WindowsRegistry.cs +++ b/Bloxstrap/Utility/WindowsRegistry.cs @@ -5,6 +5,8 @@ namespace Bloxstrap.Utility static class WindowsRegistry { private const string RobloxPlaceKey = "Roblox.Place"; + + public static readonly List Roots = new() { Registry.CurrentUser, Registry.LocalMachine }; public static void RegisterProtocol(string key, string name, string handler, string handlerParam = "%1") { From 72f1d70342f68765b114d523af4a6db7e4e719fd Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 27 Oct 2024 16:52:54 +0000 Subject: [PATCH 30/42] Fix log file access through activity watcher icon wasn't showing due to the changes made to how the activity watcher works --- Bloxstrap/Integrations/ActivityWatcher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Integrations/ActivityWatcher.cs b/Bloxstrap/Integrations/ActivityWatcher.cs index 2e0483a..8132250 100644 --- a/Bloxstrap/Integrations/ActivityWatcher.cs +++ b/Bloxstrap/Integrations/ActivityWatcher.cs @@ -102,8 +102,6 @@ await Task.Delay(1000); } - OnLogOpen?.Invoke(this, EventArgs.Empty); - LogLocation = logFileInfo.FullName; } else @@ -111,6 +109,8 @@ logFileInfo = new FileInfo(LogLocation); } + OnLogOpen?.Invoke(this, EventArgs.Empty); + var logFileStream = logFileInfo.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); App.Logger.WriteLine(LOG_IDENT, $"Opened {LogLocation}"); From 705cf078503dfa279282023797c5c73f49faa0a8 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 27 Oct 2024 16:56:50 +0000 Subject: [PATCH 31/42] Update description for supporters page --- Bloxstrap/Resources/Strings.Designer.cs | 3 ++- Bloxstrap/Resources/Strings.resx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 41b4c8f..e175e6c 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -70,7 +70,8 @@ namespace Bloxstrap.Resources { } /// - /// Looks up a localized string similar to These are the people currently supporting Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here!. + /// Looks up a localized string similar to These are the people who've supported Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here! + ///Every person here is ranked by their overall pledge.. /// public static string About_Supporters_Description { get { diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 2b9ca6e..777fd95 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -1118,7 +1118,8 @@ Check if Roblox works with [the original launcher]({1}). If it doesn't, then thi Supporters - These are the people currently supporting Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here! + These are the people who've supported Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here! +Every person here is ranked by their overall pledge. Your Settings could not be loaded. They have been reset to the default configuration. From 637af71299a0bc112bdd65c63d2d3acbae84df99 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 27 Oct 2024 16:58:27 +0000 Subject: [PATCH 32/42] Trim name input in flag editor --- Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorPage.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorPage.xaml.cs b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorPage.xaml.cs index 4577618..b49438d 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorPage.xaml.cs @@ -104,7 +104,7 @@ namespace Bloxstrap.UI.Elements.Settings.Pages return; if (dialog.Tabs.SelectedIndex == 0) - AddSingle(dialog.FlagNameTextBox.Text, dialog.FlagValueTextBox.Text); + AddSingle(dialog.FlagNameTextBox.Text.Trim(), dialog.FlagValueTextBox.Text); else if (dialog.Tabs.SelectedIndex == 1) ImportJSON(dialog.JsonTextBox.Text); } From 59bcf6fd27b9a525f7c013bace61791db70fa783 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 27 Oct 2024 17:15:41 +0000 Subject: [PATCH 33/42] Fix edge case regarding package restoration Exception is thrown if the Downloads folder does not exist when trying to restore the original version of a modded file Addresses #3308 --- Bloxstrap/Bootstrapper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 6b73caa..232081f 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1053,6 +1053,8 @@ namespace Bloxstrap if (_cancelTokenSource.IsCancellationRequested) return; + Directory.CreateDirectory(Paths.Downloads); + string packageUrl = Deployment.GetLocation($"/{_latestVersionGuid}-{package.Name}"); string robloxPackageLocation = Path.Combine(Paths.LocalAppData, "Roblox", "Downloads", package.Signature); From cac081eeb811b64884f27f54cd720664de8daf87 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 27 Oct 2024 20:05:23 +0000 Subject: [PATCH 34/42] Add analytic logging of exceptions --- Bloxstrap/App.xaml.cs | 20 +++++++++++++++++++ Bloxstrap/Logger.cs | 2 ++ .../Elements/Dialogs/ExceptionDialog.xaml.cs | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 7542ed4..5dced57 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -107,6 +107,8 @@ namespace Bloxstrap _showingExceptionDialog = true; + SendLog(); + if (Bootstrapper?.Dialog != null) { if (Bootstrapper.Dialog.TaskbarProgressValue == 0) @@ -159,6 +161,24 @@ namespace Bloxstrap } } + public static async void SendLog() + { + if (!Settings.Prop.EnableAnalytics || !IsProductionBuild) + return; + + try + { + await HttpClient.PostAsync( + $"https://bloxstraplabs.com/metrics/post-exception", + new StringContent(Logger.AsDocument) + ); + } + catch (Exception ex) + { + Logger.WriteException("App::SendLog", ex); + } + } + protected override void OnStartup(StartupEventArgs e) { const string LOG_IDENT = "App::OnStartup"; diff --git a/Bloxstrap/Logger.cs b/Bloxstrap/Logger.cs index ff6db1a..884e077 100644 --- a/Bloxstrap/Logger.cs +++ b/Bloxstrap/Logger.cs @@ -12,6 +12,8 @@ public bool NoWriteMode = false; public string? FileLocation; + public string AsDocument => String.Join('\n', History); + public void Initialize(bool useTempDir = false) { const string LOG_IDENT = "Logger::Initialize"; diff --git a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs index 9301fdf..d1d9411 100644 --- a/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs +++ b/Bloxstrap/UI/Elements/Dialogs/ExceptionDialog.xaml.cs @@ -30,7 +30,7 @@ namespace Bloxstrap.UI.Elements.Dialogs string wikiUrl = $"{repoUrl}/wiki"; string title = HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}"); - string log = HttpUtility.UrlEncode(String.Join('\n', App.Logger.History)); + string log = HttpUtility.UrlEncode(App.Logger.AsDocument); string issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}&log={log}"; @@ -58,7 +58,7 @@ namespace Bloxstrap.UI.Elements.Dialogs if (App.Logger.Initialized && !String.IsNullOrEmpty(App.Logger.FileLocation)) Utilities.ShellExecute(App.Logger.FileLocation); else - Clipboard.SetDataObject(String.Join("\r\n", App.Logger.History)); + Clipboard.SetDataObject(App.Logger.AsDocument); }; CloseButton.Click += delegate From fa7ebf4f9df2bd5fcf65c0857e4046d44b3a9334 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Mon, 28 Oct 2024 00:35:37 +0000 Subject: [PATCH 35/42] Add easy exporting of diagnostic data --- Bloxstrap/Resources/Strings.Designer.cs | 54 +++++++++++++ Bloxstrap/Resources/Strings.resx | 23 ++++++ .../Settings/Pages/BloxstrapPage.xaml | 41 +++++++++- .../ViewModels/Settings/BloxstrapViewModel.cs | 75 ++++++++++++++++++- .../ViewModels/Settings/FastFlagsViewModel.cs | 3 +- 5 files changed, 192 insertions(+), 4 deletions(-) diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index e175e6c..0201300 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -432,6 +432,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Export. + /// + public static string Common_Export { + get { + return ResourceManager.GetString("Common.Export", resourceCulture); + } + } + /// /// Looks up a localized string similar to Help. /// @@ -1386,6 +1395,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Zip archive. + /// + public static string FileTypes_ZipArchive { + get { + return ResourceManager.GetString("FileTypes.ZipArchive", resourceCulture); + } + } + /// /// Looks up a localized string similar to Bloxstrap has been upgraded to v{0}. /// @@ -2103,6 +2121,42 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Gather information that can be uploaded online to troubleshoot a problem you're having.. + /// + public static string Menu_Bloxstrap_ExportData_Description { + get { + return ResourceManager.GetString("Menu.Bloxstrap.ExportData.Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bloxstrap configuration. + /// + public static string Menu_Bloxstrap_ExportData_ExportConfig { + get { + return ResourceManager.GetString("Menu.Bloxstrap.ExportData.ExportConfig", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All Bloxstrap logs. + /// + public static string Menu_Bloxstrap_ExportData_ExportLogs { + get { + return ResourceManager.GetString("Menu.Bloxstrap.ExportData.ExportLogs", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Export diagnostic data. + /// + public static string Menu_Bloxstrap_ExportData_Title { + get { + return ResourceManager.GetString("Menu.Bloxstrap.ExportData.Title", resourceCulture); + } + } + /// /// Looks up a localized string similar to Add new. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index 777fd95..aea14a5 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -906,6 +906,7 @@ Selecting 'No' will ignore this warning and continue installation. JSON files + Shown in the open file dialog, where the file type selection dropdown is, e.g. "JSON files (*.json)" The entry for '{0}' is not valid as the value must be a boolean (either 'True' or 'False') @@ -1248,4 +1249,26 @@ Would you like to enable test mode? Please close any applications that may be using Roblox's files, and relaunch. This is *not* for when Roblox is still running when trying to upgrade. This applies to files being open (i.e. image assets) + + Zip archive + Shown in the save file dialog, where the file type selection dropdown is, e.g. "Zip archive (*.zip)" + + + Export + Currently used under the "Bloxstrap" settings tab for the button to export diagnostic data + + + Export diagnostic data + + + Gather information that can be uploaded online to troubleshoot a problem you're having. + + + Bloxstrap configuration + Label that appears next to a checkbox + + + All Bloxstrap logs + Label that appears next to a checkbox + \ No newline at end of file diff --git a/Bloxstrap/UI/Elements/Settings/Pages/BloxstrapPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/BloxstrapPage.xaml index d96f081..d4f731a 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/BloxstrapPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/BloxstrapPage.xaml @@ -8,7 +8,7 @@ xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls" xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels.Settings" xmlns:resources="clr-namespace:Bloxstrap.Resources" - d:DataContext="{d:DesignInstance Type=models:BehaviourViewModel}" + d:DataContext="{d:DesignInstance Type=models:BloxstrapViewModel}" mc:Ignorable="d" d:DesignHeight="600" d:DesignWidth="800" Title="BehaviourPage" @@ -28,5 +28,44 @@ Description="{Binding Source={x:Static resources:Strings.Menu_Bloxstrap_Analytics_Description}, Converter={StaticResource StringFormatConverter}, ConverterParameter='https://github.com/bloxstraplabs/bloxstrap/wiki/Privacy-Policy#analytical-functionality'}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Bloxstrap/UI/ViewModels/Settings/BloxstrapViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/BloxstrapViewModel.cs index bd913d1..016f69f 100644 --- a/Bloxstrap/UI/ViewModels/Settings/BloxstrapViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/BloxstrapViewModel.cs @@ -1,4 +1,9 @@ -namespace Bloxstrap.UI.ViewModels.Settings +using System.Windows.Input; +using CommunityToolkit.Mvvm.Input; +using ICSharpCode.SharpZipLib.Zip; +using Microsoft.Win32; + +namespace Bloxstrap.UI.ViewModels.Settings { public class BloxstrapViewModel : NotifyPropertyChangedViewModel { @@ -13,5 +18,73 @@ get => App.Settings.Prop.EnableAnalytics; set => App.Settings.Prop.EnableAnalytics = value; } + + public bool ShouldExportConfig { get; set; } = true; + + public bool ShouldExportLogs { get; set; } = true; + + public ICommand ExportDataCommand => new RelayCommand(ExportData); + + private void ExportData() + { + string timestamp = DateTime.UtcNow.ToString("yyyyMMdd'T'HHmmss'Z'"); + + var dialog = new SaveFileDialog + { + FileName = $"Bloxstrap-export-{timestamp}.zip", + Filter = $"{Strings.FileTypes_ZipArchive}|*.zip" + }; + + if (dialog.ShowDialog() != true) + return; + + using var memStream = new MemoryStream(); + using var zipStream = new ZipOutputStream(memStream); + + if (ShouldExportConfig) + { + var files = new List() + { + App.Settings.FileLocation, + App.State.FileLocation, + App.FastFlags.FileLocation + }; + + AddFilesToZipStream(zipStream, files, "Config/"); + } + + if (ShouldExportLogs && Directory.Exists(Paths.Logs)) + { + var files = Directory.GetFiles(Paths.Logs) + .Where(x => !x.Equals(App.Logger.FileLocation, StringComparison.OrdinalIgnoreCase)); + + AddFilesToZipStream(zipStream, files, "Logs/"); + } + + zipStream.CloseEntry(); + memStream.Position = 0; + + using var outputStream = File.OpenWrite(dialog.FileName); + memStream.CopyTo(outputStream); + + Process.Start("explorer.exe", $"/select,\"{dialog.FileName}\""); + } + + private void AddFilesToZipStream(ZipOutputStream zipStream, IEnumerable files, string directory) + { + foreach (string file in files) + { + if (!File.Exists(file)) + continue; + + var entry = new ZipEntry(directory + Path.GetFileName(file)); + entry.DateTime = DateTime.Now; + + zipStream.PutNextEntry(entry); + + using var fileStream = File.OpenRead(file); + fileStream.CopyTo(zipStream); + } + } } } diff --git a/Bloxstrap/UI/ViewModels/Settings/FastFlagsViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/FastFlagsViewModel.cs index cc1df4f..7f63032 100644 --- a/Bloxstrap/UI/ViewModels/Settings/FastFlagsViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/FastFlagsViewModel.cs @@ -1,5 +1,4 @@ -using System.Windows; -using System.Windows.Input; +using System.Windows.Input; using CommunityToolkit.Mvvm.Input; From ba561a2421a9d07c8154cf9ae004eb0555bf37a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 09:18:35 +0000 Subject: [PATCH 36/42] Bump wpfui from `c4c58c5` to `9080158` (#3470) Bumps [wpfui](https://github.com/bloxstraplabs/wpfui) from `c4c58c5` to `9080158`. - [Commits](https://github.com/bloxstraplabs/wpfui/compare/c4c58c589970a66b27a9de41ab1b6b6539918b52...9080158ba8d496501146d1167aae910898eff9af) --- updated-dependencies: - dependency-name: wpfui dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- wpfui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpfui b/wpfui index c4c58c5..9080158 160000 --- a/wpfui +++ b/wpfui @@ -1 +1 @@ -Subproject commit c4c58c589970a66b27a9de41ab1b6b6539918b52 +Subproject commit 9080158ba8d496501146d1167aae910898eff9af From bd506ae54567f62f94a99ba7a95295ce24e72af0 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 29 Oct 2024 21:54:35 +0000 Subject: [PATCH 37/42] Improve handling of bootstrapper connection errors --- Bloxstrap/Bootstrapper.cs | 37 +++++++++++-------- .../Exceptions/InvalidChannelException.cs | 10 +++++ Bloxstrap/Resources/Strings.Designer.cs | 27 +++++--------- Bloxstrap/Resources/Strings.resx | 7 +--- Bloxstrap/RobloxInterfaces/Deployment.cs | 21 ++++++++--- 5 files changed, 57 insertions(+), 45 deletions(-) create mode 100644 Bloxstrap/Exceptions/InvalidChannelException.cs diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 232081f..409c8d0 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -125,15 +125,14 @@ namespace Bloxstrap App.Logger.WriteLine(LOG_IDENT, "Connectivity check failed"); App.Logger.WriteException(LOG_IDENT, exception); - string message = Strings.Dialog_Connectivity_Preventing; + string message = Strings.Dialog_Connectivity_BadConnection; - if (exception.GetType() == typeof(AggregateException)) + if (exception is AggregateException) exception = exception.InnerException!; - if (exception.GetType() == typeof(HttpRequestException)) + // https://gist.github.com/pizzaboxer/4b58303589ee5b14cc64397460a8f386 + if (exception is HttpRequestException && exception.InnerException is null) message = String.Format(Strings.Dialog_Connectivity_RobloxDown, "[status.roblox.com](https://status.roblox.com)"); - else if (exception.GetType() == typeof(TaskCanceledException)) - message = Strings.Dialog_Connectivity_TimedOut; if (_mustUpgrade) message += $"\n\n{Strings.Dialog_Connectivity_RobloxUpgradeNeeded}\n\n{Strings.Dialog_Connectivity_TryAgainLater}"; @@ -252,6 +251,10 @@ namespace Bloxstrap Dialog?.CloseBootstrapper(); } + /// + /// Will throw whatever HttpClient can throw + /// + /// private async Task GetLatestVersionInfo() { const string LOG_IDENT = "Bootstrapper::GetLatestVersionInfo"; @@ -262,7 +265,11 @@ namespace Bloxstrap using var key = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\ROBLOX Corporation\\Environments\\{AppData.RegistryName}\\Channel"); - var match = Regex.Match(App.LaunchSettings.RobloxLaunchArgs, "channel:([a-zA-Z0-9-_]+)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); + var match = Regex.Match( + App.LaunchSettings.RobloxLaunchArgs, + "channel:([a-zA-Z0-9-_]+)", + RegexOptions.IgnoreCase | RegexOptions.CultureInvariant + ); if (match.Groups.Count == 2) { @@ -273,9 +280,12 @@ namespace Bloxstrap Deployment.Channel = value.ToLowerInvariant(); } - App.Logger.WriteLine(LOG_IDENT, "Got channel as " + (String.IsNullOrEmpty(Deployment.Channel) ? Deployment.DefaultChannel : Deployment.Channel)); + if (String.IsNullOrEmpty(Deployment.Channel)) + Deployment.Channel = Deployment.DefaultChannel; - if (Deployment.Channel != "production") + App.Logger.WriteLine(LOG_IDENT, $"Got channel as {Deployment.DefaultChannel}"); + + if (!Deployment.IsDefaultChannel) App.SendStat("robloxChannel", Deployment.Channel); ClientVersion clientVersion; @@ -284,14 +294,9 @@ namespace Bloxstrap { clientVersion = await Deployment.GetInfo(); } - catch (HttpRequestException ex) + catch (InvalidChannelException ex) { - if (ex.StatusCode is not HttpStatusCode.Unauthorized - and not HttpStatusCode.Forbidden - and not HttpStatusCode.NotFound) - throw; - - App.Logger.WriteLine(LOG_IDENT, $"Changing channel from {Deployment.Channel} to {Deployment.DefaultChannel} because HTTP {(int)ex.StatusCode}"); + App.Logger.WriteLine(LOG_IDENT, $"Resetting channel from {Deployment.Channel} because {ex.StatusCode}"); Deployment.Channel = Deployment.DefaultChannel; clientVersion = await Deployment.GetInfo(); @@ -299,7 +304,7 @@ namespace Bloxstrap if (clientVersion.IsBehindDefaultChannel) { - App.Logger.WriteLine(LOG_IDENT, $"Changing channel from {Deployment.Channel} to {Deployment.DefaultChannel} because channel is behind production"); + App.Logger.WriteLine(LOG_IDENT, $"Resetting channel from {Deployment.Channel} because it's behind production"); Deployment.Channel = Deployment.DefaultChannel; clientVersion = await Deployment.GetInfo(); diff --git a/Bloxstrap/Exceptions/InvalidChannelException.cs b/Bloxstrap/Exceptions/InvalidChannelException.cs new file mode 100644 index 0000000..eff6d79 --- /dev/null +++ b/Bloxstrap/Exceptions/InvalidChannelException.cs @@ -0,0 +1,10 @@ +namespace Bloxstrap.Exceptions +{ + public class InvalidChannelException : Exception + { + public HttpStatusCode? StatusCode; + + public InvalidChannelException(HttpStatusCode? statusCode) : base() + => StatusCode = statusCode; + } +} diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 0201300..f50f201 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -838,6 +838,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to A connection could not be made, which likely indicates a poor internet connection or a firewall block. If your connection is fine, please ensure that your antivirus isn't blocking Bloxstrap.. + /// + public static string Dialog_Connectivity_BadConnection { + get { + return ResourceManager.GetString("Dialog.Connectivity.BadConnection", resourceCulture); + } + } + /// /// Looks up a localized string similar to More information:. /// @@ -847,15 +856,6 @@ namespace Bloxstrap.Resources { } } - /// - /// Looks up a localized string similar to Something is likely preventing Bloxstrap from connecting to the internet.. - /// - public static string Dialog_Connectivity_Preventing { - get { - return ResourceManager.GetString("Dialog.Connectivity.Preventing", resourceCulture); - } - } - /// /// Looks up a localized string similar to Roblox may be down right now. See {0} for more information.. /// @@ -883,15 +883,6 @@ namespace Bloxstrap.Resources { } } - /// - /// Looks up a localized string similar to The connection timed out, which could indicate a poor internet connection or a firewall block.. - /// - public static string Dialog_Connectivity_TimedOut { - get { - return ResourceManager.GetString("Dialog.Connectivity.TimedOut", resourceCulture); - } - } - /// /// Looks up a localized string similar to Connectivity error. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index aea14a5..96f6d0b 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -123,14 +123,11 @@ Roblox is currently running, and launching another instance will close it. Are you sure you want to continue launching? - - Something is likely preventing Bloxstrap from connecting to the internet. - Roblox may be down right now. See {0} for more information. - - The connection timed out, which could indicate a poor internet connection or a firewall block. + + A connection could not be made, which likely indicates a poor internet connection or a firewall block. If your connection is fine, please ensure that your antivirus isn't blocking Bloxstrap. You must first install Bloxstrap before uninstalling. diff --git a/Bloxstrap/RobloxInterfaces/Deployment.cs b/Bloxstrap/RobloxInterfaces/Deployment.cs index f6ee997..da88c14 100644 --- a/Bloxstrap/RobloxInterfaces/Deployment.cs +++ b/Bloxstrap/RobloxInterfaces/Deployment.cs @@ -10,10 +10,17 @@ public static string BinaryType = "WindowsPlayer"; - public static bool IsDefaultChannel => String.Compare(Channel, DefaultChannel, StringComparison.OrdinalIgnoreCase) == 0; + public static bool IsDefaultChannel => Channel.Equals(DefaultChannel, StringComparison.OrdinalIgnoreCase); public static string BaseUrl { get; private set; } = null!; - + + public static readonly List BadChannelCodes = new() + { + HttpStatusCode.Unauthorized, + HttpStatusCode.Forbidden, + HttpStatusCode.NotFound + }; + private static readonly Dictionary ClientVersionCache = new(); // a list of roblox deployment locations that we check for, in case one of them don't work @@ -97,7 +104,9 @@ { if (exceptions.Any()) return exceptions[0]; - return new TaskCanceledException("All tasks have been cancelled"); // we can't add TaskCanceledExceptions to the list + + // task cancellation exceptions don't get added to the list + return new TaskCanceledException("All connection attempts timed out."); } App.Logger.WriteLine(LOG_IDENT, $"Got {BaseUrl} as the optimal base URL"); @@ -157,10 +166,10 @@ { clientVersion = await Http.GetJson("https://clientsettingscdn.roblox.com" + path); } - catch (HttpRequestException) + catch (HttpRequestException httpEx) + when (!isDefaultChannel && BadChannelCodes.Contains(httpEx.StatusCode)) { - // throw up the exception handler chain, as we shouldn't be the one handling it - throw; + throw new InvalidChannelException(httpEx.StatusCode); } catch (Exception ex) { From 2c70430dfa312762cb6aa10fd74486cd00773419 Mon Sep 17 00:00:00 2001 From: Matt <97983689+bluepilledgreat@users.noreply.github.com> Date: Tue, 29 Oct 2024 21:55:34 +0000 Subject: [PATCH 38/42] improve the flag editor warning viewmodel (#3532) * improve the flag editor warning viewmodel - no longer creates a new viewmodel every page reload - fixes an oversight * stop countdown on unload * move the viewmodel to a variable makes everything look cleaner * remove initialload check --- .../Pages/FastFlagEditorWarningPage.xaml | 1 + .../Pages/FastFlagEditorWarningPage.xaml.cs | 19 +++++----- .../FastFlagEditorWarningViewModel.cs | 37 ++++++++++++++++--- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml index 9a2b938..55b0d71 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml +++ b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml @@ -10,6 +10,7 @@ d:DesignHeight="450" d:DesignWidth="800" Scrollable="True" Loaded="Page_Loaded" + Unloaded="Page_Unloaded" Title="FastFlagEditorWarningPage"> diff --git a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs index 89d1e4c..9b3b08a 100644 --- a/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs +++ b/Bloxstrap/UI/Elements/Settings/Pages/FastFlagEditorWarningPage.xaml.cs @@ -8,25 +8,24 @@ namespace Bloxstrap.UI.Elements.Settings.Pages /// public partial class FastFlagEditorWarningPage { - private bool _initialLoad = false; + private FastFlagEditorWarningViewModel _viewModel; public FastFlagEditorWarningPage() { - DataContext = new FastFlagEditorWarningViewModel(this); + _viewModel = new FastFlagEditorWarningViewModel(this); + DataContext = _viewModel; + InitializeComponent(); } private void Page_Loaded(object sender, RoutedEventArgs e) { - // refresh datacontext on page load to reset timer + _viewModel.StartCountdown(); + } - if (!_initialLoad) - { - _initialLoad = true; - return; - } - - DataContext = new FastFlagEditorWarningViewModel(this); + private void Page_Unloaded(object sender, RoutedEventArgs e) + { + _viewModel.StopCountdown(); } } } diff --git a/Bloxstrap/UI/ViewModels/Settings/FastFlagEditorWarningViewModel.cs b/Bloxstrap/UI/ViewModels/Settings/FastFlagEditorWarningViewModel.cs index c335d35..957f62b 100644 --- a/Bloxstrap/UI/ViewModels/Settings/FastFlagEditorWarningViewModel.cs +++ b/Bloxstrap/UI/ViewModels/Settings/FastFlagEditorWarningViewModel.cs @@ -13,6 +13,8 @@ namespace Bloxstrap.UI.ViewModels.Settings { private Page _page; + private CancellationTokenSource? _cancellationTokenSource; + public string ContinueButtonText { get; set; } = ""; public bool CanContinue { get; set; } = false; @@ -24,17 +26,40 @@ namespace Bloxstrap.UI.ViewModels.Settings public FastFlagEditorWarningViewModel(Page page) { _page = page; - DoCountdown(); } - private async void DoCountdown() + public void StopCountdown() { + _cancellationTokenSource?.Cancel(); + _cancellationTokenSource = null; + } + + public void StartCountdown() + { + StopCountdown(); + + _cancellationTokenSource = new CancellationTokenSource(); + DoCountdown(_cancellationTokenSource.Token); + } + + private async void DoCountdown(CancellationToken token) + { + CanContinue = false; + OnPropertyChanged(nameof(CanContinue)); + for (int i = 10; i > 0; i--) { ContinueButtonText = $"({i}) {Strings.Menu_FastFlagEditor_Warning_Continue}"; OnPropertyChanged(nameof(ContinueButtonText)); - await Task.Delay(1000); + try + { + await Task.Delay(1000, token); + } + catch (TaskCanceledException) + { + return; + } } ContinueButtonText = Strings.Menu_FastFlagEditor_Warning_Continue; @@ -42,9 +67,6 @@ namespace Bloxstrap.UI.ViewModels.Settings CanContinue = true; OnPropertyChanged(nameof(CanContinue)); - - App.State.Prop.ShowFFlagEditorWarning = false; - App.State.Save(); } private void Continue() @@ -52,6 +74,9 @@ namespace Bloxstrap.UI.ViewModels.Settings if (!CanContinue) return; + App.State.Prop.ShowFFlagEditorWarning = false; + App.State.Save(); // should we be force saving here? + if (Window.GetWindow(_page) is INavigationWindow window) window.Navigate(typeof(FastFlagEditorPage)); } From 749a8d6f3a2d33b6e1ae7598f9eef99b3f372863 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 29 Oct 2024 22:07:23 +0000 Subject: [PATCH 39/42] Add package entry for platform-dictionaries on my life this is the *LAST* time we are doing this - i didn't get time to implement a remote config package map system --- Bloxstrap/AppData/CommonAppData.cs | 1 + Bloxstrap/Bootstrapper.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/AppData/CommonAppData.cs b/Bloxstrap/AppData/CommonAppData.cs index 4a74118..54aaaa0 100644 --- a/Bloxstrap/AppData/CommonAppData.cs +++ b/Bloxstrap/AppData/CommonAppData.cs @@ -32,6 +32,7 @@ namespace Bloxstrap.AppData { "content-textures3.zip", @"PlatformContent\pc\textures\" }, { "content-terrain.zip", @"PlatformContent\pc\terrain\" }, { "content-platform-fonts.zip", @"PlatformContent\pc\fonts\" }, + { "content-platform-dictionaries.zip", @"PlatformContent\pc\shared_compression_dictionaries\" }, { "extracontent-luapackages.zip", @"ExtraContent\LuaPackages\" }, { "extracontent-translations.zip", @"ExtraContent\translations\" }, diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 409c8d0..207c4a4 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1193,7 +1193,15 @@ namespace Bloxstrap { const string LOG_IDENT = "Bootstrapper::ExtractPackage"; - string packageFolder = Path.Combine(AppData.Directory, AppData.PackageDirectoryMap[package.Name]); + string? packageDir = AppData.PackageDirectoryMap.GetValueOrDefault(package.Name); + + if (packageDir is null) + { + App.Logger.WriteLine(LOG_IDENT, $"WARNING: {package.Name} was not found in the package map!"); + return; + } + + string packageFolder = Path.Combine(AppData.Directory, packageDir); string? fileFilter = null; // for sharpziplib, each file in the filter needs to be a regex From 49b1eb056935a6f99090a353558ee7d3291f87da Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 29 Oct 2024 22:08:36 +0000 Subject: [PATCH 40/42] Update ci-release.yml --- .github/workflows/ci-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 39087c1..4038dcb 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -79,7 +79,7 @@ jobs: api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' organization-id: '107b3de5-057b-42fc-a985-3546e4261775' project-slug: 'bloxstrap' - signing-policy-slug: 'test-signing' + signing-policy-slug: 'release-signing' artifact-configuration-slug: 'github-ci' github-artifact-id: '${{ needs.build.outputs.artifact-id }}' wait-for-completion: true From 2be2f4d0d275e60eabf2f63ecbbe4e38b2aa0773 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 29 Oct 2024 22:32:30 +0000 Subject: [PATCH 41/42] Enable code signing on production releases --- .github/workflows/ci-release.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 4038dcb..7d2c607 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -39,17 +39,17 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') steps: - # - name: Sign and download artifact - # uses: signpath/github-action-submit-signing-request@v1 - # with: - # api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' - # organization-id: '107b3de5-057b-42fc-a985-3546e4261775' - # project-slug: 'bloxstrap' - # signing-policy-slug: 'release-signing' - # artifact-configuration-slug: 'github-ci' - # github-artifact-id: '${{ needs.build.outputs.artifact-id }}' - # wait-for-completion: true - # output-artifact-directory: 'release' + - name: Sign and download artifact + uses: signpath/github-action-submit-signing-request@v1 + with: + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' + organization-id: '107b3de5-057b-42fc-a985-3546e4261775' + project-slug: 'bloxstrap' + signing-policy-slug: 'release-signing' + artifact-configuration-slug: 'github-ci' + github-artifact-id: '${{ needs.build.outputs.artifact-id }}' + wait-for-completion: true + output-artifact-directory: 'release' - name: Download x64 release artifact uses: actions/download-artifact@v4 From 7bc95e7dd4e97afa5de40d88f94af25695fd3b64 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Tue, 29 Oct 2024 23:32:28 +0000 Subject: [PATCH 42/42] Enable code signing *for real this time* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 😭 --- .github/workflows/ci-release.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 7d2c607..caf8255 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -51,12 +51,6 @@ jobs: wait-for-completion: true output-artifact-directory: 'release' - - name: Download x64 release artifact - uses: actions/download-artifact@v4 - with: - name: Bloxstrap (Release) (${{ github.sha }}) - path: release - - name: Rename binaries run: mv release/Bloxstrap.exe Bloxstrap-${{ github.ref_name }}.exe