add support to not require signing checks

This commit is contained in:
Madpeter 2022-06-08 02:59:54 +01:00
parent 3c09fb8f15
commit 8c27b8c3fb

View file

@ -212,7 +212,10 @@ namespace SecondBotEvents.Services
public KeyValuePair<bool, string> RunCommand(SignedCommand C) public KeyValuePair<bool, string> RunCommand(SignedCommand C)
{ {
if(acceptNewCommands == false)
{
return new KeyValuePair<bool, string>(false, "Not accepting commands");
}
try try
{ {
string lowerName = C.command.ToLower(); string lowerName = C.command.ToLower();
@ -324,13 +327,18 @@ namespace SecondBotEvents.Services
} }
Vaildate(requireTimewindow, windowSize, secret); Vaildate(requireTimewindow, windowSize, secret);
} }
public SignedCommand(string setCommand, string setSigningCode, string[] setArgs, int setUnixtime, string setReplyTarget, bool requireTimewindow, int windowSize, string secret) public SignedCommand(string setCommand, string setSigningCode, string[] setArgs, int setUnixtime, string setReplyTarget, bool requireTimewindow, int windowSize, string secret, bool requireSigning = true)
{ {
command = setCommand; command = setCommand;
signingCode = setSigningCode; signingCode = setSigningCode;
args = setArgs; args = setArgs;
unixtimeOfCommand = setUnixtime; unixtimeOfCommand = setUnixtime;
replyTarget = setReplyTarget; replyTarget = setReplyTarget;
if (requireSigning == false)
{
accepted = true; // just accept the command
return;
}
Vaildate(requireTimewindow, windowSize, secret); Vaildate(requireTimewindow, windowSize, secret);
} }