Compare commits

..

No commits in common. "deb50ceff11218e7d8a85fa4a69a6d36a88cf35b" and "294f0292ab4a5e934d6085c9c918bd6fd24d31a5" have entirely different histories.

6 changed files with 54 additions and 114 deletions

View file

@ -90,8 +90,10 @@ tokeSchema.statics.calculateTokeMap = async function(){
} }
//Display calculated toke sats for funsies //Display calculated toke sats for funsies
if(config.verbose){
console.log(`Processed ${this.commandCount} toke command callouts accross ${this.count} tokes, averaging ${(this.commandCount/this.count).toFixed(3)} tokers per toke.`); console.log(`Processed ${this.commandCount} toke command callouts accross ${this.count} tokes, averaging ${(this.commandCount/this.count).toFixed(3)} tokers per toke.`);
} }
}
/** /**
* Tattoos toke into toke DB colleciton * Tattoos toke into toke DB colleciton

View file

@ -65,8 +65,8 @@ module.exports.errorHandler = function(res, msg, type = "Generic", status = 400)
* @param {Error} err - Exception to handle * @param {Error} err - Exception to handle
*/ */
module.exports.localExceptionHandler = function(err){ module.exports.localExceptionHandler = function(err){
//If this wasn't made by exceptionSmith //If we're being verbose and this isn't just a basic bitch
if(!err.custom){ if(!err.custom && config.verbose){
//Log the error //Log the error
module.exports.dumpError(err); module.exports.dumpError(err);
} }
@ -188,12 +188,6 @@ module.exports.dumpError = async function(err, date = new Date(), subDir = 'cras
//Generate content from error //Generate content from error
const content = `Error Date: ${date.toLocaleString()} (UTC-${date.getTimezoneOffset()/60})\nError Type: ${err.name}\nError Msg:${err.message}\nStack Trace:\n\n${err.stack}`; const content = `Error Date: ${date.toLocaleString()} (UTC-${date.getTimezoneOffset()/60})\nError Type: ${err.name}\nError Msg:${err.message}\nStack Trace:\n\n${err.stack}`;
//if we're not muzzled and the server is in screamy boi mode
if(!muzzle && config.verbose){
//Dump error to console
console.log(err);
}
//Dump text to file //Dump text to file
module.exports.dumpLog(content, date.getTime(), subDir, muzzle); module.exports.dumpLog(content, date.getTime(), subDir, muzzle);
} }

View file

@ -35,23 +35,27 @@ module.exports.upgradeCheck = async function(){
//Get the server statistics document from Database //Get the server statistics document from Database
const stats = await statModel.getStats(); const stats = await statModel.getStats();
//Throw this flag if an upgrade is initiated to automagically and silently initiate all upgrades after it
let upgradeStarted = false;
//If we're upgrading from Panama Red (or older) //If we're upgrading from Panama Red (or older)
if(stats.version == "<0.2.0"){ if(stats.version == "<0.2.0"){
//Initiate upgrade procedure from Panama Red //Initiate upgrade procedure from Panama Red
await upgradePanamaRed(); await upgradePanamaRed();
//Throw upgrade started flag
upgradeStarted = true;
} }
//If we upgraded //If we upgraded
if(stats.version != package.version){ if(upgradeStarted){
//Update the statistics document to reflect the new version //Update the statistics document to reflect the new version
stats.version = package.version; stats.version = package.version;
//Write the statistics document to the DB //Write the statistics document to the DB
await stats.save(); await stats.save();
//Shout about successfuly upgrade
loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`);
} }
loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`);
} }
/** /**

View file

@ -17,22 +17,21 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
/* Theme Variables */ /* Theme Variables */
:root{ :root{
--main-font: "open-sans", system-ui; --main-font: "open-sans", system-ui;
--bg0: rgb(37, 37, 37); --bg0: rgb(14, 14, 14);
--bg0-alpha0: rgba(37, 37, 37, 0.4); --bg0-alpha0: rgba(158, 158, 158, 0.4);
--bg0-alpha1: rgba(37, 37, 37, 0.75); --bg0-alpha1: rgba(158, 158, 158, 0.75);
--bg1: rgb(1, 1, 1); --bg1: rgb(70, 70, 70);
--bg1-gradient: linear-gradient(to top, rgb(1, 1, 1), rgb(37, 37, 37)); --bg2: rgb(220, 220, 220);
--bg2: rgb(0, 0, 0);
--bg1-alt0: rgb(30, 30, 30); --bg1-alt0: rgb(30, 30, 30);
--bg2-alt0: rgb(200, 200, 200); --bg2-alt0: rgb(200, 200, 200);
--bg2-alt1: rgb(180, 180, 180); --bg2-alt1: rgb(180, 180, 180);
--accent0: rgb(212, 212, 212); --accent0: rgb(47, 47, 47);
--accent0-alt0: rgb(185, 185, 185); --accent0-alt0: rgb(34, 34, 34);
--accent0-alt1: rgb(124, 124, 124); --accent0-alt1: rgb(70, 70, 70);
--accent1: var(--accent0); --accent1: rgb(245, 245, 245);
--accent1-alt0: var(--accent0-alt0); --accent1-alt0: rgb(185, 185, 185);
--accent1-alt1: var(--accent0-alt1); --accent1-alt1: rgb(124, 124, 124);
--accent2: var(--accent0-alt0); --accent2: var(--accent0-alt0);
--focus0: rgb(51, 153, 51); --focus0: rgb(51, 153, 51);
@ -83,6 +82,7 @@ body{
background-color: var(--bg0); background-color: var(--bg0);
font-family: var(--main-font); font-family: var(--main-font);
color: var(--accent0); color: var(--accent0);
background-image: url('/img/background.png');
background-size: 5em; background-size: 5em;
scrollbar-color: var(--accent0-alt1) transparent; scrollbar-color: var(--accent0-alt1) transparent;
} }
@ -118,7 +118,6 @@ button i{
select{ select{
background-color: var(--bg2); background-color: var(--bg2);
color: var(--accent0);
border-radius: 0.5em; border-radius: 0.5em;
border: none; border: none;
} }
@ -274,7 +273,7 @@ a.admin-list-entry-item{
div.control-prompt{ div.control-prompt{
border-radius: 1em; border-radius: 1em;
background-color: var(--bg0); background-color: white;
} }
div.control-prompt:focus-within{ div.control-prompt:focus-within{
@ -285,8 +284,6 @@ input.control-prompt, input.control-prompt:focus{
border: none; border: none;
outline: none; outline: none;
box-shadow: none; box-shadow: none;
background-color: var(--bg0);
color: var(--accent0);
} }
@ -296,7 +293,7 @@ input.control-prompt, input.control-prompt:focus{
/* navbar */ /* navbar */
#navbar{ #navbar{
background-image: var(--bg1-gradient); background-color: var(--bg1);
} }
.navbar-item{ .navbar-item{
@ -354,6 +351,7 @@ p.channel-guide-entry-item{
#chat-panel-head-spacer-span, #chat-panel-users-div{ #chat-panel-head-spacer-span, #chat-panel-users-div{
background-color: var(--bg0); background-color: var(--bg0);
background-image: url("/img/background.png");
background-size: 2.3em background-size: 2.3em
} }
@ -362,17 +360,9 @@ p.channel-guide-entry-item{
text-shadow: var(--focus-glow0-alt0); text-shadow: var(--focus-glow0-alt0);
} }
#chat-panel-control-div{ .chat-entry{
margin: 0; background-color: var(--bg2);
border-radius: 0; border-bottom: 1px solid var(--bg2-alt1);
}
.chat-entry:nth-child(even){
background-color: var(--bg0);
}
.chat-entry:nth-child(odd){
background-color: var(--bg1-alt0);
} }
.serverwhisper{ .serverwhisper{
@ -407,34 +397,6 @@ p.channel-guide-entry-item{
color: var(--userlist-color6); color: var(--userlist-color6);
} }
.chat-userlist-color0{/*green0*/
border-left: solid 5px var(--userlist-color0);
}
.chat-userlist-color1{/*red0*/
border-left: solid 5px var(--userlist-color1);
}
.chat-userlist-color2{/*blue0*/
border-left: solid 5px var(--userlist-color2);
}
.chat-userlist-color3{/*tan0*/
border-left: solid 5px var(--userlist-color3);
}
.chat-userlist-color4{/*pink0*/
border-left: solid 5px var(--userlist-color4);
}
.chat-userlist-color5{/*orange*/
border-left: solid 5px var(--userlist-color5);
}
.chat-userlist-color6{/*violet*/
border-left: solid 5px var(--userlist-color6);
}
[class*="userlist-color"].chat-panel-users{ [class*="userlist-color"].chat-panel-users{
text-shadow: var(--userlist-contrast-glow); text-shadow: var(--userlist-contrast-glow);
} }
@ -539,7 +501,6 @@ Begin each subsection with a materials and equipment manifest.*/
.high-level{ .high-level{
text-shadow: 1px 1px 1px white, -1px -1px 1px white, 1px 1px 1px white, -1px 1px 1px white, 1px -1px 1px white; text-shadow: 1px 1px 1px white, -1px -1px 1px white, 1px 1px 1px white, -1px 1px 1px white, 1px -1px 1px white;
color: var(--bg2);
} }
#media-panel-head-div{ #media-panel-head-div{

View file

@ -87,29 +87,14 @@ class chatPostprocessor{
} }
buildEntry(pm){ buildEntry(pm){
//Define username color as syntatic sugar, assigning colors to usernames that don't already have one
let color = this.client.userList.assignColor(this.rawData.user);
//Set flair to username color
let flair = color;
//Set class suffix based on chat location
const classSuffix = pm ? 'pm-panel-sesh' : 'chat'; const classSuffix = pm ? 'pm-panel-sesh' : 'chat';
const classSuffixAlt = pm ? classSuffix : 'chat-panel'; const classSuffixAlt = pm ? classSuffix : 'chat-panel';
//Create chat-entry span //Create chat-entry span
this.chatEntry = document.createElement('span'); this.chatEntry = document.createElement('span');
this.chatEntry.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry`,`${classSuffix}-entry-${this.rawData.user}`);
//Add classes to classlist
this.chatEntry.classList.add(
`${classSuffixAlt}-buffer`,
`${classSuffix}-entry`,
`${classSuffix}-entry-${this.rawData.user}`,
`${classSuffix}-${color}`
);
//Create high-level label //Create high-level label
let highLevel = document.createElement('p'); var highLevel = document.createElement('p');
highLevel.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry-high-level`,"high-level"); highLevel.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry-high-level`,"high-level");
highLevel.textContent = utils.unescapeEntities(`${this.rawData.highLevel}`); highLevel.textContent = utils.unescapeEntities(`${this.rawData.highLevel}`);
this.chatEntry.appendChild(highLevel); this.chatEntry.appendChild(highLevel);
@ -117,15 +102,19 @@ class chatPostprocessor{
//If we're not using classic flair //If we're not using classic flair
if(this.rawData.flair != "classic"){ if(this.rawData.flair != "classic"){
//Use flair //Use flair
flair = `flair-${this.rawData.flair}`; var flair = `flair-${this.rawData.flair}`;
//Otherwise
}else{
//Pull user's assigned color from the color map
var flair = this.client.userList.colorMap.get(this.rawData.user);
} }
//Create username label //Create username label
let userLabel = document.createElement('p'); var userLabel = document.createElement('p');
userLabel.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-username`, ); userLabel.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-username`, );
//Create color span //Create color span
let flairSpan = document.createElement('span'); var flairSpan = document.createElement('span');
flairSpan.classList.add(`${classSuffix}-entry-flair-span`, flair); flairSpan.classList.add(`${classSuffix}-entry-flair-span`, flair);
flairSpan.innerHTML = this.rawData.user; flairSpan.innerHTML = this.rawData.user;

View file

@ -102,27 +102,6 @@ class userList{
}) })
} }
/**
* Randomly assigns and gets a color to usernames that aren't on the colormap
* @param {String} user username to assign a color
*/
assignColor(user){
//if this user wasn't in the previous colormap
if(this.colorMap.get(user) == null){
//randomly pick a color
let color = this.userColors[Math.floor(Math.random()*this.userColors.length)]
//Store new randomly selected color
this.colorMap.set(user, color);
//Return color
return color;
}else{
//Return color from previous entry
return this.colorMap.get(user);
}
}
/** /**
* Updates UX after user list change * Updates UX after user list change
* @param {Array} list - Userlist data from server * @param {Array} list - Userlist data from server
@ -137,8 +116,19 @@ class userList{
//for each user //for each user
list.forEach((user) => { list.forEach((user) => {
//Assign color and render user //randomly pick a color
this.renderUser(user, this.assignColor(user.user)); var color = this.userColors[Math.floor(Math.random()*this.userColors.length)]
//if this user wasn't in the previous colormap
if(this.colorMap.get(user.user) == null){
//Store new randomly selected color
this.colorMap.set(user.user, color);
}else{
//Use color from previous entry
color = this.colorMap.get(user.user);
}
this.renderUser(user, color);
}); });
//Make sure we're not cutting the ux off //Make sure we're not cutting the ux off
@ -197,7 +187,7 @@ class userList{
if(user.user != "Tokebot" && user.user != this.client.user.user){ if(user.user != "Tokebot" && user.user != this.client.user.user){
if(this.client.user.permMap.chan.get("kickUser")){ if(this.client.user.permMap.chan.get("kickUser")){
menuMap.set("Kick", ()=>{this.client.chatBox.transmit(`!kick ${user.user}`);}); menuMap.set("Kick", ()=>{this.client.chatBox.commandPreprocessor.preprocess(`!kick ${user.user}`)});
} }
if(this.client.user.permMap.chan.get("banUser")){ if(this.client.user.permMap.chan.get("banUser")){