server docs

This commit is contained in:
2025-08-12 22:54:54 -04:00
parent 7fc0d6c5b0
commit 45d844da18
4 changed files with 40 additions and 30 deletions

View File

@@ -21,12 +21,14 @@ namespace undead_universal_patch_il2cpp.Patches
static readonly Type requestType = AccessTools.TypeByName("BestHTTP.HTTPRequest");
static readonly MethodInfo getHeaderMethod = requestType?.GetMethod("GetFirstHeaderValue");
static readonly MethodInfo addHeaderMethod = requestType?.GetMethod("AddHeader");
static readonly PropertyInfo methodTypeProp = requestType?.GetProperty("MethodType");
static readonly PropertyInfo uriProp = requestType?.GetProperty("Uri");
static readonly PropertyInfo customCertProp = requestType?.GetProperty("CustomCertificateVerifyer");
static bool Prepare() => Util.PostRequireTypes(patchResult, [
getHeaderMethod,
addHeaderMethod,
methodTypeProp,
uriProp,
customCertProp
@@ -39,7 +41,7 @@ namespace undead_universal_patch_il2cpp.Patches
{
if (PatchConfig.CertificatePatch.Value) customCertProp.GetSetMethod().Invoke(request, [null]);
string contentType = (string)getHeaderMethod.Invoke(request, ["Content-Type"]);
var contentType = (string)getHeaderMethod.Invoke(request, ["Content-Type"]);
HTTPMethods method = (HTTPMethods)methodTypeProp.GetGetMethod().Invoke(request, []);
var uriInstance = (Il2CppSystem.Uri)uriProp.GetValue(request, null);
@@ -53,12 +55,12 @@ namespace undead_universal_patch_il2cpp.Patches
Il2CppSystem.Uri newUri = new(uriInstance.ToString());
// Request changes below
// Start request changes
if (newUri.ToString().Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value);
if (newUri.Host.Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value);
// Finish request changes
string afterUrl = newUri.ToString();
uriProp.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null);