Skip to content

Commit

Permalink
[Core] Custom Signer
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Oct 24, 2023
1 parent d8d0456 commit 953b58d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Lagrange.Core/Common/BotConfig.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Lagrange.Core.Utility.Sign;

namespace Lagrange.Core.Common;

/// <summary>
Expand Down Expand Up @@ -25,6 +27,11 @@ public class BotConfig
/// Get optimum server from Tencent MSF server, set to false to use hardcode server
/// </summary>
public bool GetOptimumServer { get; set; } = true;

/// <summary>
/// Custom Sign Provider
/// </summary>
public SignProvider? CustomSignProvider { get; set; } = null;
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Lagrange.Core/Internal/Context/ContextCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.Core/Internal/Context/PacketContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion Lagrange.Core/Utility/Sign/SignProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Lagrange.Core.Utility.Sign;

internal abstract class SignProvider
public abstract class SignProvider
{
protected bool Available = true;

Expand Down

0 comments on commit 953b58d

Please sign in to comment.