forked from zombieb/undead-universal-patch-il2cpp
Internal add hash to login form for all logins, fix registration patch
This commit is contained in:
14
Core/PluginHash.cs
Normal file
14
Core/PluginHash.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
namespace undead_universal_patch_il2cpp.Core;
|
||||||
|
|
||||||
|
public class PluginHash
|
||||||
|
{
|
||||||
|
public static string GetHash()
|
||||||
|
{
|
||||||
|
return BitConverter.ToString(MD5.Create().ComputeHash(File.OpenRead(Assembly.GetExecutingAssembly().Location))).Replace("-", "").ToLowerInvariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using BestHTTP;
|
using BestHTTP;
|
||||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using undead_universal_patch_il2cpp.Core;
|
using undead_universal_patch_il2cpp.Core;
|
||||||
using undead_universal_patch_il2cpp.Core.Config;
|
using undead_universal_patch_il2cpp.Core.Config;
|
||||||
|
|||||||
30
Patches/Internals/LoginHelper.cs
Normal file
30
Patches/Internals/LoginHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using BestHTTP.Forms;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using undead_universal_patch_il2cpp.Core;
|
||||||
|
|
||||||
|
namespace undead_universal_patch_il2cpp.Patches.Internals;
|
||||||
|
|
||||||
|
[HarmonyPatch]
|
||||||
|
public class LoginHelperFieldsPatch
|
||||||
|
{
|
||||||
|
static PatchTypesResult typesResult = Util.PreparePatchTypes(
|
||||||
|
"Add patch hash to the login form",
|
||||||
|
"RecNet.Login",
|
||||||
|
"LoginHelper"
|
||||||
|
);
|
||||||
|
|
||||||
|
static MethodBase TargetMethod() => typesResult.Method;
|
||||||
|
static bool Prepare() => typesResult.Success;
|
||||||
|
|
||||||
|
static void Prefix(ref HTTPUrlEncodedForm loginParams)
|
||||||
|
{
|
||||||
|
loginParams.AddField("x-patch-plugin-hash", PluginHash.GetHash());
|
||||||
|
Util.ConditionalDebug("Added hash to login form");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,22 +10,15 @@ namespace undead_universal_patch_il2cpp.Patches
|
|||||||
{
|
{
|
||||||
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
|
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
|
||||||
PatchConfig.RegistrationPatch,
|
PatchConfig.RegistrationPatch,
|
||||||
"Registration patch (to be vetted, might not work)",
|
"Registration patch",
|
||||||
"UnityEngine.PlayerPrefs",
|
"ProfileWatchUIFlow",
|
||||||
"GetInt"
|
"Button_Email"
|
||||||
);
|
);
|
||||||
|
|
||||||
static bool Prepare() => patchResult.Success;
|
static bool Prepare() => patchResult.Success;
|
||||||
|
|
||||||
static MethodInfo TargetMethod() => patchResult.Method;
|
static MethodInfo TargetMethod() => patchResult.Method;
|
||||||
|
|
||||||
static void Postfix(ref string key, ref int defaultValue, ref int __result)
|
static bool Prefix() => false;
|
||||||
{
|
|
||||||
if (key.StartsWith("IncompleteRegistration-"))
|
|
||||||
{
|
|
||||||
__result = 0;
|
|
||||||
UniversalPatchPlugin.Log.LogInfo("Detour'd IncompleteRegistration pref key");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user