mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-24 17:23:50 +02:00
Add proxy from launch argument to WebApi
Co-authored-by: Nekromateion <43814053+Nekromateion@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ namespace VRCX
|
||||
public CookieContainer _cookieContainer;
|
||||
private bool _cookieDirty;
|
||||
private Timer _timer;
|
||||
public static IWebProxy? Proxy = WebRequest.DefaultWebProxy;
|
||||
|
||||
static WebApi()
|
||||
{
|
||||
@@ -144,7 +145,7 @@ namespace VRCX
|
||||
|
||||
private static async Task LegacyImageUpload(HttpWebRequest request, IDictionary<string, object> options)
|
||||
{
|
||||
request.Proxy = StartupArgs.Proxy;
|
||||
request.Proxy = Proxy;
|
||||
request.Method = "POST";
|
||||
string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
|
||||
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
||||
@@ -189,7 +190,7 @@ namespace VRCX
|
||||
|
||||
private static async Task UploadFilePut(HttpWebRequest request, IDictionary<string, object> options)
|
||||
{
|
||||
request.Proxy = StartupArgs.Proxy;
|
||||
request.Proxy = Proxy;
|
||||
request.Method = "PUT";
|
||||
request.ContentType = options["fileMIME"] as string;
|
||||
var fileData = options["fileData"] as string;
|
||||
@@ -204,7 +205,7 @@ namespace VRCX
|
||||
|
||||
private static async Task ImageUpload(HttpWebRequest request, IDictionary<string, object> options)
|
||||
{
|
||||
request.Proxy = StartupArgs.Proxy;
|
||||
request.Proxy = Proxy;
|
||||
request.Method = "POST";
|
||||
string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
|
||||
request.ContentType = "multipart/form-data; boundary=" + boundary;
|
||||
@@ -258,7 +259,7 @@ namespace VRCX
|
||||
try
|
||||
{
|
||||
var request = WebRequest.CreateHttp((string)options["url"]);
|
||||
request.Proxy = StartupArgs.Proxy;
|
||||
request.Proxy = Proxy;
|
||||
request.CookieContainer = _cookieContainer;
|
||||
request.KeepAlive = true;
|
||||
request.UserAgent = Program.Version;
|
||||
|
||||
Reference in New Issue
Block a user