Remove galvanic authentication support

... that server is being rewritten
This commit is contained in:
2025-08-10 21:53:58 -04:00
parent 48ca74d2db
commit 1c51b37a7c
6 changed files with 34 additions and 309 deletions

30
Patches/AFKPatch.cs Normal file
View File

@@ -0,0 +1,30 @@
using System.Reflection;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
namespace undead_universal_patch_il2cpp.Patches;
[HarmonyPatch]
public class AFKPatch
{
static readonly string TargetTypeName = "Player";
static readonly string TargetMethodName = "UpdateAFKStatus";
static readonly string Description = "Always present, never AFK";
static bool Prepare()
{
if (AccessTools.Method(AccessTools.TypeByName(TargetTypeName), TargetMethodName) == null)
{
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
return false;
}
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
return true;
}
static MethodBase TargetMethod() => AccessTools.Method(AccessTools.TypeByName(TargetTypeName), TargetMethodName);
static void Prefix(ref bool userIsPresent)
{
if (GenericConfig.AFKPatch.Value) userIsPresent = true;
}
}

View File

@@ -64,30 +64,6 @@ namespace undead_universal_patch_il2cpp.Patches
if (newUri.ToString().Contains("ns.rec.net")) newUri = new Il2CppSystem.Uri(NameserverConfig.NewUrl.Value);
if (GalvanicConfig.Enabled.Value)
{
string[] applyHeader = [
"/cachedlogin/forplatformid",
"/account/create",
"/connect/token"
];
foreach (string header in applyHeader)
{
if (newUri.PathAndQuery.Contains(header))
{
// refresh the token if it expired
// this is somewhat inefficient, but we don't hook into many requests (see above) so it should be fine
GalvanicWebAuth.TokenExpiry();
Type httpRequestType = request.GetType();
MethodInfo addHeaderMethod = httpRequestType.GetMethod("AddHeader");
addHeaderMethod.Invoke(request, ["GalvanicAuth", GalvanicWebAuth.Token]);
break;
}
}
}
if (GenericConfig.LogAllRequests.Value) Plugin.Log.LogInfo($"BestHTTP_Unob request a-URL: {newUri.ToString()}");
uriProperty.SetValue(request, NameserverConfig.Rewrite.Value ? newUri : uriInstance, null);
}