From c5c5ff96f337b8d37e586b774aeb84ca3c45019a Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Wed, 4 Oct 2023 14:18:16 +0100 Subject: [PATCH] fix studio auth --- Bloxstrap/App.xaml.cs | 9 +++++++-- Bloxstrap/Bootstrapper.cs | 26 +++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index d0ac99ed..86ae9150 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -1,4 +1,5 @@ using System.Reflection; +using System.Web; using System.Windows; using System.Windows.Threading; @@ -194,6 +195,7 @@ protected override void OnStartup(StartupEventArgs e) string commandLine = ""; bool isStudioLaunch = false; + bool isStudioAuth = false; if (IsMenuLaunch) { @@ -235,12 +237,15 @@ protected override void OnStartup(StartupEventArgs e) else if (LaunchArgs[0].StartsWith("roblox-studio:")) { commandLine = ProtocolHandler.ParseUri(LaunchArgs[0]); + if (!commandLine.Contains("-startEvent")) + commandLine += " -startEvent www.roblox.com/robloxQTStudioStartedEvent"; isStudioLaunch = true; } else if (LaunchArgs[0].StartsWith("roblox-studio-auth:")) { - commandLine = LaunchArgs[0]; + commandLine = HttpUtility.UrlDecode(LaunchArgs[0]); isStudioLaunch = true; + isStudioAuth = true; } else { @@ -259,7 +264,7 @@ protected override void OnStartup(StartupEventArgs e) // start bootstrapper and show the bootstrapper modal if we're not running silently Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper"); - Bootstrapper bootstrapper = new(commandLine, isStudioLaunch); + Bootstrapper bootstrapper = new(commandLine, isStudioLaunch, isStudioAuth); IBootstrapperDialog? dialog = null; if (!IsQuiet) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 8b3af029..a5c73a98 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -27,6 +27,7 @@ public class Bootstrapper private string _launchCommandLine; private bool _studioLaunch; + private bool _studioAuth; private string _versionGuid { @@ -61,10 +62,11 @@ private string _versionGuid #endregion #region Core - public Bootstrapper(string launchCommandLine, bool studioLaunch) + public Bootstrapper(string launchCommandLine, bool studioLaunch, bool studioAuth) { _launchCommandLine = launchCommandLine; _studioLaunch = studioLaunch; + _studioAuth = studioAuth; } private void SetStatus(string message) @@ -286,14 +288,17 @@ private async Task StartRoblox() return; } - _launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString()); + if (!_studioAuth) + { + _launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString()); - _launchCommandLine += " -channel "; + _launchCommandLine += " -channel "; - if (App.Settings.Prop.Channel.ToLowerInvariant() == RobloxDeployment.DefaultChannel.ToLowerInvariant()) - _launchCommandLine += "production"; - else - _launchCommandLine += App.Settings.Prop.Channel.ToLowerInvariant(); + if (App.Settings.Prop.Channel.ToLowerInvariant() == RobloxDeployment.DefaultChannel.ToLowerInvariant()) + _launchCommandLine += "production"; + else + _launchCommandLine += App.Settings.Prop.Channel.ToLowerInvariant(); + } // whether we should wait for roblox to exit to handle stuff in the background or clean up after roblox closes bool shouldWait = false; @@ -305,6 +310,13 @@ private async Task StartRoblox() WorkingDirectory = _versionFolder }; + if (_studioAuth) + { + Process.Start(startInfo); + Dialog?.CloseBootstrapper(); + return; + } + // v2.2.0 - byfron will trip if we keep a process handle open for over a minute, so we're doing this now int gameClientPid; using (Process gameClient = Process.Start(startInfo)!)