Skip to content

Commit

Permalink
Merge branch 'bloxstraplabs:main' into integrations-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
CubesterYT authored Mar 2, 2025
2 parents 9700c61 + f0df615 commit c78b04d
Show file tree
Hide file tree
Showing 44 changed files with 6,955 additions and 870 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ body:
description: Provide a comprehensive description of the problem you're facing. Don't forget to attach any additional resources you may have, such as log files and screenshots.
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: How do you reproduce the problem?
description: Include the steps to reproduce the problem from start to finish. Include details such as FastFlags you added and settings you changed.
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
- type: textarea
id: log
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

steps:
- name: Sign and download artifact
uses: signpath/github-action-submit-signing-request@v1
uses: signpath/github-action-submit-signing-request@v1.1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '107b3de5-057b-42fc-a985-3546e4261775'
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

steps:
- name: Sign and download artifact
uses: signpath/github-action-submit-signing-request@v1
uses: signpath/github-action-submit-signing-request@v1.1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '107b3de5-057b-42fc-a985-3546e4261775'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: vedantmgoyal2009/winget-releaser@v2
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: pizzaboxer.Bloxstrap
token: ${{ secrets.WINGET_TOKEN }}
26 changes: 26 additions & 0 deletions Bloxstrap/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ await HttpClient.PostAsync(
}
}

public static void AssertWindowsOSVersion()
{
const string LOG_IDENT = "App::AssertWindowsOSVersion";

int major = Environment.OSVersion.Version.Major;
if (major < 10) // Windows 10 and newer only
{
Logger.WriteLine(LOG_IDENT, $"Detected unsupported Windows version ({Environment.OSVersion.Version}).");

if (!LaunchSettings.QuietFlag.Active)
Frontend.ShowMessageBox(Strings.App_OSDeprecation_Win7_81, MessageBoxImage.Error);

Terminate(ErrorCode.ERROR_INVALID_FUNCTION);
}
}

protected override void OnStartup(StartupEventArgs e)
{
const string LOG_IDENT = "App::OnStartup";
Expand Down Expand Up @@ -213,6 +229,8 @@ protected override void OnStartup(StartupEventArgs e)
#endif
}

Logger.WriteLine(LOG_IDENT, $"OSVersion: {Environment.OSVersion}");

Logger.WriteLine(LOG_IDENT, $"Loaded from {Paths.Process}");
Logger.WriteLine(LOG_IDENT, $"Temp path is {Paths.Temp}");
Logger.WriteLine(LOG_IDENT, $"WindowsStartMenu path is {Paths.WindowsStartMenu}");
Expand Down Expand Up @@ -291,15 +309,22 @@ protected override void OnStartup(StartupEventArgs e)
if (installLocation is null)
{
Logger.Initialize(true);
Logger.WriteLine(LOG_IDENT, "Not installed, launching the installer");
AssertWindowsOSVersion(); // prevent new installs from unsupported operating systems
LaunchHandler.LaunchInstaller();
}
else
{
Paths.Initialize(installLocation);

Logger.WriteLine(LOG_IDENT, "Entering main logic");

// ensure executable is in the install directory
if (Paths.Process != Paths.Application && !File.Exists(Paths.Application))
{
Logger.WriteLine(LOG_IDENT, "Copying to install directory");
File.Copy(Paths.Process, Paths.Application);
}

Logger.Initialize(LaunchSettings.UninstallFlag.Active);

Expand Down Expand Up @@ -328,6 +353,7 @@ protected override void OnStartup(StartupEventArgs e)
}

// you must *explicitly* call terminate when everything is done, it won't be called implicitly
Logger.WriteLine(LOG_IDENT, "Startup finished");
}
}
}
4 changes: 2 additions & 2 deletions Bloxstrap/Bloxstrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<UseWPF>true</UseWPF>
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Bloxstrap.ico</ApplicationIcon>
<Version>2.8.2</Version>
<FileVersion>2.8.2</FileVersion>
<Version>2.8.6</Version>
<FileVersion>2.8.6</FileVersion>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
Expand Down
52 changes: 43 additions & 9 deletions Bloxstrap/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public async Task Run()
}
#endif

