diff --git a/Dotnet/AppApi/AppApi.cs b/Dotnet/AppApi/AppApi.cs
index 1fe6c4f4..43ab8226 100644
--- a/Dotnet/AppApi/AppApi.cs
+++ b/Dotnet/AppApi/AppApi.cs
@@ -280,24 +280,21 @@ namespace VRCX
///
/// Restarts the VRCX application for an update by launching a new process with the upgrade argument and exiting the current process.
///
- public void RestartApplication()
+ public void RestartApplication(bool isUpgrade)
{
- List args = [ StartupArgs.VrcxLaunchArguements.IsUpgradePrefix ];
+ var args = new List();
+
+ if (isUpgrade)
+ args.Add(StartupArgs.VrcxLaunchArguments.IsUpgradePrefix);
- if (StartupArgs.LaunchArguements.IsDebug == true)
- {
- args.Add(StartupArgs.VrcxLaunchArguements.IsDebugPrefix);
- }
+ if (StartupArgs.LaunchArguments.IsDebug)
+ args.Add(StartupArgs.VrcxLaunchArguments.IsDebugPrefix);
- if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguements.ConfigDirectory))
- {
- args.Add($"{StartupArgs.VrcxLaunchArguements.ConfigDirectoryPrefix}={StartupArgs.LaunchArguements.ConfigDirectory}");
- }
+ if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguments.ConfigDirectory))
+ args.Add($"{StartupArgs.VrcxLaunchArguments.ConfigDirectoryPrefix}={StartupArgs.LaunchArguments.ConfigDirectory}");
- if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguements.ProxyUrl))
- {
- args.Add($"{StartupArgs.VrcxLaunchArguements.ProxyUrlPrefix}={StartupArgs.LaunchArguements.ProxyUrl}");
- }
+ if (!string.IsNullOrWhiteSpace(StartupArgs.LaunchArguments.ProxyUrl))
+ args.Add($"{StartupArgs.VrcxLaunchArguments.ProxyUrlPrefix}={StartupArgs.LaunchArguments.ProxyUrl}");
var vrcxProcess = new Process
{
@@ -379,8 +376,8 @@ namespace VRCX
/// The launch command.
public string GetLaunchCommand()
{
- var command = StartupArgs.LaunchArguements.LaunchCommand;
- StartupArgs.LaunchArguements.LaunchCommand = string.Empty;
+ var command = StartupArgs.LaunchArguments.LaunchCommand;
+ StartupArgs.LaunchArguments.LaunchCommand = string.Empty;
return command;
}
diff --git a/Dotnet/Cef/CefService.cs b/Dotnet/Cef/CefService.cs
index 1fa097ee..ec945785 100644
--- a/Dotnet/Cef/CefService.cs
+++ b/Dotnet/Cef/CefService.cs
@@ -59,13 +59,14 @@ namespace VRCX
if (Program.LaunchDebug)
{
- // it's dead fuck https://github.com/chromiumembedded/cef/issues/3740
+ // chrome://inspect/#devices
+ // Discover network targets, Configure...
+ // Add Remote Target: localhost:8089
logger.Info("Debug mode enabled");
cefSettings.RemoteDebuggingPort = 8089;
cefSettings.CefCommandLineArgs["remote-allow-origins"] = "*";
}
-
- //CefSharpSettings.WcfEnabled = true; // TOOD: REMOVE THIS LINE YO (needed for synchronous configRepository)
+
CefSharpSettings.ShutdownOnExit = false;
CefSharpSettings.ConcurrentTaskExecution = true;
diff --git a/Dotnet/Program.cs b/Dotnet/Program.cs
index e96d2fe9..39980f41 100644
--- a/Dotnet/Program.cs
+++ b/Dotnet/Program.cs
@@ -120,7 +120,7 @@ namespace VRCX
MessageBox.Show(
"vc_redist has finished installing, if the issue persists upon next restart, please reinstall VRCX From GitHub,\nVRCX Will now restart.", "vc_redist installation complete", MessageBoxButtons.OK);
Thread.Sleep(5000);
- AppApi.Instance.RestartApplication();
+ AppApi.Instance.RestartApplication(false);
break;
case DialogResult.No:
diff --git a/Dotnet/StartupArgs.cs b/Dotnet/StartupArgs.cs
index 3afa1603..f9cb9bbe 100644
--- a/Dotnet/StartupArgs.cs
+++ b/Dotnet/StartupArgs.cs
@@ -18,7 +18,7 @@ namespace VRCX
{
internal class StartupArgs
{
- public static VrcxLaunchArguements LaunchArguements = new();
+ public static VrcxLaunchArguments LaunchArguments = new();
public static void ArgsCheck()
{
@@ -27,60 +27,57 @@ namespace VRCX
Debug.Assert(Program.LaunchDebug = true);
var currentProcessArgs = ParseArgs(args);
- LaunchArguements = currentProcessArgs;
+ LaunchArguments = currentProcessArgs;
- if (LaunchArguements.IsDebug)
+ if (LaunchArguments.IsDebug)
Program.LaunchDebug = true;
- if (LaunchArguements.ConfigDirectory != null)
+ if (LaunchArguments.ConfigDirectory != null)
{
- if (File.Exists(LaunchArguements.ConfigDirectory))
+ if (File.Exists(LaunchArguments.ConfigDirectory))
{
MessageBox.Show("Move your \"VRCX.sqlite3\" into a folder then specify the folder in the launch parameter e.g.\n--config=\"C:\\VRCX\\\"", "--config is now a directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(0);
}
- Program.AppDataDirectory = LaunchArguements.ConfigDirectory;
+ Program.AppDataDirectory = LaunchArguments.ConfigDirectory;
}
- var disableClosing = false;
-
- if (LaunchArguements.IsUpgrade || // we're upgrading, allow it
- !string.IsNullOrEmpty(CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument))) // we're launching a subprocess, allow it
- disableClosing = true;
+ var disableClosing = LaunchArguments.IsUpgrade || // we're upgrading, allow it
+ !string.IsNullOrEmpty(CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument)); // we're launching a subprocess, allow it
// if we're launching a second instance with same config directory, focus the first instance then exit
- if (!disableClosing && IsDuplicateProcessRunning(LaunchArguements))
+ if (!disableClosing && IsDuplicateProcessRunning(LaunchArguments))
{
IPCToMain();
Environment.Exit(0);
}
}
- private static VrcxLaunchArguements ParseArgs(string[] args)
+ private static VrcxLaunchArguments ParseArgs(string[] args)
{
- VrcxLaunchArguements arguements = new VrcxLaunchArguements();
+ var arguments = new VrcxLaunchArguments();
foreach (var arg in args)
{
- if (arg == VrcxLaunchArguements.IsUpgradePrefix)
- arguements.IsUpgrade = true;
+ if (arg == VrcxLaunchArguments.IsUpgradePrefix)
+ arguments.IsUpgrade = true;
- if (arg.StartsWith(VrcxLaunchArguements.IsDebugPrefix))
- arguements.IsDebug = true;
+ if (arg.StartsWith(VrcxLaunchArguments.IsDebugPrefix))
+ arguments.IsDebug = true;
- if (arg.StartsWith(VrcxLaunchArguements.LaunchCommandPrefix) && arg.Length > VrcxLaunchArguements.LaunchCommandPrefix.Length)
- arguements.LaunchCommand = arg.Substring(VrcxLaunchArguements.LaunchCommandPrefix.Length);
+ if (arg.StartsWith(VrcxLaunchArguments.LaunchCommandPrefix) && arg.Length > VrcxLaunchArguments.LaunchCommandPrefix.Length)
+ arguments.LaunchCommand = arg.Substring(VrcxLaunchArguments.LaunchCommandPrefix.Length);
- if (arg.StartsWith(VrcxLaunchArguements.ConfigDirectoryPrefix) && arg.Length > VrcxLaunchArguements.ConfigDirectoryPrefix.Length)
- arguements.ConfigDirectory = arg.Substring(VrcxLaunchArguements.ConfigDirectoryPrefix.Length + 1);
+ if (arg.StartsWith(VrcxLaunchArguments.ConfigDirectoryPrefix) && arg.Length > VrcxLaunchArguments.ConfigDirectoryPrefix.Length)
+ arguments.ConfigDirectory = arg.Substring(VrcxLaunchArguments.ConfigDirectoryPrefix.Length + 1);
- if (arg.StartsWith(VrcxLaunchArguements.ProxyUrlPrefix) && arg.Length > VrcxLaunchArguements.ProxyUrlPrefix.Length)
- arguements.ProxyUrl = arg.Substring(VrcxLaunchArguements.ProxyUrlPrefix.Length + 1).Replace("'", string.Empty).Replace("\"", string.Empty);
+ if (arg.StartsWith(VrcxLaunchArguments.ProxyUrlPrefix) && arg.Length > VrcxLaunchArguments.ProxyUrlPrefix.Length)
+ arguments.ProxyUrl = arg.Substring(VrcxLaunchArguments.ProxyUrlPrefix.Length + 1).Replace("'", string.Empty).Replace("\"", string.Empty);
}
- return arguements;
+ return arguments;
}
- internal class VrcxLaunchArguements
+ internal class VrcxLaunchArguments
{
public const string IsUpgradePrefix = "/Upgrade";
public bool IsUpgrade { get; set; } = false;
@@ -98,7 +95,7 @@ namespace VRCX
public string ProxyUrl { get; set; } = null;
}
- private static bool IsDuplicateProcessRunning(VrcxLaunchArguements launchArguements)
+ private static bool IsDuplicateProcessRunning(VrcxLaunchArguments launchArguments)
{
var processes = Process.GetProcessesByName("VRCX")
.Where(x => x.Id != Environment.ProcessId);
@@ -109,26 +106,23 @@ namespace VRCX
try
{
- using (var searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id))
- {
- using (var objects = searcher.Get())
- {
- commandLine = objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString() ?? string.Empty;
- }
- }
+ using var searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id);
+ using var objects = searcher.Get();
+ commandLine =
+ objects.Cast().SingleOrDefault()?["CommandLine"]?.ToString() ??
+ string.Empty;
+ }
+ catch
+ {
+ // ignored
}
- catch { }
if (commandLine.Contains(CefSharpArguments.SubProcessTypeArgument)) // ignore subprocesses
- {
continue;
- }
- var processArguements = ParseArgs(commandLine.Split(' '));
- if (processArguements.ConfigDirectory == launchArguements.ConfigDirectory)
- {
+ var processArguments = ParseArgs(commandLine.Split(' '));
+ if (processArguments.ConfigDirectory == launchArguments.ConfigDirectory)
return true;
- }
}
return false;
@@ -142,7 +136,7 @@ namespace VRCX
if (ipcClient.IsConnected)
{
- var buffer = Encoding.UTF8.GetBytes($"{{\"type\":\"LaunchCommand\",\"command\":\"{LaunchArguements.LaunchCommand}\"}}" + (char)0x00);
+ var buffer = Encoding.UTF8.GetBytes($"{{\"type\":\"LaunchCommand\",\"command\":\"{LaunchArguments.LaunchCommand}\"}}" + (char)0x00);
ipcClient.BeginWrite(buffer, 0, buffer.Length, IPCClient.Close, ipcClient);
}
}
diff --git a/Dotnet/WebApi.cs b/Dotnet/WebApi.cs
index 9fe7696d..e5987e28 100644
--- a/Dotnet/WebApi.cs
+++ b/Dotnet/WebApi.cs
@@ -59,8 +59,8 @@ namespace VRCX
private void SetProxy()
{
- if (!string.IsNullOrEmpty(StartupArgs.LaunchArguements.ProxyUrl))
- ProxyUrl = StartupArgs.LaunchArguements.ProxyUrl;
+ if (!string.IsNullOrEmpty(StartupArgs.LaunchArguments.ProxyUrl))
+ ProxyUrl = StartupArgs.LaunchArguments.ProxyUrl;
if (string.IsNullOrEmpty(ProxyUrl))
{
diff --git a/html/src/app.js b/html/src/app.js
index e6ca85ae..c5d34bfb 100644
--- a/html/src/app.js
+++ b/html/src/app.js
@@ -2920,6 +2920,10 @@ speechSynthesis.getVoices();
break retryLoop;
} catch (err) {
console.error(err);
+ if (!API.currentUser.isLoggedIn) {
+ console.error(`User isn't logged in`);
+ break mainLoop;
+ }
if (err?.message?.includes('Not Found')) {
console.error('Awful workaround for awful VRC API bug');
break retryLoop;
@@ -25070,7 +25074,11 @@ speechSynthesis.getVoices();
case -16:
if (this.downloadCurrent.ref.id === 'VRCXUpdate') {
if (this.downloadCurrent.autoInstall) {
- workerTimers.setTimeout(() => this.restartVRCX(), 2000);
+ var isUpgrade = true;
+ workerTimers.setTimeout(
+ () => this.restartVRCX(isUpgrade),
+ 2000
+ );
} else {
this.downloadDialog.visible = false;
this.pendingVRCXInstall = this.downloadCurrent.ref.name;
@@ -26202,8 +26210,8 @@ speechSynthesis.getVoices();
}
};
- $app.methods.restartVRCX = function () {
- AppApi.RestartApplication();
+ $app.methods.restartVRCX = function (isUpgrade) {
+ AppApi.RestartApplication(isUpgrade);
};
$app.methods.loadBranchVersions = async function () {
@@ -34005,7 +34013,8 @@ speechSynthesis.getVoices();
workerTimers.setTimeout(resolve, 100);
});
if (action === 'confirm') {
- AppApi.RestartApplication();
+ var isUpgrade = false;
+ this.restartVRCX(isUpgrade);
}
}
}