Skip to content

Commit

Permalink
fix studio auth
Browse files Browse the repository at this point in the history
  • Loading branch information
bluepilledgreat committed Oct 4, 2023
1 parent f426e6d commit c5c5ff9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
9 changes: 7 additions & 2 deletions Bloxstrap/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.Web;
using System.Windows;
using System.Windows.Threading;

Expand Down Expand Up @@ -194,6 +195,7 @@ protected override void OnStartup(StartupEventArgs e)

string commandLine = "";
bool isStudioLaunch = false;
bool isStudioAuth = false;

if (IsMenuLaunch)
{
Expand Down Expand Up @@ -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
{
Expand All @@ -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)
Expand Down
26 changes: 19 additions & 7 deletions Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class Bootstrapper

private string _launchCommandLine;
private bool _studioLaunch;
private bool _studioAuth;

private string _versionGuid
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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)!)
Expand Down

0 comments on commit c5c5ff9

Please sign in to comment.