App.AssertWindowsOSVersion();

// ensure only one instance of the bootstrapper is running at the time
// so that we don't have stuff like two updates happening simultaneously

Expand Down Expand Up @@ -303,14 +305,6 @@ private async Task GetLatestVersionInfo()
clientVersion = await Deployment.GetInfo();
}

if (clientVersion.IsBehindDefaultChannel)
{
App.Logger.WriteLine(LOG_IDENT, $"Resetting channel from {Deployment.Channel} because it's behind production");

Deployment.Channel = Deployment.DefaultChannel;
clientVersion = await Deployment.GetInfo();
}

key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);

_latestVersionGuid = clientVersion.VersionGuid;
Expand Down Expand Up @@ -665,7 +659,7 @@ private void CleanupVersionsFolder()
{
Directory.Delete(dir, true);
}
catch (IOException ex)
catch (Exception ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Failed to delete {dir}");
App.Logger.WriteException(LOG_IDENT, ex);
Expand Down Expand Up @@ -693,6 +687,28 @@ private void MigrateCompatibilityFlags()
}
}

private static void KillRobloxPlayers()
{
const string LOG_IDENT = "Bootstrapper::KillRobloxPlayers";

List<Process> processes = new List<Process>();
processes.AddRange(Process.GetProcessesByName("RobloxPlayerBeta"));
processes.AddRange(Process.GetProcessesByName("RobloxCrashHandler")); // roblox studio doesnt depend on crash handler being open, so this should be fine

foreach (Process process in processes)
{
try
{
process.Kill();
}
catch (Exception ex)
{
App.Logger.WriteLine(LOG_IDENT, $"Failed to close process {process.Id}");
App.Logger.WriteException(LOG_IDENT, ex);
}
}
}

