diff --git a/Lagrange.Core/Common/BotConfig.cs b/Lagrange.Core/Common/BotConfig.cs index 9b38ee4c6..eea3c9bd6 100644 --- a/Lagrange.Core/Common/BotConfig.cs +++ b/Lagrange.Core/Common/BotConfig.cs @@ -1,3 +1,5 @@ +using Lagrange.Core.Utility.Sign; + namespace Lagrange.Core.Common; /// @@ -25,6 +27,11 @@ public class BotConfig /// Get optimum server from Tencent MSF server, set to false to use hardcode server /// public bool GetOptimumServer { get; set; } = true; + + /// + /// Custom Sign Provider + /// + public SignProvider? CustomSignProvider { get; set; } = null; } /// diff --git a/Lagrange.Core/Internal/Context/ContextCollection.cs b/Lagrange.Core/Internal/Context/ContextCollection.cs index b51afa7ee..e64803abe 100644 --- a/Lagrange.Core/Internal/Context/ContextCollection.cs +++ b/Lagrange.Core/Internal/Context/ContextCollection.cs @@ -16,6 +16,7 @@ internal class ContextCollection public BotKeystore Keystore { get; } public BotAppInfo AppInfo { get; } public BotDeviceInfo Device { get; } + public BotConfig Config { get; } public TaskScheduler Scheduler { get; } public EventInvoker Invoker { get; } diff --git a/Lagrange.Core/Internal/Context/PacketContext.cs b/Lagrange.Core/Internal/Context/PacketContext.cs index e5729fafc..9014f8d52 100644 --- a/Lagrange.Core/Internal/Context/PacketContext.cs +++ b/Lagrange.Core/Internal/Context/PacketContext.cs @@ -22,7 +22,7 @@ internal class PacketContext : ContextBase public PacketContext(ContextCollection collection, BotKeystore keystore, BotAppInfo appInfo, BotDeviceInfo device) : base(collection, keystore, appInfo, device) { - _signProvider = appInfo.Os switch + _signProvider = Collection.Config.CustomSignProvider ?? appInfo.Os switch { "Windows" => new WindowsSigner(), "Mac" => new MacSigner(), diff --git a/Lagrange.Core/Utility/Sign/SignProvider.cs b/Lagrange.Core/Utility/Sign/SignProvider.cs index 9906f18ef..cc4e4c6d4 100644 --- a/Lagrange.Core/Utility/Sign/SignProvider.cs +++ b/Lagrange.Core/Utility/Sign/SignProvider.cs @@ -1,6 +1,6 @@ namespace Lagrange.Core.Utility.Sign; -internal abstract class SignProvider +public abstract class SignProvider { protected bool Available = true;