Skip to content

Commit

Permalink
Don't disable auth server on officials
Browse files Browse the repository at this point in the history
Since 2023.6.13 official servers went back to using DTLS for auth only
  • Loading branch information
js6pak committed Jun 15, 2023
1 parent 89146ce commit c84d36a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Reactor/Patches/Miscellaneous/CustomServersPatch.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
using System;
using System.Linq;
using HarmonyLib;

namespace Reactor.Patches.Miscellaneous;

[HarmonyPatch]
internal static class CustomServersPatch
{
private static bool IsCurrentServerOfficial()
{
const string Domain = "among.us";

return ServerManager.Instance.CurrentRegion?.TryCast<StaticHttpRegionInfo>() is { } regionInfo &&
regionInfo.PingServer.EndsWith(Domain, StringComparison.Ordinal) &&
regionInfo.Servers.All(serverInfo => serverInfo.Ip.EndsWith(Domain, StringComparison.Ordinal));
}

[HarmonyPatch(typeof(AuthManager._CoConnect_d__4), nameof(AuthManager._CoConnect_d__4.MoveNext))]
[HarmonyPatch(typeof(AuthManager._CoWaitForNonce_d__6), nameof(AuthManager._CoWaitForNonce_d__6.MoveNext))]
[HarmonyPrefix]
public static bool DisableAuthServer(out bool __result)
public static bool DisableAuthServer(ref bool __result)
{
if (IsCurrentServerOfficial())
{
return true;
}

__result = false;
return false;
}
Expand Down

0 comments on commit c84d36a

Please sign in to comment.