Created channel perms schema and api routes.

This commit is contained in:
rainbownapkin 2024-11-23 13:41:48 -05:00
parent 9dbbc4e924
commit 8384e732f3
21 changed files with 250 additions and 20 deletions

View file

@ -157,6 +157,8 @@ p.panel-head-element{
#chat-panel-flair-select{
margin-left: 0.5em;
text-align: center;
appearance: none;
}
input#chat-panel-prompt{
@ -176,6 +178,7 @@ input#chat-panel-prompt{
.chat-entry-username{
margin: 0.2em;
margin-left: 0;
}
.chat-entry-body{
@ -184,6 +187,7 @@ input#chat-panel-prompt{
.chat-entry-high-level{
margin: 0.2em;
margin-right: 0;
z-index: 2;
background-image: url("/img/sweet_leaf_simple.png");
background-size: 1.3em;
@ -192,6 +196,7 @@ input#chat-panel-prompt{
background-position-y: top;
width: 1.5em;
text-align: center;
flex-shrink: 0;
}
.chat-entry-high-level-img{

View file

@ -236,6 +236,23 @@ class canopyAjaxUtils{
}
}
async setChannelPermissions(chanName, permissionsMap){
var response = await fetch(`/api/channel/permissions`,{
method: "POST",
headers: {
"Content-Type": "application/json"
},
//Unfortunately JSON doesn't natively handle ES6 maps, and god forbid someone update the standard in a way that's backwards compatible...
body: JSON.stringify({chanName, channelPermissionsMap: Object.fromEntries(permissionsMap)})
});
if(response.status == 200){
return await response.json();
}else{
utils.ux.displayResponseError(await response.json());
}
}
async deleteChannel(chanName, confirm){
var response = await fetch(`/api/channel/delete`,{
method: "POST",