From cc2c9aa53f7b60bb72c4e4cda45088a5c70c5c89 Mon Sep 17 00:00:00 2001 From: Clansty Date: Thu, 27 Feb 2025 06:25:20 +0800 Subject: [PATCH] [+] Https upgrade --- AquaMai.Mods/Fix/FixCheckAuth.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/AquaMai.Mods/Fix/FixCheckAuth.cs b/AquaMai.Mods/Fix/FixCheckAuth.cs index 136424c1..5e432249 100644 --- a/AquaMai.Mods/Fix/FixCheckAuth.cs +++ b/AquaMai.Mods/Fix/FixCheckAuth.cs @@ -3,12 +3,16 @@ using AquaMai.Config.Attributes; using HarmonyLib; using Manager; using Manager.Operation; +using MelonLoader; namespace AquaMai.Mods.Fix; [ConfigSection(exampleHidden: true, defaultOn: true)] public class FixCheckAuth { + [ConfigEntry] + private static readonly bool allowHttpsUpgrade = true; + [HarmonyPostfix] [HarmonyPatch(typeof(OperationManager), "CheckAuth_Proc")] private static void PostCheckAuthProc(ref OperationData ____operationData) @@ -16,6 +20,16 @@ public class FixCheckAuth if (Auth.GameServerUri.StartsWith("http://") || Auth.GameServerUri.StartsWith("https://")) { ____operationData.ServerUri = Auth.GameServerUri; + + // Host is used only for "CheckServerHash" and it is disabled now + // it originally contains server's tls cert hash + // So this can be used to transfer ambiguous data + // we use this to notify that we can upgrade the link to https + // as if we originally pass a https link to game, games without CheckServerHash will reject the link because ssl pinning + if (Auth.GameServerHost == "_AquaMai_Upgrade_") + { + ____operationData.ServerUri = Auth.GameServerUri.Replace("http://", "https://"); + } } } -} +} \ No newline at end of file