private async Task UpgradeRoblox()
{
const string LOG_IDENT = "Bootstrapper::UpgradeRoblox";
Expand All @@ -708,6 +724,24 @@ private async Task UpgradeRoblox()

_isInstalling = true;

// make sure nothing is running before continuing upgrade
if (!IsStudioLaunch) // TODO: wait for studio processes to close before updating to prevent data loss
KillRobloxPlayers();

// get a fully clean install
if (Directory.Exists(_latestVersionDirectory))
{
try
{
Directory.Delete(_latestVersionDirectory, true);
}
catch (Exception ex)
{
App.Logger.WriteLine(LOG_IDENT, "Failed to delete the latest version directory");
App.Logger.WriteException(LOG_IDENT, ex);
}
}

Directory.CreateDirectory(_latestVersionDirectory);

var cachedPackageHashes = Directory.GetFiles(Paths.Downloads).Select(x => Path.GetFileName(x));
Expand Down
37 changes: 30 additions & 7 deletions Bloxstrap/Installer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ namespace Bloxstrap
{
internal class Installer
{
/// <summary>
/// Should this version automatically open the release notes page?
/// Recommended for major updates only.
/// </summary>
private const bool OpenReleaseNotes = false;

private static string DesktopShortcut => Path.Combine(Paths.Desktop, $"{App.ProjectName}.lnk");

private static string StartMenuShortcut => Path.Combine(Paths.WindowsStartMenu, $"{App.ProjectName}.lnk");
Expand Down Expand Up @@ -565,18 +571,32 @@ public static void HandleUpgrade()

if (Utilities.CompareVersions(existingVer, "2.8.2") == VersionComparison.LessThan)
{
try
{
Directory.Delete(Path.Combine(Paths.Base, "Roblox"), true);
}
catch (Exception ex)
string robloxDirectory = Path.Combine(Paths.Base, "Roblox");

if (Directory.Exists(robloxDirectory))
{
App.Logger.WriteException(LOG_IDENT, ex);
try
{
Directory.Delete(robloxDirectory, true);
}
catch (Exception ex)
{
App.Logger.WriteLine(LOG_IDENT, "Failed to delete the Roblox directory");
App.Logger.WriteException(LOG_IDENT, ex);
}
}
}

if (Utilities.CompareVersions(existingVer, "2.8.3") == VersionComparison.LessThan)
{
// force reinstallation
App.State.Prop.Player.VersionGuid = "";
App.State.Prop.Studio.VersionGuid = "";
}

App.Settings.Save();
App.FastFlags.Save();
App.State.Save();
}

if (currentVer is null)
Expand All @@ -586,7 +606,10 @@ public static void HandleUpgrade()

if (isAutoUpgrade)
{
Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/wiki/Release-notes-for-Bloxstrap-v{currentVer}");
#pragma warning disable CS0162 // Unreachable code detected
if (OpenReleaseNotes)
Utilities.ShellExecute($"https://github.com/{App.ProjectRepository}/wiki/Release-notes-for-Bloxstrap-v{currentVer}");
#pragma warning restore CS0162 // Unreachable code detected
}
else
{
Expand Down
28 changes: 28 additions & 0 deletions Bloxstrap/LaunchHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,68 @@ public static class LaunchHandler
{
public static void ProcessNextAction(NextAction action, bool isUnfinishedInstall = false)
{
const string LOG_IDENT = "LaunchHandler::ProcessNextAction";

switch (action)
{
case NextAction.LaunchSettings:
App.Logger.WriteLine(LOG_IDENT, "Opening settings");
LaunchSettings();
break;

case NextAction.LaunchRoblox:
App.Logger.WriteLine(LOG_IDENT, "Opening Roblox");
LaunchRoblox(LaunchMode.Player);
break;

case NextAction.LaunchRobloxStudio:
App.Logger.WriteLine(LOG_IDENT, "Opening Roblox Studio");
LaunchRoblox(LaunchMode.Studio);
break;

default:
App.Logger.WriteLine(LOG_IDENT, "Closing");
App.Terminate(isUnfinishedInstall ? ErrorCode.ERROR_INSTALL_USEREXIT : ErrorCode.ERROR_SUCCESS);
break;
}
}

public static void ProcessLaunchArgs()
{
const string LOG_IDENT = "LaunchHandler::ProcessLaunchArgs";

// this order is specific

if (App.LaunchSettings.UninstallFlag.Active)
{
App.Logger.WriteLine(LOG_IDENT, "Opening uninstaller");
LaunchUninstaller();
}
else if (App.LaunchSettings.MenuFlag.Active)
{
App.Logger.WriteLine(LOG_IDENT, "Opening settings");
LaunchSettings();
}
else if (App.LaunchSettings.WatcherFlag.Active)
{
App.Logger.WriteLine(LOG_IDENT, "Opening watcher");
LaunchWatcher();
}
else if (App.LaunchSettings.RobloxLaunchMode != LaunchMode.None)
{
App.Logger.WriteLine(LOG_IDENT, $"Opening bootstrapper ({App.LaunchSettings.RobloxLaunchMode})");
LaunchRoblox(App.LaunchSettings.RobloxLaunchMode);
}
else if (!App.LaunchSettings.QuietFlag.Active)
{
App.Logger.WriteLine(LOG_IDENT, "Opening menu");
LaunchMenu();
}
else
{
App.Logger.WriteLine(LOG_IDENT, "Closing - quiet flag active");
App.Terminate();
}
}

public static void LaunchInstaller()
Expand Down Expand Up @@ -235,6 +261,8 @@ public static void LaunchRoblox(LaunchMode launchMode)
});

dialog?.ShowBootstrapper();

App.Logger.WriteLine(LOG_IDENT, "Exiting");
}

public static void LaunchWatcher()
Expand Down
Loading

0 comments on commit c78b04d

Please sign in to comment.