diff --git a/src/schemas/tokebot/tokeSchema.js b/src/schemas/tokebot/tokeSchema.js index 14ddeb7..cc9d487 100644 --- a/src/schemas/tokebot/tokeSchema.js +++ b/src/schemas/tokebot/tokeSchema.js @@ -90,7 +90,9 @@ tokeSchema.statics.calculateTokeMap = async function(){ } //Display calculated toke sats for funsies - console.log(`Processed ${this.commandCount} toke command callouts accross ${this.count} tokes, averaging ${(this.commandCount/this.count).toFixed(3)} tokers per toke.`); + 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.`); + } } /** diff --git a/src/utils/loggerUtils.js b/src/utils/loggerUtils.js index 4259e56..1835e58 100644 --- a/src/utils/loggerUtils.js +++ b/src/utils/loggerUtils.js @@ -65,8 +65,8 @@ module.exports.errorHandler = function(res, msg, type = "Generic", status = 400) * @param {Error} err - Exception to handle */ module.exports.localExceptionHandler = function(err){ - //If this wasn't made by exceptionSmith - if(!err.custom){ + //If we're being verbose and this isn't just a basic bitch + if(!err.custom && config.verbose){ //Log the error module.exports.dumpError(err); } @@ -188,12 +188,6 @@ module.exports.dumpError = async function(err, date = new Date(), subDir = 'cras //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}`; - //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 module.exports.dumpLog(content, date.getTime(), subDir, muzzle); } diff --git a/src/utils/upgradeUtils.js b/src/utils/upgradeUtils.js index 971f374..f0a3717 100644 --- a/src/utils/upgradeUtils.js +++ b/src/utils/upgradeUtils.js @@ -35,23 +35,27 @@ module.exports.upgradeCheck = async function(){ //Get the server statistics document from Database 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(stats.version == "<0.2.0"){ //Initiate upgrade procedure from Panama Red await upgradePanamaRed(); + + //Throw upgrade started flag + upgradeStarted = true; } //If we upgraded - if(stats.version != package.version){ + if(upgradeStarted){ //Update the statistics document to reflect the new version stats.version = package.version; //Write the statistics document to the DB await stats.save(); - - //Shout about successfuly upgrade - loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`); } + loggerUtils.consoleShout(`Database Upgrading to ${package.canopyDisplayVersion} Complete!`); } /** diff --git a/www/css/theme/the-network.css b/www/css/theme/the-network.css index e85da5e..d8f427e 100644 --- a/www/css/theme/the-network.css +++ b/www/css/theme/the-network.css @@ -17,22 +17,21 @@ along with this program. If not, see .*/ /* Theme Variables */ :root{ --main-font: "open-sans", system-ui; - --bg0: rgb(37, 37, 37); - --bg0-alpha0: rgba(37, 37, 37, 0.4); - --bg0-alpha1: rgba(37, 37, 37, 0.75); - --bg1: rgb(1, 1, 1); - --bg1-gradient: linear-gradient(to top, rgb(1, 1, 1), rgb(37, 37, 37)); - --bg2: rgb(0, 0, 0); + --bg0: rgb(14, 14, 14); + --bg0-alpha0: rgba(158, 158, 158, 0.4); + --bg0-alpha1: rgba(158, 158, 158, 0.75); + --bg1: rgb(70, 70, 70); + --bg2: rgb(220, 220, 220); --bg1-alt0: rgb(30, 30, 30); --bg2-alt0: rgb(200, 200, 200); --bg2-alt1: rgb(180, 180, 180); - --accent0: rgb(212, 212, 212); - --accent0-alt0: rgb(185, 185, 185); - --accent0-alt1: rgb(124, 124, 124); - --accent1: var(--accent0); - --accent1-alt0: var(--accent0-alt0); - --accent1-alt1: var(--accent0-alt1); + --accent0: rgb(47, 47, 47); + --accent0-alt0: rgb(34, 34, 34); + --accent0-alt1: rgb(70, 70, 70); + --accent1: rgb(245, 245, 245); + --accent1-alt0: rgb(185, 185, 185); + --accent1-alt1: rgb(124, 124, 124); --accent2: var(--accent0-alt0); --focus0: rgb(51, 153, 51); @@ -83,6 +82,7 @@ body{ background-color: var(--bg0); font-family: var(--main-font); color: var(--accent0); + background-image: url('/img/background.png'); background-size: 5em; scrollbar-color: var(--accent0-alt1) transparent; } @@ -118,7 +118,6 @@ button i{ select{ background-color: var(--bg2); - color: var(--accent0); border-radius: 0.5em; border: none; } @@ -274,7 +273,7 @@ a.admin-list-entry-item{ div.control-prompt{ border-radius: 1em; - background-color: var(--bg0); + background-color: white; } div.control-prompt:focus-within{ @@ -285,8 +284,6 @@ input.control-prompt, input.control-prompt:focus{ border: none; outline: none; box-shadow: none; - background-color: var(--bg0); - color: var(--accent0); } @@ -296,7 +293,7 @@ input.control-prompt, input.control-prompt:focus{ /* navbar */ #navbar{ - background-image: var(--bg1-gradient); + background-color: var(--bg1); } .navbar-item{ @@ -354,6 +351,7 @@ p.channel-guide-entry-item{ #chat-panel-head-spacer-span, #chat-panel-users-div{ background-color: var(--bg0); + background-image: url("/img/background.png"); background-size: 2.3em } @@ -362,17 +360,9 @@ p.channel-guide-entry-item{ text-shadow: var(--focus-glow0-alt0); } -#chat-panel-control-div{ - margin: 0; - border-radius: 0; -} - -.chat-entry:nth-child(even){ - background-color: var(--bg0); -} - -.chat-entry:nth-child(odd){ - background-color: var(--bg1-alt0); +.chat-entry{ + background-color: var(--bg2); + border-bottom: 1px solid var(--bg2-alt1); } .serverwhisper{ @@ -407,34 +397,6 @@ p.channel-guide-entry-item{ 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{ text-shadow: var(--userlist-contrast-glow); } @@ -539,7 +501,6 @@ Begin each subsection with a materials and equipment manifest.*/ .high-level{ 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{ diff --git a/www/js/channel/chatPostprocessor.js b/www/js/channel/chatPostprocessor.js index 1ab660c..138cb1c 100644 --- a/www/js/channel/chatPostprocessor.js +++ b/www/js/channel/chatPostprocessor.js @@ -87,29 +87,14 @@ class chatPostprocessor{ } 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 classSuffixAlt = pm ? classSuffix : 'chat-panel'; - //Create chat-entry span this.chatEntry = document.createElement('span'); - - //Add classes to classlist - this.chatEntry.classList.add( - `${classSuffixAlt}-buffer`, - `${classSuffix}-entry`, - `${classSuffix}-entry-${this.rawData.user}`, - `${classSuffix}-${color}` - ); + this.chatEntry.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry`,`${classSuffix}-entry-${this.rawData.user}`); //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.textContent = utils.unescapeEntities(`${this.rawData.highLevel}`); this.chatEntry.appendChild(highLevel); @@ -117,15 +102,19 @@ class chatPostprocessor{ //If we're not using classic flair if(this.rawData.flair != "classic"){ //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 - let userLabel = document.createElement('p'); + var userLabel = document.createElement('p'); userLabel.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-username`, ); //Create color span - let flairSpan = document.createElement('span'); + var flairSpan = document.createElement('span'); flairSpan.classList.add(`${classSuffix}-entry-flair-span`, flair); flairSpan.innerHTML = this.rawData.user; diff --git a/www/js/channel/userlist.js b/www/js/channel/userlist.js index 89abe90..3156300 100644 --- a/www/js/channel/userlist.js +++ b/www/js/channel/userlist.js @@ -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 * @param {Array} list - Userlist data from server @@ -137,8 +116,19 @@ class userList{ //for each user list.forEach((user) => { - //Assign color and render user - this.renderUser(user, this.assignColor(user.user)); + //randomly pick a color + 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 @@ -197,7 +187,7 @@ class userList{ if(user.user != "Tokebot" && user.user != this.client.user.user){ 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")){