forked from zombieb/undead-universal-patch-il2cpp
OnLogout, Steam platform auth in account creation. Not configurable to ensure server uses ticket to validate.
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using BestHTTP;
|
||||
using BestHTTP.Forms;
|
||||
using HarmonyLib;
|
||||
using undead_universal_patch_il2cpp.Core;
|
||||
using undead_universal_patch_il2cpp.Core.Config;
|
||||
using UnityEngine;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Patches
|
||||
{
|
||||
@@ -22,6 +25,8 @@ namespace undead_universal_patch_il2cpp.Patches
|
||||
|
||||
static readonly MethodInfo getHeaderMethod = requestType?.GetMethod("GetFirstHeaderValue");
|
||||
static readonly MethodInfo addHeaderMethod = requestType?.GetMethod("AddHeader");
|
||||
static readonly MethodInfo getFormFields = requestType?.GetMethod("GetFormFields");
|
||||
static readonly PropertyInfo formImplProp = requestType?.GetProperty("FormImpl");
|
||||
static readonly PropertyInfo methodTypeProp = requestType?.GetProperty("MethodType");
|
||||
static readonly PropertyInfo uriProp = requestType?.GetProperty("Uri");
|
||||
static readonly PropertyInfo customCertProp = requestType?.GetProperty("CustomCertificateVerifyer");
|
||||
@@ -30,13 +35,13 @@ namespace undead_universal_patch_il2cpp.Patches
|
||||
getHeaderMethod,
|
||||
addHeaderMethod,
|
||||
methodTypeProp,
|
||||
getFormFields,
|
||||
formImplProp,
|
||||
uriProp,
|
||||
customCertProp
|
||||
]).Success;
|
||||
|
||||
static MethodBase TargetMethod() => patchResult.Method;
|
||||
|
||||
[HarmonyPrefix]
|
||||
static void Prefix(ref object request)
|
||||
{
|
||||
if (PatchConfig.CertificatePatch.Value) customCertProp.GetSetMethod().Invoke(request, [null]);
|
||||
@@ -59,6 +64,16 @@ namespace undead_universal_patch_il2cpp.Patches
|
||||
|
||||
if (newUri.Host.Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value);
|
||||
|
||||
bool isAccCreate = newUri.PathAndQuery.Contains("account/create");
|
||||
if (isAccCreate && SteamPlatform.AuthTicket != null)
|
||||
{
|
||||
HTTPFormBase form = (HTTPFormBase)formImplProp.GetValue(request, null);
|
||||
|
||||
form.AddField("x-steam-ticket", SteamPlatform.AuthTicket);
|
||||
Util.ConditionalDebug("Added Steam ticket to create request");
|
||||
}
|
||||
else if (isAccCreate) UniversalPatchPlugin.Log.LogError("The Steam auth ticket has not yet been fetched, account creation might fail!");
|
||||
|
||||
// Finish request changes
|
||||
|
||||
string afterUrl = newUri.ToString();
|
||||
@@ -71,9 +86,8 @@ namespace undead_universal_patch_il2cpp.Patches
|
||||
$" URL After : {(beforeUrl == afterUrl ? "(unmodified)" : afterUrl)}\n" +
|
||||
$" Method : {method}\n" +
|
||||
$" Content-Type : {contentType ?? "(not set)"}");
|
||||
else UniversalPatchPlugin.Log.LogInfo("BestHTTPProxy Request Log\n" +
|
||||
$" Before : {beforeUrl}\n" +
|
||||
$" After : {afterUrl}");
|
||||
else UniversalPatchPlugin.Log.LogInfo("BestHTTPProxy Request\n" +
|
||||
$" {method} {afterUrl}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user