Add proxy from launch argument to WebApi

Co-authored-by: Nekromateion <43814053+Nekromateion@users.noreply.github.com>
This commit is contained in:
Natsumi
2024-07-17 06:42:33 +12:00
parent 8740905a08
commit a4d03c7e00
5 changed files with 21 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
// For a copy, see <https://opensource.org/licenses/MIT>.
using CefSharp;
using CefSharp.Internals;
using System;
using System.Diagnostics;
using System.IO;
@@ -17,7 +18,6 @@ namespace VRCX
{
internal class StartupArgs
{
public static IWebProxy? Proxy = WebRequest.DefaultWebProxy;
public static string LaunchCommand;
public static Process[] processList;
@@ -54,10 +54,14 @@ namespace VRCX
if (arg.Length >= 16 && arg.Substring(0, 14) == "--proxy-server")
{
string proxyUrl = arg.Substring(15).Replace("'", string.Empty).Replace("\"", string.Empty);
Proxy = new WebProxy(proxyUrl);
WebApi.Proxy = new WebProxy(proxyUrl);
}
}
var type = CommandLineArgsParser.GetArgumentValue(args, CefSharpArguments.SubProcessTypeArgument);
if (!string.IsNullOrEmpty(type))
disableClosing = true; // we're launching a subprocess, allow it
if (!string.IsNullOrEmpty(Program.AppDataDirectory))
disableClosing = true; // we're launching with a custom config path, allow it