Skip to content

Commit

Permalink
added missing checks and created toggle guild perms subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePinkUnicorn6 committed Dec 23, 2023
1 parent 8b10ff8 commit 76744b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void Main(string[] args)
case "/api/guild/key/request": apiRequestKeys(context); break; //Post
case "/api/guild/key/listRequests": apiGetKeyRequests(context); break; //Get
case "/api/guild/key/submit": apiSubmitKey(context); break; //Post
//case "/api/guild/users/setPerms": apiSetUserPerms(context); break; //Post
case "/api/guild/users/togglePerms": apiToggleUserPerms(context); break; //Post
case "/api/guild/users/list": apiListGuildUsers(context); break; //Get
default:
{
Expand Down Expand Up @@ -1226,6 +1226,10 @@ FROM tblInvites
}
}
sendResponse(context, typeJson, code, responseMessage);
}
static void apiToggleUserPerms(HttpListenerContext context)
{

}
static void apiRequestKeys(HttpListenerContext context)
{
Expand All @@ -1248,6 +1252,12 @@ static void apiRequestKeys(HttpListenerContext context)
}
if (string.IsNullOrEmpty(token)) returnMissingParameterError(out responseMessage, out code);
else if (!tokenValid(token)) returnInvalidTokenError(out responseMessage, out code);
else if (!checkGuildExists(guildID))
{
var responseJson = new { error = "Invalid GuildID", errcode = "INVALID_GUILDID" };
responseMessage = JsonConvert.SerializeObject(responseJson);
code = 400;
}
else
{
string userID = getUserIDFromToken(token);
Expand Down Expand Up @@ -1408,6 +1418,12 @@ static void apiSubmitKey(HttpListenerContext context)
if (string.IsNullOrEmpty(token) | string.IsNullOrEmpty(guildID) | string.IsNullOrEmpty(requesterID) | string.IsNullOrEmpty(keyCypherText))
{ returnMissingParameterError(out responseMessage, out code); }
else if (!tokenValid(token)) returnInvalidTokenError(out responseMessage, out code);
else if (!checkGuildExists(guildID))
{
var responseJson = new { error = "Invalid GuildID", errcode = "INVALID_GUILDID" };
responseMessage = JsonConvert.SerializeObject(responseJson);
code = 400;
}
else
{
string userID = getUserIDFromToken(token);
Expand Down

0 comments on commit 76744b8

Please sign in to comment.