more updates

This commit is contained in:
Zontreck 2020-04-20 01:42:08 -07:00
parent 504a66f807
commit 80f536bfe9
7 changed files with 306 additions and 11 deletions

View file

@ -1,4 +1,6 @@
using System;
using Bot.CommandSystem;
using OpenMetaverse;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
@ -54,5 +56,42 @@ namespace Bot.WebHookServer
output.Close();
}
[CommandGroup("webhook_auth", 4, 2, "webhook_auth [github_name] [y/n]", MessageHandler.Destinations.DEST_AGENT | MessageHandler.Destinations.DEST_LOCAL | MessageHandler.Destinations.DEST_GROUP)]
public void WebHookAuthMgr(UUID client, int level, GridClient grid, string[] additionalArgs, MessageHandler.MessageHandleEvent MHE, MessageHandler.Destinations source, CommandRegistry registry, UUID agentKey, string agentName)
{
MainConfiguration cfg = MainConfiguration.Instance;
MHE(source, client, "Checking..");
if (cfg.Authed(additionalArgs[0]))
{
if (additionalArgs[1] == "y")
{
MHE(source, client, "Not modified. Already authorized");
}
else
{
MHE(source, client, "Authorization revoked - git alerts from this user will not be whitelisted");
cfg.AuthedGithubUsers.Remove(additionalArgs[0]);
}
}
else
{
if (additionalArgs[1] == "y")
{
cfg.AuthedGithubUsers.Add(additionalArgs[0]);
MHE(source, client, "Authorized.");
}
else
{
MHE(source, client, "Not modified. Already not whitelisted");
}
}
cfg.Save();
}
}
}