From d72428df8eeb3c5fe579c956d13483e4cd8a3d5b Mon Sep 17 00:00:00 2001 From: marzavec Date: Fri, 29 Dec 2023 23:24:12 -0800 Subject: [PATCH] documentation update --- commands/core/changecolor.js | 2 +- commands/core/changenick.js | 2 +- commands/core/chat.js | 6 +- commands/core/emote.js | 2 +- commands/core/help.js | 2 +- commands/core/morestats.js | 2 +- commands/core/whisper.js | 2 +- commands/mod/dumb.js | 6 +- commands/mod/enablecaptcha.js | 4 +- commands/mod/forcecolor.js | 2 +- commands/mod/lockroom.js | 10 +- documentation/admin_addmod.js.html | 6 +- documentation/admin_listusers.js.html | 4 +- documentation/admin_reload.js.html | 7 +- documentation/admin_removemod.js.html | 8 +- documentation/admin_saveconfig.js.html | 8 +- documentation/admin_shout.js.html | 4 +- documentation/core_changecolor.js.html | 6 +- documentation/core_changenick.js.html | 20 +- documentation/core_chat.js.html | 92 +- documentation/core_emote.js.html | 6 +- documentation/core_help.js.html | 7 +- documentation/core_invite.js.html | 4 +- documentation/core_join.js.html | 37 +- documentation/core_morestats.js.html | 6 +- documentation/core_ping.js.html | 4 +- documentation/core_session.js.html | 39 +- documentation/core_stats.js.html | 4 +- documentation/core_updateMessage.js.html | 178 +++ documentation/core_whisper.js.html | 6 +- documentation/index.html | 4 +- documentation/internal_disconnect.js.html | 20 +- documentation/internal_socketreply.js.html | 4 +- documentation/mod_ban.js.html | 4 +- documentation/mod_disablecaptcha.js.html | 137 ++ documentation/mod_dumb.js.html | 10 +- documentation/mod_enablecaptcha.js.html | 330 ++++ documentation/mod_forcecolor.js.html | 6 +- documentation/mod_kick.js.html | 4 +- documentation/mod_lockroom.js.html | 382 +++++ documentation/mod_speak.js.html | 6 +- documentation/mod_unban.js.html | 4 +- documentation/mod_unbanall.js.html | 4 +- documentation/mod_unlockroom.js.html | 140 ++ documentation/module-addmod.html | 4 +- documentation/module-ban.html | 4 +- documentation/module-changecolor.html | 30 +- documentation/module-changenick.html | 38 +- documentation/module-chat.html | 645 +++++++- documentation/module-disablecaptcha.html | 687 ++++++++ documentation/module-disconnect.html | 10 +- documentation/module-dumb.html | 105 +- documentation/module-emote.html | 30 +- documentation/module-enablecaptcha.html | 1178 ++++++++++++++ documentation/module-forcecolor.html | 30 +- documentation/module-help.html | 36 +- documentation/module-invite.html | 4 +- documentation/module-join.html | 10 +- documentation/module-kick.html | 4 +- documentation/module-listusers.html | 4 +- documentation/module-lockroom.html | 1681 ++++++++++++++++++++ documentation/module-morestats.html | 30 +- documentation/module-ping.html | 4 +- documentation/module-reload.html | 6 +- documentation/module-removemod.html | 8 +- documentation/module-saveconfig.html | 6 +- documentation/module-session.html | 22 +- documentation/module-shout.html | 4 +- documentation/module-socketreply.html | 4 +- documentation/module-speak.html | 27 +- documentation/module-stats.html | 4 +- documentation/module-unban.html | 4 +- documentation/module-unbanall.html | 4 +- documentation/module-unlockroom.html | 686 ++++++++ documentation/module-updateMessage.html | 604 +++++++ documentation/module-whisper.html | 30 +- documentation/scripts/linenumber.js | 40 +- documentation/scripts/prettify/lang-css.js | 4 +- documentation/scripts/prettify/prettify.js | 153 +- 79 files changed, 7288 insertions(+), 393 deletions(-) create mode 100644 documentation/core_updateMessage.js.html create mode 100644 documentation/mod_disablecaptcha.js.html create mode 100644 documentation/mod_enablecaptcha.js.html create mode 100644 documentation/mod_lockroom.js.html create mode 100644 documentation/mod_unlockroom.js.html create mode 100644 documentation/module-disablecaptcha.html create mode 100644 documentation/module-enablecaptcha.html create mode 100644 documentation/module-lockroom.html create mode 100644 documentation/module-unlockroom.html create mode 100644 documentation/module-updateMessage.html diff --git a/commands/core/changecolor.js b/commands/core/changecolor.js index 8326b2a..bb75a14 100644 --- a/commands/core/changecolor.js +++ b/commands/core/changecolor.js @@ -89,7 +89,7 @@ export function initHooks(server) { * Executes every time an incoming chat command is invoked * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/changenick.js b/commands/core/changenick.js index 184e966..ceda5df 100644 --- a/commands/core/changenick.js +++ b/commands/core/changenick.js @@ -143,7 +143,7 @@ export function initHooks(server) { * Executes every time an incoming chat command is invoked * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/chat.js b/commands/core/chat.js index b8ed943..958ccbc 100644 --- a/commands/core/chat.js +++ b/commands/core/chat.js @@ -35,7 +35,7 @@ const TIMEOUT_CHECK_INTERVAL = 30 * 1000; /** * Stores active messages that can be edited. - * @type {{ customId: string, userid: number, sent: number }[]} + * @type {Array} */ export const ACTIVE_MESSAGES = []; @@ -161,7 +161,7 @@ export function initHooks(server) { * checks for miscellaneous '/' based commands * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -188,7 +188,7 @@ export function commandCheckIn({ server, socket, payload }) { * assumes a failed chat command invocation and will reject with notice * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/emote.js b/commands/core/emote.js index 0f00eda..3adfbbd 100644 --- a/commands/core/emote.js +++ b/commands/core/emote.js @@ -91,7 +91,7 @@ export function initHooks(server) { * hooks chat commands checking for /me * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/help.js b/commands/core/help.js index 8152896..7431217 100644 --- a/commands/core/help.js +++ b/commands/core/help.js @@ -86,7 +86,7 @@ export function initHooks(server) { * hooks chat commands checking for /help * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/morestats.js b/commands/core/morestats.js index 02ea8af..c2f4cfa 100644 --- a/commands/core/morestats.js +++ b/commands/core/morestats.js @@ -118,7 +118,7 @@ export function initHooks(server) { * hooks chat commands checking for /stats * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/core/whisper.js b/commands/core/whisper.js index 7a2ae17..3a96338 100644 --- a/commands/core/whisper.js +++ b/commands/core/whisper.js @@ -124,7 +124,7 @@ export function initHooks(server) { * hooks chat commands checking for /whisper * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/mod/dumb.js b/commands/mod/dumb.js index ea602ac..d36cc7c 100644 --- a/commands/mod/dumb.js +++ b/commands/mod/dumb.js @@ -155,7 +155,7 @@ export function initHooks(server) { * hook incoming chat commands, shadow-prevent chat if they are muzzled * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -218,7 +218,7 @@ export function chatCheck({ * shadow-prevent all invites from muzzled users * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -290,7 +290,7 @@ export function inviteCheck({ * shadow-prevent all whispers from muzzled users * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/mod/enablecaptcha.js b/commands/mod/enablecaptcha.js index 0992219..06bba46 100644 --- a/commands/mod/enablecaptcha.js +++ b/commands/mod/enablecaptcha.js @@ -101,7 +101,7 @@ export function initHooks(server) { * hook incoming chat commands, check if they are answering a captcha * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -156,7 +156,7 @@ export function chatCheck({ * hook incoming join commands, check if they are joining a captcha protected channel * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/mod/forcecolor.js b/commands/mod/forcecolor.js index 8c53caf..0f6bd23 100644 --- a/commands/mod/forcecolor.js +++ b/commands/mod/forcecolor.js @@ -118,7 +118,7 @@ export function initHooks(server) { * hooks chat commands checking for /forcecolor * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/commands/mod/lockroom.js b/commands/mod/lockroom.js index c27d612..9c28333 100644 --- a/commands/mod/lockroom.js +++ b/commands/mod/lockroom.js @@ -126,7 +126,7 @@ export function initHooks(server) { * hook incoming changenick commands, reject them if the channel is 'purgatory' * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -145,7 +145,7 @@ export function changeNickCheck({ * hook incoming whisper commands, reject them if the channel is 'purgatory' * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -164,7 +164,7 @@ export function whisperCheck({ * hook incoming chat commands, reject them if the channel is 'purgatory' * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -187,7 +187,7 @@ export function chatCheck({ * hook incoming invite commands, reject them if the channel is 'purgatory' * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -206,7 +206,7 @@ export function inviteCheck({ * hook incoming join commands, shunt them to purgatory if needed * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ diff --git a/documentation/admin_addmod.js.html b/documentation/admin_addmod.js.html index 94ee2a3..8f440eb 100644 --- a/documentation/admin_addmod.js.html +++ b/documentation/admin_addmod.js.html @@ -56,7 +56,7 @@ export async function run({ } // add new trip to config - core.config.mods.push({ trip: payload.trip }); + core.appConfig.data.globalMods.push({ trip: payload.trip }); // find targets current connections const newMod = server.findSockets({ trip: payload.trip }); @@ -144,13 +144,13 @@ export const info = {
diff --git a/documentation/admin_listusers.js.html b/documentation/admin_listusers.js.html index c2d28a0..4d052f1 100644 --- a/documentation/admin_listusers.js.html +++ b/documentation/admin_listusers.js.html @@ -113,13 +113,13 @@ export const info = {
diff --git a/documentation/admin_reload.js.html b/documentation/admin_reload.js.html index fa80ba2..3294c48 100644 --- a/documentation/admin_reload.js.html +++ b/documentation/admin_reload.js.html @@ -54,8 +54,7 @@ export async function run({ } // do command reload and store results - let loadResult = core.dynamicImports.reloadDirCache(); - loadResult += core.commands.loadCommands(); + let loadResult = await core.commands.reloadCommands(); // clear and rebuild all module hooks server.loadHooks(); @@ -108,13 +107,13 @@ export const info = {
diff --git a/documentation/admin_removemod.js.html b/documentation/admin_removemod.js.html index 5c79041..cab6c34 100644 --- a/documentation/admin_removemod.js.html +++ b/documentation/admin_removemod.js.html @@ -57,7 +57,9 @@ export async function run({ // remove trip from config // eslint-disable-next-line no-param-reassign - core.config.mods = core.config.mods.filter((mod) => mod.trip !== payload.trip); + core.appConfig.data.globalMods = core.appConfig.data.globalMods.filter( + (mod) => mod.trip !== payload.trip, + ); // find targets current connections const targetMod = server.findSockets({ trip: payload.trip }); @@ -147,13 +149,13 @@ export const info = {
diff --git a/documentation/admin_saveconfig.js.html b/documentation/admin_saveconfig.js.html index 336418e..2856e3e 100644 --- a/documentation/admin_saveconfig.js.html +++ b/documentation/admin_saveconfig.js.html @@ -52,7 +52,9 @@ export async function run({ core, server, socket }) { } // attempt save, notify of failure - if (!core.configManager.save()) { + try { + await core.appConfig.write(); + } catch (err) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` text: 'Failed to save config, check logs.', @@ -96,13 +98,13 @@ export const info = {
diff --git a/documentation/admin_shout.js.html b/documentation/admin_shout.js.html index 68b9e61..e5cd885 100644 --- a/documentation/admin_shout.js.html +++ b/documentation/admin_shout.js.html @@ -94,13 +94,13 @@ export const info = {
diff --git a/documentation/core_changecolor.js.html b/documentation/core_changecolor.js.html index e63a2c2..76804dd 100644 --- a/documentation/core_changecolor.js.html +++ b/documentation/core_changecolor.js.html @@ -117,7 +117,7 @@ export function initHooks(server) { * Executes every time an incoming chat command is invoked * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -194,13 +194,13 @@ export const info = {
diff --git a/documentation/core_changenick.js.html b/documentation/core_changenick.js.html index 1715f7f..e70e4b2 100644 --- a/documentation/core_changenick.js.html +++ b/documentation/core_changenick.js.html @@ -48,7 +48,7 @@ import { * @return {void} */ export async function run({ - core, server, socket, payload, + server, socket, payload, }) { const { channel } = socket; @@ -77,18 +77,6 @@ export async function run({ }, socket); } - // prevent admin impersonation - // @todo prevent mod impersonation - if (newNick.toLowerCase() === core.config.adminName.toLowerCase()) { - server.police.frisk(socket, 4); - - return server.reply({ - cmd: 'warn', // @todo Add numeric error code as `id` - text: 'You are not the admin, liar!', - channel, // @todo Multichannel - }, socket); - } - if (newNick == previousNick) { return server.reply({ cmd: 'warn', // @todo Add numeric error code as `id` @@ -183,7 +171,7 @@ export function initHooks(server) { * Executes every time an incoming chat command is invoked * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -261,13 +249,13 @@ export const info = {
diff --git a/documentation/core_chat.js.html b/documentation/core_chat.js.html index f41697e..5c8594a 100644 --- a/documentation/core_chat.js.html +++ b/documentation/core_chat.js.html @@ -34,33 +34,73 @@ * @module chat */ +import { + parseText, +} from '../utility/_Text.js'; import { isAdmin, isModerator, } from '../utility/_UAC.js'; /** - * Check and trim string provided by remote client - * @param {string} text - Subject string - * @private - * @todo Move into utility module - * @return {string|boolean} + * Maximum length of the customId property + * @type {number} */ -const parseText = (text) => { - // verifies user input is text - if (typeof text !== 'string') { - return false; +export const MAX_MESSAGE_ID_LENGTH = 6; + +/** + * The time in milliseconds before a message is considered stale, and thus no longer allowed + * to be edited. + * @type {number} + */ +const ACTIVE_TIMEOUT = 5 * 60 * 1000; + +/** + * The time in milliseconds that a check for stale messages should be performed. + * @type {number} + */ +const TIMEOUT_CHECK_INTERVAL = 30 * 1000; + +/** + * Stores active messages that can be edited. + * @type {Array} + */ +export const ACTIVE_MESSAGES = []; + +/** + * Cleans up stale messages. + * @public + * @return {void} + */ +export function cleanActiveMessages() { + const now = Date.now(); + for (let i = 0; i < ACTIVE_MESSAGES.length; i += 1) { + const message = ACTIVE_MESSAGES[i]; + if (now - message.sent > ACTIVE_TIMEOUT || message.toDelete) { + ACTIVE_MESSAGES.splice(i, 1); + i -= 1; + } } +} - let sanitizedText = text; +// TODO: This won't get cleared on module reload. +setInterval(cleanActiveMessages, TIMEOUT_CHECK_INTERVAL); - // strip newlines from beginning and end - sanitizedText = sanitizedText.replace(/^\s*\n|^\s+$|\n\s*$/g, ''); - // replace 3+ newlines with just 2 newlines - sanitizedText = sanitizedText.replace(/\n{3,}/g, '\n\n'); - - return sanitizedText; -}; +/** + * Adds a message to the active messages map. + * @public + * @param {string} id + * @param {number} userid + * @return {void} + */ +export function addActiveMessage(customId, userid) { + ACTIVE_MESSAGES.push({ + customId, + userid, + sent: Date.now(), + toDelete: false, + }); +} /** * Executes when invoked by a remote client @@ -89,6 +129,13 @@ export async function run({ }, socket); } + const { customId } = payload; + + if (typeof (customId) === 'string' && customId.length > MAX_MESSAGE_ID_LENGTH) { + // There's a limit on the custom id length. + return server.police.frisk(socket, 13); + } + // build chat payload const outgoingPayload = { cmd: 'chat', @@ -98,6 +145,7 @@ export async function run({ channel: socket.channel, text, level: socket.level, + customId, }; if (isAdmin(socket.level)) { @@ -114,6 +162,8 @@ export async function run({ outgoingPayload.color = socket.color; } + addActiveMessage(outgoingPayload.customId, socket.userid); + // broadcast to channel peers server.broadcast(outgoingPayload, { channel: socket.channel }); @@ -139,7 +189,7 @@ export function initHooks(server) { * checks for miscellaneous '/' based commands * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -166,7 +216,7 @@ export function commandCheckIn({ server, socket, payload }) { * assumes a failed chat command invocation and will reject with notice * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -231,13 +281,13 @@ export const info = {
diff --git a/documentation/core_emote.js.html b/documentation/core_emote.js.html index f4392c3..9779ad6 100644 --- a/documentation/core_emote.js.html +++ b/documentation/core_emote.js.html @@ -119,7 +119,7 @@ export function initHooks(server) { * hooks chat commands checking for /me * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -198,13 +198,13 @@ export const info = {
diff --git a/documentation/core_help.js.html b/documentation/core_help.js.html index a062853..dd69be4 100644 --- a/documentation/core_help.js.html +++ b/documentation/core_help.js.html @@ -79,6 +79,7 @@ export async function run({ } else { reply += `# ${command.info.name} command:\n| | |\n|---:|---|\n`; reply += `|**Name:**|${command.info.name}|\n`; + reply += `|**Hash:**|${command.info.srcHash}|\n`; reply += `|**Aliases:**|${typeof command.info.aliases !== 'undefined' ? command.info.aliases.join(', ') : 'None'}|\n`; reply += `|**Category:**|${command.info.category.replace('../src/commands/', '').replace(/^\w/, (c) => c.toUpperCase())}|\n`; reply += `|**Required Parameters:**|${command.requiredData || 'None'}|\n`; @@ -113,7 +114,7 @@ export function initHooks(server) { * hooks chat commands checking for /help * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -170,13 +171,13 @@ export const info = {
diff --git a/documentation/core_invite.js.html b/documentation/core_invite.js.html index 0b8023b..51e7b23 100644 --- a/documentation/core_invite.js.html +++ b/documentation/core_invite.js.html @@ -159,13 +159,13 @@ export const info = {
diff --git a/documentation/core_join.js.html b/documentation/core_join.js.html index 50a162d..bbb2f07 100644 --- a/documentation/core_join.js.html +++ b/documentation/core_join.js.html @@ -27,6 +27,7 @@
/* eslint no-param-reassign: 0 */
+/* eslint import/no-cycle: [0, { ignoreExternal: true }] */
 
 /**
   * @author Marzavec ( https://github.com/marzavec )
@@ -36,6 +37,9 @@
   * @module join
   */
 
+import {
+  getSession,
+} from './session.js';
 import {
   canJoinChannel,
   socketInChannel,
@@ -51,6 +55,7 @@ import {
   verifyNickname,
   getUserPerms,
   getUserDetails,
+  isModerator,
 } from '../utility/_UAC.js';
 
 /**
@@ -73,7 +78,7 @@ export async function run({
   }
 
   // `join` is the legacy entry point, check if it needs to be upgraded
-  if (typeof socket.hcProtocol === 'undefined') {
+  if (typeof socket.hcProtocol === 'undefined' || socket.hcProtocol === 1) {
     payload = upgradeLegacyJoin(server, socket, payload);
   }
 
@@ -114,7 +119,7 @@ export async function run({
   }
 
   // get trip and level
-  const { trip, level } = getUserPerms(pass, core.config, channel);
+  const { trip, level } = getUserPerms(pass, core.saltKey, core.appConfig.data, channel);
 
   // store the user values
   const userInfo = {
@@ -129,13 +134,6 @@ export async function run({
     channel,
   };
 
-  // prevent admin impersonation
-  if (nick.toLowerCase() === core.config.adminName.toLowerCase()) {
-    if (userInfo.trip !== 'Admin') {
-      userInfo.nick = `Fake${userInfo.nick}`;
-    }
-  }
-
   // check if the nickname already exists in the channel
   const userExists = server.findSockets({
     channel,
@@ -180,6 +178,12 @@ export async function run({
   socket.channel = channel; /* @legacy */
   // @todo multi-channel patch
   // socket.channels.push(channel);
+  socket.channels = [channel];
+
+  // global mod perks
+  if (isModerator(socket.level)) {
+    socket.ratelimitImmune = true;
+  }
 
   nicks.push(userInfo.nick); /* @legacy */
   users.push({ ...{ isme: true, isBot: socket.isBot }, ...userInfo });
@@ -192,6 +196,14 @@ export async function run({
     channel, // @todo Multichannel (?)
   }, socket);
 
+  // update client with new session info
+  server.reply({
+    cmd: 'session',
+    restored: false,
+    token: getSession(socket, core),
+    channels: socket.channels,
+  }, socket);
+
   // stats are fun
   core.stats.increment('users-joined');
 
@@ -270,6 +282,9 @@ export function restoreJoin({
     channel, // @todo Multichannel (?)
   }, socket);
 
+  socket.channel = channel; /* @legacy */
+  socket.channels.push(channel);
+
   return true;
 }
 
@@ -299,13 +314,13 @@ export const info = {
 
 
 
 
 
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/core_morestats.js.html b/documentation/core_morestats.js.html index 4e37b5a..58e2351 100644 --- a/documentation/core_morestats.js.html +++ b/documentation/core_morestats.js.html @@ -146,7 +146,7 @@ export function initHooks(server) { * hooks chat commands checking for /stats * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -200,13 +200,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/core_ping.js.html b/documentation/core_ping.js.html index fd0cb6f..5c9bfbd 100644 --- a/documentation/core_ping.js.html +++ b/documentation/core_ping.js.html @@ -68,13 +68,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/core_session.js.html b/documentation/core_session.js.html index 78c58a0..3d04283 100644 --- a/documentation/core_session.js.html +++ b/documentation/core_session.js.html @@ -26,7 +26,7 @@
-
/* eslint no-param-reassign: 0 */
+            
/* eslint import/no-cycle: [0, { ignoreExternal: true }] */
 
 /**
   * @author Marzavec ( https://github.com/marzavec )
@@ -40,6 +40,7 @@ import fs from 'fs';
 import jsonwebtoken from 'jsonwebtoken';
 
 import {
+  isModerator,
   verifyNickname,
 } from '../utility/_UAC.js';
 import {
@@ -49,10 +50,10 @@ import {
   restoreJoin,
 } from './join.js';
 
-const CertLocation = './cert.key';
+const SessionLocation = './session.key';
 
 /**
-  *
+  * Get a new json web token for the provided socket
   * @param {*} socket
   * @param {*} core
   * @returns {object}
@@ -68,15 +69,15 @@ export function getSession(socket, core) {
     trip: socket.trip,
     userid: socket.userid,
     uType: socket.uType,
-    muzzled: socket.muzzled,
-    banned: socket.banned,
-  }, core.cert, {
+    muzzled: socket.muzzled || false,
+    banned: socket.banned || false,
+  }, core.sessionKey, {
     expiresIn: '7 days',
   });
 }
 
 /**
-  *
+  * Reply to target socket with session failure notice
   * @param {*} server
   * @param {*} socket
   * @returns {boolean}
@@ -106,7 +107,7 @@ export async function run({
 
   let session = false;
   try {
-    session = jsonwebtoken.verify(payload.token, core.cert);
+    session = jsonwebtoken.verify(payload.token, core.sessionKey);
   } catch (err) {
     return notifyFailure(server, socket);
   }
@@ -120,7 +121,7 @@ export async function run({
     return notifyFailure(server, socket);
   }
 
-  if (typeof session.color !== 'string') {
+  if (typeof session.color !== 'string' && typeof session.color !== 'boolean') {
     return notifyFailure(server, socket);
   }
 
@@ -157,8 +158,7 @@ export async function run({
   }
 
   // populate socket info with validated session
-  socket.channel = session.channel;
-  socket.channels = session.channels;
+  socket.channels = [];
   socket.color = session.color;
   socket.isBot = session.isBot;
   socket.level = session.level;
@@ -169,6 +169,11 @@ export async function run({
   socket.muzzled = session.muzzled;
   socket.banned = session.banned;
 
+  // global mod perks
+  if (isModerator(socket.level)) {
+    socket.ratelimitImmune = true;
+  }
+
   socket.hash = server.getSocketHash(socket);
   socket.hcProtocol = 2;
 
@@ -180,12 +185,12 @@ export async function run({
     channels: socket.channels,
   }, socket);
 
-  for (let i = 0, j = socket.channels.length; i < j; i += 1) {
+  for (let i = 0, j = session.channels.length; i < j; i += 1) {
     restoreJoin({
       core,
       server,
       socket,
-      channel: socket.channels[i],
+      channel: session.channels[i],
     }, true);
   }
 
@@ -200,8 +205,8 @@ export async function run({
   */
 export function init(core) {
   // load the encryption key if required
-  if (typeof core.cert === 'undefined') {
-    core.cert = fs.readFileSync(CertLocation);
+  if (typeof core.sessionKey === 'undefined') {
+    core.sessionKey = fs.readFileSync(SessionLocation);
   }
 }
 
@@ -230,13 +235,13 @@ export const info = {
 
 
 
 
 
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/core_stats.js.html b/documentation/core_stats.js.html index b16c7b9..e25eb13 100644 --- a/documentation/core_stats.js.html +++ b/documentation/core_stats.js.html @@ -95,13 +95,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/core_updateMessage.js.html b/documentation/core_updateMessage.js.html new file mode 100644 index 0000000..3b19b89 --- /dev/null +++ b/documentation/core_updateMessage.js.html @@ -0,0 +1,178 @@ + + + + + JSDoc: Source: core/updateMessage.js + + + + + + + + + + +
+ +

Source: core/updateMessage.js

+ + + + + + +
+
+
/**
+  * @author MinusGix ( https://github.com/MinusGix )
+  * @summary Change target message
+  * @version v1.0.0
+  * @description Will alter a previously sent message using that message's customId
+  * @module updateMessage
+  */
+
+import {
+  parseText,
+} from '../utility/_Text.js';
+import {
+  isAdmin,
+  isModerator,
+} from '../utility/_UAC.js';
+import {
+  ACTIVE_MESSAGES,
+  MAX_MESSAGE_ID_LENGTH,
+} from './chat.js';
+
+/**
+  * Executes when invoked by a remote client
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {void}
+  */
+export async function run({
+  server, socket, payload,
+}) {
+  // undefined | "overwrite" | "append" | "prepend" | "complete"
+  const { customId } = payload;
+  let { mode, text } = payload;
+
+  if (!mode) {
+    mode = 'overwrite';
+  }
+
+  if (mode !== 'overwrite' && mode !== 'append' && mode !== 'prepend' && mode !== 'complete') {
+    return server.police.frisk(socket, 13);
+  }
+
+  if (!customId || typeof customId !== 'string' || customId.length > MAX_MESSAGE_ID_LENGTH) {
+    return server.police.frisk(socket, 13);
+  }
+
+  if (typeof (text) !== 'string') {
+    return server.police.frisk(socket, 13);
+  }
+
+  if (mode === 'overwrite') {
+    text = parseText(text);
+
+    if (text === '') {
+      text = '\u0000';
+    }
+  }
+
+  if (!text) {
+    return server.police.frisk(socket, 13);
+  }
+
+  // TODO: What score should we use for this? It isn't as space filling as chat messages.
+  // But we also don't want a massive growing message.
+  // Or flashing between huge and small. Etc.
+
+  let message;
+  for (let i = 0; i < ACTIVE_MESSAGES.length; i += 1) {
+    const msg = ACTIVE_MESSAGES[i];
+
+    if (msg.userid === socket.userid && msg.customId === customId) {
+      message = ACTIVE_MESSAGES[i];
+      if (mode === 'complete') {
+        ACTIVE_MESSAGES[i].toDelete = true;
+      }
+      break;
+    }
+  }
+
+  if (!message) {
+    return server.police.frisk(socket, 6);
+  }
+
+  const outgoingPayload = {
+    cmd: 'updateMessage',
+    userid: socket.userid,
+    channel: socket.channel,
+    level: socket.level,
+    mode,
+    text,
+    customId: message.customId,
+  };
+
+  if (isAdmin(socket.level)) {
+    outgoingPayload.admin = true;
+  } else if (isModerator(socket.level)) {
+    outgoingPayload.mod = true;
+  }
+
+  server.broadcast(outgoingPayload, { channel: socket.channel });
+
+  return true;
+}
+
+/**
+  * The following payload properties are required to invoke this module:
+  * "text", "customId"
+  * @public
+  * @typedef {Array} addmod/requiredData
+  */
+export const requiredData = ['text', 'customId'];
+
+/**
+  * Module meta information
+  * @public
+  * @typedef {Object} updateMessage/info
+  * @property {string} name - Module command name
+  * @property {string} category - Module category name
+  * @property {string} description - Information about module
+  * @property {string} usage - Information about module usage
+  */
+export const info = {
+  name: 'updateMessage',
+  category: 'core',
+  description: 'Update a message you have sent.',
+  usage: `
+    API: { cmd: 'updateMessage', mode: 'overwrite'|'append'|'prepend'|'complete', text: '<text to apply>', customId: '<customId sent with the chat message>' }`,
+};
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + diff --git a/documentation/core_whisper.js.html b/documentation/core_whisper.js.html index dcc81b9..bf1f995 100644 --- a/documentation/core_whisper.js.html +++ b/documentation/core_whisper.js.html @@ -152,7 +152,7 @@ export function initHooks(server) { * hooks chat commands checking for /whisper * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -267,13 +267,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/index.html b/documentation/index.html index 310280f..6fa26bb 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -90,13 +90,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/internal_disconnect.js.html b/documentation/internal_disconnect.js.html index 5379738..5ac0c97 100644 --- a/documentation/internal_disconnect.js.html +++ b/documentation/internal_disconnect.js.html @@ -34,6 +34,10 @@ * @module disconnect */ +import { + socketInChannel, +} from '../utility/_Channels.js'; + /** * Executes when invoked by a remote client * @param {Object} env - Enviroment object with references to core, server, socket & payload @@ -49,10 +53,14 @@ export async function run({ server, socket, payload }) { // send leave notice to client peers // @todo Multichannel update if (socket.channel) { - server.broadcast({ - cmd: 'onlineRemove', - nick: socket.nick, - }, { channel: socket.channel }); + const isDuplicate = socketInChannel(server, socket.channel, socket); + + if (isDuplicate === false) { + server.broadcast({ + cmd: 'onlineRemove', + nick: socket.nick, + }, { channel: socket.channel }); + } } // commit close just in case @@ -94,13 +102,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/internal_socketreply.js.html b/documentation/internal_socketreply.js.html index 1f233bd..6ac2255 100644 --- a/documentation/internal_socketreply.js.html +++ b/documentation/internal_socketreply.js.html @@ -87,13 +87,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_ban.js.html b/documentation/mod_ban.js.html index d87bc9b..2dbe6da 100644 --- a/documentation/mod_ban.js.html +++ b/documentation/mod_ban.js.html @@ -151,13 +151,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_disablecaptcha.js.html b/documentation/mod_disablecaptcha.js.html new file mode 100644 index 0000000..46eba22 --- /dev/null +++ b/documentation/mod_disablecaptcha.js.html @@ -0,0 +1,137 @@ + + + + + JSDoc: Source: mod/disablecaptcha.js + + + + + + + + + + +
+ +

Source: mod/disablecaptcha.js

+ + + + + + +
+
+
/**
+  * @author Marzavec ( https://github.com/marzavec )
+  * @summary Disables the captcha
+  * @version 1.0.0
+  * @description Disables the captcha on the channel specified in the channel property,
+  *              default is current channel
+  * @module disablecaptcha
+  */
+
+import {
+  isModerator,
+} from '../utility/_UAC.js';
+
+/**
+  * Automatically executes once after server is ready
+  * @param {Object} core - Reference to core enviroment object
+  * @public
+  * @return {void}
+  */
+export async function init(core) {
+  if (typeof core.captchas === 'undefined') {
+    core.captchas = {};
+  }
+}
+
+/**
+  * Executes when invoked by a remote client
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {void}
+  */
+export async function run({
+  core, server, socket, payload,
+}) {
+  // increase rate limit chance and ignore if not admin or mod
+  if (!isModerator(socket.level)) {
+    return server.police.frisk(socket, 10);
+  }
+
+  let targetChannel;
+
+  if (typeof payload.channel !== 'string') {
+    if (typeof socket.channel !== 'string') { // @todo Multichannel
+      return false; // silently fail
+    }
+
+    targetChannel = socket.channel;
+  } else {
+    targetChannel = payload.channel;
+  }
+
+  if (!core.captchas[targetChannel]) {
+    return server.reply({
+      cmd: 'info',
+      text: 'Captcha is not enabled.',
+      channel: socket.channel, // @todo Multichannel
+    }, socket);
+  }
+
+  core.captchas[targetChannel] = false;
+
+  server.broadcast({
+    cmd: 'info',
+    text: `Captcha disabled on: ${targetChannel}`,
+    channel: false, // @todo Multichannel, false for global info
+  }, { channel: targetChannel, level: isModerator });
+
+  return true;
+}
+
+/**
+  * Module meta information
+  * @public
+  * @typedef {Object} disablecaptcha/info
+  * @property {string} name - Module command name
+  * @property {string} category - Module category name
+  * @property {string} description - Information about module
+  * @property {string} usage - Information about module usage
+  */
+export const info = {
+  name: 'disablecaptcha',
+  category: 'moderators',
+  description: 'Disables the captcha on the channel specified in the channel property, default is current channel',
+  usage: `
+    API: { cmd: 'disablecaptcha', channel: '<optional channel, defaults to your current channel' }`,
+};
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + diff --git a/documentation/mod_dumb.js.html b/documentation/mod_dumb.js.html index 5227833..76e943d 100644 --- a/documentation/mod_dumb.js.html +++ b/documentation/mod_dumb.js.html @@ -183,7 +183,7 @@ export function initHooks(server) { * hook incoming chat commands, shadow-prevent chat if they are muzzled * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -246,7 +246,7 @@ export function chatCheck({ * shadow-prevent all invites from muzzled users * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -318,7 +318,7 @@ export function inviteCheck({ * shadow-prevent all whispers from muzzled users * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -410,13 +410,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_enablecaptcha.js.html b/documentation/mod_enablecaptcha.js.html new file mode 100644 index 0000000..19b4f59 --- /dev/null +++ b/documentation/mod_enablecaptcha.js.html @@ -0,0 +1,330 @@ + + + + + JSDoc: Source: mod/enablecaptcha.js + + + + + + + + + + +
+ +

Source: mod/enablecaptcha.js

+ + + + + + +
+
+
/* eslint no-param-reassign: 0 */
+
+/**
+  * @author Marzavec ( https://github.com/marzavec )
+  * @summary Enables the captcha
+  * @version 1.0.0
+  * @description Enables the captcha on the channel specified in the channel property,
+  *              default is current channel
+  * @module enablecaptcha
+  */
+
+import captcha from 'ascii-captcha';
+
+import {
+  isTrustedUser,
+  isModerator,
+  verifyNickname,
+  getUserPerms,
+} from '../utility/_UAC.js';
+import {
+  canJoinChannel,
+} from '../utility/_Channels.js';
+import {
+  upgradeLegacyJoin,
+  legacyLevelToLabel,
+} from '../utility/_LegacyFunctions.js';
+import {
+  Errors,
+} from '../utility/_Constants.js';
+
+/**
+  * Automatically executes once after server is ready
+  * @param {Object} core - Reference to core enviroment object
+  * @public
+  * @return {void}
+  */
+export async function init(core) {
+  if (typeof core.captchas === 'undefined') {
+    core.captchas = {};
+  }
+}
+
+/**
+  * Executes when invoked by a remote client
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {void}
+  */
+export async function run({
+  core, server, socket, payload,
+}) {
+  // increase rate limit chance and ignore if not admin or mod
+  if (!isModerator(socket.level)) {
+    return server.police.frisk(socket, 10);
+  }
+
+  let targetChannel;
+
+  if (typeof payload.channel !== 'string') {
+    if (typeof socket.channel !== 'string') { // @todo Multichannel
+      return false; // silently fail
+    }
+
+    targetChannel = socket.channel;
+  } else {
+    targetChannel = payload.channel;
+  }
+
+  if (core.captchas[targetChannel]) {
+    return server.reply({
+      cmd: 'info',
+      text: 'Captcha is already enabled.',
+      channel: socket.channel, // @todo Multichannel
+    }, socket);
+  }
+
+  core.captchas[targetChannel] = true;
+
+  server.broadcast({
+    cmd: 'info',
+    text: `Captcha enabled on: ${targetChannel}`,
+    channel: socket.channel, // @todo Multichannel, false for global info
+  }, { channel: socket.channel, level: isModerator });
+
+  return true;
+}
+
+/**
+  * Automatically executes once after server is ready to register this modules hooks
+  * @param {Object} server - Reference to server enviroment object
+  * @public
+  * @return {void}
+  */
+export function initHooks(server) {
+  server.registerHook('in', 'chat', this.chatCheck.bind(this), 5);
+  server.registerHook('in', 'join', this.joinCheck.bind(this), 5);
+}
+
+/**
+  * Executes every time an incoming chat command is invoked;
+  * hook incoming chat commands, check if they are answering a captcha
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function chatCheck({
+  core, server, socket, payload,
+}) {
+  // always verifiy user input
+  if (typeof payload.text !== 'string') {
+    return false;
+  }
+
+  if (typeof socket.captcha !== 'undefined') {
+    if (socket.captcha.awaiting === true) {
+      if (payload.text === socket.captcha.solution) {
+        if (typeof socket.captcha.whitelist === 'undefined') {
+          socket.captcha.whitelist = [];
+        }
+
+        socket.captcha.whitelist.push(socket.captcha.origChannel);
+        socket.captcha.awaiting = false;
+
+        if (socket.hcProtocol === 1) {
+          core.commands.handleCommand(server, socket, {
+            cmd: 'join',
+            nick: `${socket.captcha.origNick}#${socket.captcha.origPass}`,
+            channel: socket.captcha.origChannel,
+          });
+        } else {
+          core.commands.handleCommand(server, socket, {
+            cmd: 'join',
+            nick: socket.captcha.origNick,
+            pass: socket.captcha.origPass,
+            channel: socket.captcha.origChannel,
+          });
+        }
+
+        return false;
+      }
+
+      server.police.frisk(socket, 7);
+      socket.terminate();
+
+      return false;
+    }
+  }
+
+  return payload;
+}
+
+/**
+  * Executes every time an incoming join command is invoked;
+  * hook incoming join commands, check if they are joining a captcha protected channel
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function joinCheck({
+  core, server, socket, payload,
+}) {
+  // check if channel has captcha enabled
+  if (core.captchas[payload.channel] !== true) {
+    return payload;
+  }
+
+  // `join` is the legacy entry point, check if it needs to be upgraded
+  const origPayload = { ...payload };
+  if (typeof socket.hcProtocol === 'undefined') {
+    payload = upgradeLegacyJoin(server, socket, payload);
+  }
+
+  // store payload values
+  const { channel, nick, pass } = payload;
+
+  // check if a client is able to join target channel
+  const mayJoin = canJoinChannel(channel, socket);
+  if (mayJoin !== true) {
+    return server.reply({
+      cmd: 'warn',
+      text: 'You may not join that channel.',
+      id: mayJoin,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+
+  // calling socket already in a channel
+  // @todo multichannel update, will remove
+  if (typeof socket.channel !== 'undefined') {
+    return server.reply({
+      cmd: 'warn', // @todo Remove this
+      text: 'Joining more than one channel is not currently supported',
+      id: Errors.Join.ALREADY_JOINED,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+  // end todo
+
+  // validates the user input for `nick`
+  if (verifyNickname(nick, socket) !== true) {
+    return server.reply({
+      cmd: 'warn',
+      text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
+      id: Errors.Join.INVALID_NICK,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+
+  // get trip and level
+  const { trip, level } = getUserPerms(pass, core.saltKey, core.appConfig.data, channel);
+
+  // store the user values
+  const userInfo = {
+    nick,
+    trip,
+    uType: legacyLevelToLabel(level),
+    hash: socket.hash,
+    level,
+    userid: socket.userid,
+    isBot: socket.isBot,
+    color: socket.color,
+    channel,
+  };
+
+  if (userInfo.uType === 'user') {
+    if (userInfo.trip == null || isTrustedUser(level) === false) {
+      if (typeof socket.captcha === 'undefined') {
+        socket.captcha = {
+          awaiting: true,
+          origChannel: payload.channel,
+          origNick: payload.nick,
+          origPass: pass,
+          solution: captcha.generateRandomText(6),
+        };
+
+        server.reply({
+          cmd: 'warn',
+          text: 'Enter the following to join (case-sensitive):',
+          channel: payload.channel, // @todo Multichannel
+        }, socket);
+
+        server.reply({
+          cmd: 'captcha',
+          text: captcha.word2Transformedstr(socket.captcha.solution),
+          channel: payload.channel, // @todo Multichannel
+        }, socket);
+
+        return false;
+      }
+
+      socket.terminate();
+
+      return false;
+    }
+  }
+
+  return origPayload;
+}
+
+/**
+  * Module meta information
+  * @public
+  * @typedef {Object} enablecaptcha/info
+  * @property {string} name - Module command name
+  * @property {string} category - Module category name
+  * @property {string} description - Information about module
+  * @property {string} usage - Information about module usage
+  */
+export const info = {
+  name: 'enablecaptcha',
+  category: 'moderators',
+  description: 'Enables a captcha in the current channel you are in',
+  usage: `
+    API: { cmd: 'enablecaptcha', channel: '<optional channel, defaults to your current channel>' }`,
+};
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + diff --git a/documentation/mod_forcecolor.js.html b/documentation/mod_forcecolor.js.html index 93c07ae..c92a4d6 100644 --- a/documentation/mod_forcecolor.js.html +++ b/documentation/mod_forcecolor.js.html @@ -146,7 +146,7 @@ export function initHooks(server) { * hooks chat commands checking for /forcecolor * @param {Object} env - Enviroment object with references to core, server, socket & payload * @public - * @return {{Object|boolean|string}} Object = same/altered payload, + * @return {(Object|boolean|string)} Object = same/altered payload, * false = suppress action, * string = error */ @@ -235,13 +235,13 @@ Text: /forcecolor <target nick> <color as hex>`,
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_kick.js.html b/documentation/mod_kick.js.html index 9ca38e9..daddd47 100644 --- a/documentation/mod_kick.js.html +++ b/documentation/mod_kick.js.html @@ -188,13 +188,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_lockroom.js.html b/documentation/mod_lockroom.js.html new file mode 100644 index 0000000..dc97d7b --- /dev/null +++ b/documentation/mod_lockroom.js.html @@ -0,0 +1,382 @@ + + + + + JSDoc: Source: mod/lockroom.js + + + + + + + + + + +
+ +

Source: mod/lockroom.js

+ + + + + + +
+
+
/* eslint no-param-reassign: 0 */
+
+/**
+  * @author Marzavec ( https://github.com/marzavec )
+  * @summary Locks the channel
+  * @version 1.0.0
+  * @description Locks a channel preventing default levels from joining
+  * @module lockroom
+  */
+
+import {
+  isTrustedUser,
+  isModerator,
+  verifyNickname,
+  getUserPerms,
+} from '../utility/_UAC.js';
+import {
+  upgradeLegacyJoin,
+  legacyLevelToLabel,
+} from '../utility/_LegacyFunctions.js';
+import {
+  Errors,
+} from '../utility/_Constants.js';
+import {
+  canJoinChannel,
+} from '../utility/_Channels.js';
+
+const danteQuotes = [
+  'Do not be afraid; our fate cannot be taken from us; it is a gift.',
+  'In the middle of the journey of our life I found myself within a dark woods where the straight way was lost.',
+  'There is no greater sorrow then to recall our times of joy in wretchedness.',
+  'They yearn for what they fear for.',
+  'Through me you go into a city of weeping; through me you go into eternal pain; through me you go amongst the lost people',
+  'From there we came outside and saw the stars',
+  'But the stars that marked our starting fall away. We must go deeper into greater pain, for it is not permitted that we stay.',
+  'Hope not ever to see Heaven. I have come to lead you to the other shore; into eternal darkness; into fire and into ice.',
+  'As little flowers, which the chill of night has bent and huddled, when the white sun strikes, grow straight and open fully on their stems, so did I, too, with my exhausted force.',
+  'At grief so deep the tongue must wag in vain; the language of our sense and memory lacks the vocabulary of such pain.',
+  'Thence we came forth to rebehold the stars.',
+  'He is, most of all, l\'amor che move il sole e l\'altre stelle.',
+  'The poets leave hell and again behold the stars.',
+  'One ought to be afraid of nothing other then things possessed of power to do us harm, but things innoucuous need not be feared.',
+  'As phantoms frighten beasts when shadows fall.',
+  'We were men once, though we\'ve become trees',
+  'Here pity only lives when it is dead',
+  'Lasciate ogne speranza, voi ch\'intrate.',
+  'There is no greater sorrow than thinking back upon a happy time in misery',
+  'My thoughts were full of other things When I wandered off the path.',
+];
+
+/**
+  * Automatically executes once after server is ready
+  * @param {Object} core - Reference to core enviroment object
+  * @public
+  * @return {void}
+  */
+export async function init(core) {
+  if (typeof core.locked === 'undefined') {
+    core.locked = {};
+  }
+}
+
+/**
+  * Executes when invoked by a remote client
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {void}
+  */
+export async function run({
+  core, server, socket, payload,
+}) {
+  // increase rate limit chance and ignore if not admin or mod
+  if (!isModerator(socket.level)) {
+    return server.police.frisk(socket, 10);
+  }
+
+  let targetChannel;
+
+  if (typeof payload.channel !== 'string') {
+    if (typeof socket.channel !== 'string') { // @todo Multichannel
+      return false; // silently fail
+    }
+
+    targetChannel = socket.channel;
+  } else {
+    targetChannel = payload.channel;
+  }
+
+  if (core.locked[targetChannel]) {
+    return server.reply({
+      cmd: 'info',
+      text: 'Channel is already locked.',
+      channel: socket.channel, // @todo Multichannel
+    }, socket);
+  }
+
+  // apply lock flag to channel list
+  core.locked[targetChannel] = true;
+
+  // inform mods
+  server.broadcast({
+    cmd: 'info',
+    text: `Channel: ?${targetChannel} lock enabled by [${socket.trip}]${socket.nick}`,
+    channel: false, // @todo Multichannel, false for global info
+  }, { level: isModerator });
+
+  return true;
+}
+
+/**
+  * Automatically executes once after server is ready to register this modules hooks
+  * @param {Object} server - Reference to server enviroment object
+  * @public
+  * @return {void}
+  */
+export function initHooks(server) {
+  server.registerHook('in', 'changenick', this.changeNickCheck.bind(this), 1);
+  server.registerHook('in', 'whisper', this.whisperCheck.bind(this), 1);
+  server.registerHook('in', 'chat', this.chatCheck.bind(this), 1);
+  server.registerHook('in', 'invite', this.inviteCheck.bind(this), 1);
+  server.registerHook('in', 'join', this.joinCheck.bind(this), 1);
+}
+
+/**
+  * Executes every time an incoming changenick command is invoked;
+  * hook incoming changenick commands, reject them if the channel is 'purgatory'
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function changeNickCheck({
+  socket, payload,
+}) {
+  if (socket.channel === 'purgatory') { // @todo Multichannel update
+    return false;
+  }
+
+  return payload;
+}
+
+/**
+  * Executes every time an incoming whisper command is invoked;
+  * hook incoming whisper commands, reject them if the channel is 'purgatory'
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function whisperCheck({
+  socket, payload,
+}) {
+  if (socket.channel === 'purgatory') { // @todo Multichannel update
+    return false;
+  }
+
+  return payload;
+}
+
+/**
+  * Executes every time an incoming chat command is invoked;
+  * hook incoming chat commands, reject them if the channel is 'purgatory'
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function chatCheck({
+  socket, payload,
+}) {
+  if (socket.channel === 'purgatory') {
+    if (isModerator(socket.level)) {
+      return payload;
+    }
+
+    return false;
+  }
+
+  return payload;
+}
+
+/**
+  * Executes every time an incoming invite command is invoked;
+  * hook incoming invite commands, reject them if the channel is 'purgatory'
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function inviteCheck({
+  socket, payload,
+}) {
+  if (socket.channel === 'purgatory') {
+    return false;
+  }
+
+  return payload;
+}
+
+/**
+  * Executes every time an incoming join command is invoked;
+  * hook incoming join commands, shunt them to purgatory if needed
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {(Object|boolean|string)} Object = same/altered payload,
+  * false = suppress action,
+  * string = error
+  */
+export function joinCheck({
+  core, server, socket, payload,
+}) {
+  // check if target channel is locked
+  if (typeof core.locked[payload.channel] === 'undefined' || core.locked[payload.channel] !== true) {
+    if (payload.channel !== 'purgatory') {
+      return payload;
+    }
+  }
+
+  // `join` is the legacy entry point, check if it needs to be upgraded
+  if (typeof socket.hcProtocol === 'undefined') {
+    payload = upgradeLegacyJoin(server, socket, payload);
+  }
+
+  // store payload values
+  const { channel, nick, pass } = payload;
+
+  // check if a client is able to join target channel
+  const mayJoin = canJoinChannel(channel, socket);
+  if (mayJoin !== true) {
+    return server.reply({
+      cmd: 'warn',
+      text: 'You may not join that channel.',
+      id: mayJoin,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+
+  // calling socket already in a channel
+  // @todo multichannel update, will remove
+  if (typeof socket.channel !== 'undefined') {
+    return server.reply({
+      cmd: 'warn', // @todo Remove this
+      text: 'Joining more than one channel is not currently supported',
+      id: Errors.Join.ALREADY_JOINED,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+  // end todo
+
+  // validates the user input for `nick`
+  if (verifyNickname(nick, socket) !== true) {
+    return server.reply({
+      cmd: 'warn',
+      text: 'Nickname must consist of up to 24 letters, numbers, and underscores',
+      id: Errors.Join.INVALID_NICK,
+      channel: false, // @todo Multichannel, false for global event
+    }, socket);
+  }
+
+  // get trip and level
+  const { trip, level } = getUserPerms(pass, core.saltKey, core.appConfig.data, channel);
+
+  // store the user values
+  const userInfo = {
+    nick,
+    trip,
+    uType: legacyLevelToLabel(level),
+    hash: socket.hash,
+    level,
+    userid: socket.userid,
+    isBot: socket.isBot,
+    color: socket.color,
+    channel,
+  };
+
+  // check if trip is allowed
+  if (userInfo.uType === 'user') {
+    if (userInfo.trip == null || isTrustedUser(level) === false) {
+      const origNick = userInfo.nick;
+      const origChannel = payload.channel;
+
+      // not allowed, shunt to purgatory
+      payload.channel = 'purgatory';
+
+      // lost souls have no names
+      if (origChannel === 'purgatory') {
+        // someone is pulling a Dante
+        payload.nick = `Dante_${Math.random().toString(36).substr(2, 8)}`;
+      } else {
+        payload.nick = `${Math.random().toString(36).substr(2, 8)}${Math.random().toString(36).substr(2, 8)}`;
+      }
+
+      setTimeout(() => {
+        server.reply({
+          cmd: 'info',
+          text: danteQuotes[Math.floor(Math.random() * danteQuotes.length)],
+          channel: 'purgatory', // @todo Multichannel
+        }, socket);
+      }, 100);
+
+      server.broadcast({
+        cmd: 'info',
+        text: `${payload.nick} is: ${origNick}\ntrip: ${userInfo.trip || 'none'}\ntried to join: ?${origChannel}\nhash: ${userInfo.hash}`,
+        channel: 'purgatory', // @todo Multichannel, false for global info
+      }, { channel: 'purgatory', level: isModerator });
+    }
+  }
+
+  return payload;
+}
+
+/**
+  * Module meta information
+  * @public
+  * @typedef {Object} kick/info
+  * @property {string} name - Module command name
+  * @property {string} category - Module category name
+  * @property {string} description - Information about module
+  * @property {string} usage - Information about module usage
+  */
+export const info = {
+  name: 'lockroom',
+  category: 'moderators',
+  description: 'Locks a channel preventing default levels from joining',
+  usage: `
+    API: { cmd: 'lockroom', channel: '<optional channel, defaults to your current channel>' }`,
+};
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + diff --git a/documentation/mod_speak.js.html b/documentation/mod_speak.js.html index 1e6fb78..1dc51d8 100644 --- a/documentation/mod_speak.js.html +++ b/documentation/mod_speak.js.html @@ -131,7 +131,7 @@ export const info = { description: 'Pardon a dumb user to be able to speak again', aliases: ['unmuzzle', 'unmute'], usage: ` - API: { cmd: 'speak', ip/hash: '<target ip or hash' }`, + API: { cmd: 'speak', ip/hash: '<target ip or hash>' }`, };
@@ -143,13 +143,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_unban.js.html b/documentation/mod_unban.js.html index 45d2427..269bd23 100644 --- a/documentation/mod_unban.js.html +++ b/documentation/mod_unban.js.html @@ -127,13 +127,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_unbanall.js.html b/documentation/mod_unbanall.js.html index d1ae5fe..76bcf94 100644 --- a/documentation/mod_unbanall.js.html +++ b/documentation/mod_unbanall.js.html @@ -100,13 +100,13 @@ export const info = {
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/mod_unlockroom.js.html b/documentation/mod_unlockroom.js.html new file mode 100644 index 0000000..f6e1894 --- /dev/null +++ b/documentation/mod_unlockroom.js.html @@ -0,0 +1,140 @@ + + + + + JSDoc: Source: mod/unlockroom.js + + + + + + + + + + +
+ +

Source: mod/unlockroom.js

+ + + + + + +
+
+
/* eslint no-console: 0 */
+
+/**
+  * @author Marzavec ( https://github.com/marzavec )
+  * @summary Unlock target channel
+  * @version 1.0.0
+  * @description Unlocks a channel allowing anyone to join
+  * @module unlockroom
+  */
+
+import {
+  isModerator,
+} from '../utility/_UAC.js';
+
+/**
+  * Automatically executes once after server is ready
+  * @param {Object} core - Reference to core enviroment object
+  * @public
+  * @return {void}
+  */
+export async function init(core) {
+  if (typeof core.locked === 'undefined') {
+    core.locked = {};
+  }
+}
+
+/**
+  * Executes when invoked by a remote client
+  * @param {Object} env - Enviroment object with references to core, server, socket & payload
+  * @public
+  * @return {void}
+  */
+export async function run({
+  core, server, socket, payload,
+}) {
+  // increase rate limit chance and ignore if not admin or mod
+  if (!isModerator(socket.level)) {
+    return server.police.frisk(socket, 10);
+  }
+
+  let targetChannel;
+
+  if (typeof payload.channel !== 'string') {
+    if (typeof socket.channel !== 'string') { // @todo Multichannel
+      return false; // silently fail
+    }
+
+    targetChannel = socket.channel;
+  } else {
+    targetChannel = payload.channel;
+  }
+
+  if (!core.locked[targetChannel]) {
+    return server.reply({
+      cmd: 'info',
+      text: 'Channel is not locked.',
+      channel: socket.channel, // @todo Multichannel
+    }, socket);
+  }
+
+  core.locked[targetChannel] = false;
+
+  server.broadcast({
+    cmd: 'info',
+    text: `Channel: ?${targetChannel} unlocked by [${socket.trip}]${socket.nick}`,
+    channel: targetChannel, // @todo Multichannel, false for global info
+  }, { channel: targetChannel, level: isModerator });
+
+  console.log(`Channel: ?${targetChannel} unlocked by [${socket.trip}]${socket.nick} in ${socket.channel}`);
+
+  return true;
+}
+
+/**
+  * Module meta information
+  * @public
+  * @typedef {Object} unlockroom/info
+  * @property {string} name - Module command name
+  * @property {string} category - Module category name
+  * @property {string} description - Information about module
+  * @property {string} usage - Information about module usage
+  */
+export const info = {
+  name: 'unlockroom',
+  category: 'moderators',
+  description: 'Unlock the current channel you are in or target channel as specified',
+  usage: `
+    API: { cmd: 'unlockroom', channel: '<optional target channel>' }`,
+};
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + diff --git a/documentation/module-addmod.html b/documentation/module-addmod.html index 3e7e7a5..510321b 100644 --- a/documentation/module-addmod.html +++ b/documentation/module-addmod.html @@ -589,13 +589,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-ban.html b/documentation/module-ban.html index 661f988..e4a3413 100644 --- a/documentation/module-ban.html +++ b/documentation/module-ban.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-changecolor.html b/documentation/module-changecolor.html index f684538..348bc0a 100644 --- a/documentation/module-changecolor.html +++ b/documentation/module-changecolor.html @@ -154,7 +154,7 @@ -

(static) colorCheck(env)

+

(static) colorCheck(env) → {Object|boolean|string}

@@ -283,8 +283,32 @@
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -887,13 +911,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-changenick.html b/documentation/module-changenick.html index d74189c..5d5e65c 100644 --- a/documentation/module-changenick.html +++ b/documentation/module-changenick.html @@ -255,7 +255,7 @@
Source:
@@ -309,7 +309,7 @@ -

(static) nickCheck(env)

+

(static) nickCheck(env) → {Object|boolean|string}

@@ -410,7 +410,7 @@
Source:
@@ -438,8 +438,32 @@
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -784,7 +808,7 @@
Source:
@@ -857,7 +881,7 @@
Source:
@@ -887,13 +911,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-chat.html b/documentation/module-chat.html index bc4fba8..f068e08 100644 --- a/documentation/module-chat.html +++ b/documentation/module-chat.html @@ -144,6 +144,299 @@ +

Members

+ + + +

(static, constant) ACTIVE_MESSAGES :Array

+ + + + +
+ Stores active messages that can be edited. +
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) MAX_MESSAGE_ID_LENGTH :number

+ + + + +
+ Maximum length of the customId property +
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner, constant) ACTIVE_TIMEOUT :number

+ + + + +
+ The time in milliseconds before a message is considered stale, and thus no longer allowed +to be edited. +
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner, constant) TIMEOUT_CHECK_INTERVAL :number

+ + + + +
+ The time in milliseconds that a check for stale messages should be performed. +
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +

Methods

@@ -154,7 +447,291 @@ -

(static) commandCheckIn(env)

+

(static) addActiveMessage(id, userid) → {void}

+ + + + + + +
+ Adds a message to the active messages map. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +string + + + +
userid + + +number + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) cleanActiveMessages() → {void}

+ + + + + + +
+ Cleans up stale messages. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) commandCheckIn(env) → {Object|boolean|string}

@@ -256,7 +833,7 @@ checks for miscellaneous '/' based commands
Source:
@@ -284,8 +861,32 @@ checks for miscellaneous '/' based commands
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -298,7 +899,7 @@ checks for miscellaneous '/' based commands -

(static) finalCmdCheck(env)

+

(static) finalCmdCheck(env) → {Object|boolean|string}

@@ -400,7 +1001,7 @@ assumes a failed chat command invocation and will reject with notice
Source:
@@ -428,8 +1029,32 @@ assumes a failed chat command invocation and will reject with notice
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -543,7 +1168,7 @@ assumes a failed chat command invocation and will reject with notice
Source:
@@ -698,7 +1323,7 @@ assumes a failed chat command invocation and will reject with notice
Source:
@@ -929,7 +1554,7 @@ assumes a failed chat command invocation and will reject with notice
Source:
@@ -1002,7 +1627,7 @@ assumes a failed chat command invocation and will reject with notice
Source:
@@ -1032,13 +1657,13 @@ assumes a failed chat command invocation and will reject with notice
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-disablecaptcha.html b/documentation/module-disablecaptcha.html new file mode 100644 index 0000000..2cabf56 --- /dev/null +++ b/documentation/module-disablecaptcha.html @@ -0,0 +1,687 @@ + + + + + JSDoc: Module: disablecaptcha + + + + + + + + + + +
+ +

Module: disablecaptcha

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +
Disables the captcha on the channel specified in the channel property, + default is current channel
+ + + + + + + + + + + + + + + + + + + +
+ + +
Version:
+
  • 1.0.0
+ + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Marzavec ( https://github.com/marzavec )
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) init(core) → {void}

+ + + + + + +
+ Automatically executes once after server is ready +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
core + + +Object + + + + Reference to core enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) run(env) → {void}

+ + + + + + +
+ Executes when invoked by a remote client +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + +

Type Definitions

+ + + +

disablecaptcha/info

+ + + + +
+ Module meta information +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + Module command name
category + + +string + + + + Module category name
description + + +string + + + + Information about module
usage + + +string + + + + Information about module usage
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + \ No newline at end of file diff --git a/documentation/module-disconnect.html b/documentation/module-disconnect.html index 47db03c..cf82807 100644 --- a/documentation/module-disconnect.html +++ b/documentation/module-disconnect.html @@ -255,7 +255,7 @@
Source:
@@ -486,7 +486,7 @@
Source:
@@ -559,7 +559,7 @@
Source:
@@ -589,13 +589,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-dumb.html b/documentation/module-dumb.html index 4c86f9f..a4e1909 100644 --- a/documentation/module-dumb.html +++ b/documentation/module-dumb.html @@ -154,7 +154,7 @@ -

(static) chatCheck(env)

+

(static) chatCheck(env) → {Object|boolean|string}

@@ -284,8 +284,32 @@ hook incoming chat commands, shadow-prevent chat if they are muzzled
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -608,7 +632,7 @@ hook incoming chat commands, shadow-prevent chat if they are muzzled -

(static) inviteCheck(env)

+

(static) inviteCheck(env) → {Object|boolean|string}

@@ -738,8 +762,32 @@ shadow-prevent all invites from muzzled users
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -907,7 +955,7 @@ shadow-prevent all invites from muzzled users -

(static) whisperCheck(env)

+

(static) whisperCheck(env) → {Object|boolean|string}

@@ -1037,8 +1085,32 @@ shadow-prevent all whispers from muzzled users
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -1171,6 +1243,29 @@ shadow-prevent all whispers from muzzled users + + + aliases + + + + + +Array + + + + + + + + + + An array of alternative cmd names + + + + usage @@ -1258,13 +1353,13 @@ shadow-prevent all whispers from muzzled users
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-emote.html b/documentation/module-emote.html index 229f5c4..b753cfc 100644 --- a/documentation/module-emote.html +++ b/documentation/module-emote.html @@ -154,7 +154,7 @@ -

(static) emoteCheck(env)

+

(static) emoteCheck(env) → {Object|boolean|string}

@@ -284,8 +284,32 @@ hooks chat commands checking for /me
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -888,13 +912,13 @@ hooks chat commands checking for /me
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-enablecaptcha.html b/documentation/module-enablecaptcha.html new file mode 100644 index 0000000..97de3d9 --- /dev/null +++ b/documentation/module-enablecaptcha.html @@ -0,0 +1,1178 @@ + + + + + JSDoc: Module: enablecaptcha + + + + + + + + + + +
+ +

Module: enablecaptcha

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +
Enables the captcha on the channel specified in the channel property, + default is current channel
+ + + + + + + + + + + + + + + + + + + +
+ + +
Version:
+
  • 1.0.0
+ + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Marzavec ( https://github.com/marzavec )
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) chatCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming chat command is invoked; +hook incoming chat commands, check if they are answering a captcha +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) init(core) → {void}

+ + + + + + +
+ Automatically executes once after server is ready +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
core + + +Object + + + + Reference to core enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) initHooks(server) → {void}

+ + + + + + +
+ Automatically executes once after server is ready to register this modules hooks +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
server + + +Object + + + + Reference to server enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) joinCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming join command is invoked; +hook incoming join commands, check if they are joining a captcha protected channel +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) run(env) → {void}

+ + + + + + +
+ Executes when invoked by a remote client +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + +

Type Definitions

+ + + +

enablecaptcha/info

+ + + + +
+ Module meta information +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + Module command name
category + + +string + + + + Module category name
description + + +string + + + + Information about module
usage + + +string + + + + Information about module usage
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + \ No newline at end of file diff --git a/documentation/module-forcecolor.html b/documentation/module-forcecolor.html index 56be862..02efa9d 100644 --- a/documentation/module-forcecolor.html +++ b/documentation/module-forcecolor.html @@ -154,7 +154,7 @@ -

(static) colorCheck(env)

+

(static) colorCheck(env) → {Object|boolean|string}

@@ -284,8 +284,32 @@ hooks chat commands checking for /forcecolor
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -888,13 +912,13 @@ hooks chat commands checking for /forcecolor
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-help.html b/documentation/module-help.html index f43fd20..8f61eef 100644 --- a/documentation/module-help.html +++ b/documentation/module-help.html @@ -154,7 +154,7 @@ -

(static) helpCheck(env)

+

(static) helpCheck(env) → {Object|boolean|string}

@@ -256,7 +256,7 @@ hooks chat commands checking for /help
Source:
@@ -284,8 +284,32 @@ hooks chat commands checking for /help
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -399,7 +423,7 @@ hooks chat commands checking for /help
Source:
@@ -785,7 +809,7 @@ hooks chat commands checking for /help
Source:
@@ -815,13 +839,13 @@ hooks chat commands checking for /help
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-invite.html b/documentation/module-invite.html index d635329..d862e7a 100644 --- a/documentation/module-invite.html +++ b/documentation/module-invite.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-join.html b/documentation/module-join.html index 6b8470b..74a9c99 100644 --- a/documentation/module-join.html +++ b/documentation/module-join.html @@ -97,7 +97,7 @@
Source:
@@ -255,7 +255,7 @@
Source:
@@ -486,7 +486,7 @@
Source:
@@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-kick.html b/documentation/module-kick.html index 1101b23..c7b82c3 100644 --- a/documentation/module-kick.html +++ b/documentation/module-kick.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-listusers.html b/documentation/module-listusers.html index e4a23c2..d5caf86 100644 --- a/documentation/module-listusers.html +++ b/documentation/module-listusers.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-lockroom.html b/documentation/module-lockroom.html new file mode 100644 index 0000000..0ff495a --- /dev/null +++ b/documentation/module-lockroom.html @@ -0,0 +1,1681 @@ + + + + + JSDoc: Module: lockroom + + + + + + + + + + +
+ +

Module: lockroom

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +
Locks a channel preventing default levels from joining
+ + + + + + + + + + + + + + + + + + + +
+ + +
Version:
+
  • 1.0.0
+ + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Marzavec ( https://github.com/marzavec )
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) changeNickCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming changenick command is invoked; +hook incoming changenick commands, reject them if the channel is 'purgatory' +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) chatCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming chat command is invoked; +hook incoming chat commands, reject them if the channel is 'purgatory' +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) init(core) → {void}

+ + + + + + +
+ Automatically executes once after server is ready +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
core + + +Object + + + + Reference to core enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) initHooks(server) → {void}

+ + + + + + +
+ Automatically executes once after server is ready to register this modules hooks +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
server + + +Object + + + + Reference to server enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) inviteCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming invite command is invoked; +hook incoming invite commands, reject them if the channel is 'purgatory' +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) joinCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming join command is invoked; +hook incoming join commands, shunt them to purgatory if needed +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + + + +

(static) run(env) → {void}

+ + + + + + +
+ Executes when invoked by a remote client +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) whisperCheck(env) → {Object|boolean|string}

+ + + + + + +
+ Executes every time an incoming whisper command is invoked; +hook incoming whisper commands, reject them if the channel is 'purgatory' +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + +
+ Object = same/altered payload, +false = suppress action, +string = error +
+ + + +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ + + + + + + + + + + +

Type Definitions

+ + + +

kick/info

+ + + + +
+ Module meta information +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + Module command name
category + + +string + + + + Module category name
description + + +string + + + + Information about module
usage + + +string + + + + Information about module usage
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + \ No newline at end of file diff --git a/documentation/module-morestats.html b/documentation/module-morestats.html index a26cabd..192146b 100644 --- a/documentation/module-morestats.html +++ b/documentation/module-morestats.html @@ -464,7 +464,7 @@ -

(static) statsCheck(env)

+

(static) statsCheck(env) → {Object|boolean|string}

@@ -594,8 +594,32 @@ hooks chat commands checking for /stats
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -815,13 +839,13 @@ hooks chat commands checking for /stats
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-ping.html b/documentation/module-ping.html index eb93b1a..535a230 100644 --- a/documentation/module-ping.html +++ b/documentation/module-ping.html @@ -467,13 +467,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-reload.html b/documentation/module-reload.html index 7ebbebb..56fa67b 100644 --- a/documentation/module-reload.html +++ b/documentation/module-reload.html @@ -486,7 +486,7 @@
Source:
@@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-removemod.html b/documentation/module-removemod.html index 3611d20..1fd4f85 100644 --- a/documentation/module-removemod.html +++ b/documentation/module-removemod.html @@ -486,7 +486,7 @@
Source:
@@ -559,7 +559,7 @@
Source:
@@ -589,13 +589,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-saveconfig.html b/documentation/module-saveconfig.html index 00bfd34..eda4496 100644 --- a/documentation/module-saveconfig.html +++ b/documentation/module-saveconfig.html @@ -486,7 +486,7 @@
Source:
@@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-session.html b/documentation/module-session.html index 1ebaa0b..be1c462 100644 --- a/documentation/module-session.html +++ b/documentation/module-session.html @@ -161,6 +161,10 @@ +
+ Get a new json web token for the provided socket +
+ @@ -274,7 +278,7 @@
Source:
@@ -429,7 +433,7 @@
Source:
@@ -584,7 +588,7 @@
Source:
@@ -645,6 +649,10 @@ +
+ Reply to target socket with session failure notice +
+ @@ -758,7 +766,7 @@
Source:
@@ -989,7 +997,7 @@
Source:
@@ -1019,13 +1027,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-shout.html b/documentation/module-shout.html index 4cdbbfb..61ad2a9 100644 --- a/documentation/module-shout.html +++ b/documentation/module-shout.html @@ -589,13 +589,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-socketreply.html b/documentation/module-socketreply.html index 9cb906a..55fc9f4 100644 --- a/documentation/module-socketreply.html +++ b/documentation/module-socketreply.html @@ -590,13 +590,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-speak.html b/documentation/module-speak.html index 1db6710..833b986 100644 --- a/documentation/module-speak.html +++ b/documentation/module-speak.html @@ -584,6 +584,29 @@ + + + aliases + + + + + +Array + + + + + + + + + + An array of alternative cmd names + + + + usage @@ -671,13 +694,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-stats.html b/documentation/module-stats.html index 3a11bab..209eded 100644 --- a/documentation/module-stats.html +++ b/documentation/module-stats.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-unban.html b/documentation/module-unban.html index e455524..ce37d42 100644 --- a/documentation/module-unban.html +++ b/documentation/module-unban.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-unbanall.html b/documentation/module-unbanall.html index 408a449..fface1a 100644 --- a/documentation/module-unbanall.html +++ b/documentation/module-unbanall.html @@ -516,13 +516,13 @@
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/module-unlockroom.html b/documentation/module-unlockroom.html new file mode 100644 index 0000000..508ba70 --- /dev/null +++ b/documentation/module-unlockroom.html @@ -0,0 +1,686 @@ + + + + + JSDoc: Module: unlockroom + + + + + + + + + + +
+ +

Module: unlockroom

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +
Unlocks a channel allowing anyone to join
+ + + + + + + + + + + + + + + + + + + +
+ + +
Version:
+
  • 1.0.0
+ + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Marzavec ( https://github.com/marzavec )
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) init(core) → {void}

+ + + + + + +
+ Automatically executes once after server is ready +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
core + + +Object + + + + Reference to core enviroment object
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + + + +

(static) run(env) → {void}

+ + + + + + +
+ Executes when invoked by a remote client +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + +

Type Definitions

+ + + +

unlockroom/info

+ + + + +
+ Module meta information +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + Module command name
category + + +string + + + + Module category name
description + + +string + + + + Information about module
usage + + +string + + + + Information about module usage
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + \ No newline at end of file diff --git a/documentation/module-updateMessage.html b/documentation/module-updateMessage.html new file mode 100644 index 0000000..6d87c8e --- /dev/null +++ b/documentation/module-updateMessage.html @@ -0,0 +1,604 @@ + + + + + JSDoc: Module: updateMessage + + + + + + + + + + +
+ +

Module: updateMessage

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +
Will alter a previously sent message using that message's customId
+ + + + + + + + + + + + + + + + + + + +
+ + +
Version:
+
  • v1.0.0
+ + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • MinusGix ( https://github.com/MinusGix )
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +

Methods

+ + + + + + + +

(static) run(env) → {void}

+ + + + + + +
+ Executes when invoked by a remote client +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
env + + +Object + + + + Enviroment object with references to core, server, socket & payload
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +void + + +
+
+ + + + + + + + + + + +

Type Definitions

+ + + +

addmod/requiredData

+ + + + +
+ The following payload properties are required to invoke this module: +"text", "customId" +
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

updateMessage/info

+ + + + +
+ Module meta information +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + Module command name
category + + +string + + + + Module category name
description + + +string + + + + Information about module
usage + + +string + + + + Information about module usage
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time) +
+ + + + + \ No newline at end of file diff --git a/documentation/module-whisper.html b/documentation/module-whisper.html index dfaa035..3da3aa1 100644 --- a/documentation/module-whisper.html +++ b/documentation/module-whisper.html @@ -472,7 +472,7 @@ -

(static) whisperCheck(env)

+

(static) whisperCheck(env) → {Object|boolean|string}

@@ -602,8 +602,32 @@ hooks chat commands checking for /whisper
Returns:
+
+ Object = same/altered payload, +false = suppress action, +string = error +
+ +
+
+ Type +
+
+ +Object +| + +boolean +| + +string + + +
+
+ @@ -896,13 +920,13 @@ hooks chat commands checking for /whisper
- Documentation generated by JSDoc 3.6.10 on Thu May 05 2022 00:29:35 GMT-0700 (Pacific Daylight Time) + Documentation generated by JSDoc 3.6.10 on Fri Dec 29 2023 23:22:35 GMT-0800 (Pacific Standard Time)
diff --git a/documentation/scripts/linenumber.js b/documentation/scripts/linenumber.js index f355ce2..4354785 100644 --- a/documentation/scripts/linenumber.js +++ b/documentation/scripts/linenumber.js @@ -1,25 +1,25 @@ -/* global document */ +/*global document */ (() => { - const source = document.getElementsByClassName('prettyprint source linenums'); - let i = 0; - let lineNumber = 0; - let lineId; - let lines; - let totalLines; - let anchorHash; + const source = document.getElementsByClassName('prettyprint source linenums'); + let i = 0; + let lineNumber = 0; + let lineId; + let lines; + let totalLines; + let anchorHash; - if (source && source[0]) { - anchorHash = document.location.hash.substring(1); - lines = source[0].getElementsByTagName('li'); - totalLines = lines.length; + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; - for (; i < totalLines; i++) { - lineNumber++; - lineId = `line${lineNumber}`; - lines[i].id = lineId; - if (lineId === anchorHash) { - lines[i].className += ' selected'; - } + for (; i < totalLines; i++) { + lineNumber++; + lineId = `line${lineNumber}`; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } } - } })(); diff --git a/documentation/scripts/prettify/lang-css.js b/documentation/scripts/prettify/lang-css.js index b258dc8..041e1f5 100644 --- a/documentation/scripts/prettify/lang-css.js +++ b/documentation/scripts/prettify/lang-css.js @@ -1,2 +1,2 @@ -PR.registerLangHandler(PR.createSimpleLexer([['pln', /^[\t\n\f\r ]+/, null, ' \t\r\n ']], [['str', /^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/, null], ['str', /^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/, null], ['lang-css-str', /^url\(([^"')]*)\)/i], ['kwd', /^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i, null], ['lang-css-kw', /^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i], ['com', /^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//], ['com', - /^(?:<\!--|--\>)/], ['lit', /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i], ['lit', /^#[\da-f]{3,6}/i], ['pln', /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i], ['pun', /^[^\s\w"']+/]]), ['css']); PR.registerLangHandler(PR.createSimpleLexer([], [['kwd', /^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]), ['css-kw']); PR.registerLangHandler(PR.createSimpleLexer([], [['str', /^[^"')]+/]]), ['css-str']); +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/documentation/scripts/prettify/prettify.js b/documentation/scripts/prettify/prettify.js index bf2f003..eef5ad7 100644 --- a/documentation/scripts/prettify/prettify.js +++ b/documentation/scripts/prettify/prettify.js @@ -1,125 +1,28 @@ -const q = null; window.PR_SHOULD_USE_CONTINUATION = !0; -(function () { - function L(a) { - function m(a) { let f = a.charCodeAt(0); if (f !== 92) return f; const b = a.charAt(1); return (f = r[b]) ? f : b >= '0' && b <= '7' ? parseInt(a.substring(1), 8) : b === 'u' || b === 'x' ? parseInt(a.substring(2), 16) : a.charCodeAt(1); } function e(a) { if (a < 32) return (a < 16 ? '\\x0' : '\\x') + a.toString(16); a = String.fromCharCode(a); if (a === '\\' || a === '-' || a === '[' || a === ']')a = `\\${a}`; return a; } function h(a) { - for (var f = a.substring(1, a.length - 1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g), a = [], b = [], o = f[0] === '^', c = o ? 1 : 0, i = f.length; c < i; ++c) { var j = f[c]; if (/\\[bdsw]/i.test(j))a.push(j); else { var j = m(j); var d; c + 2 < i && f[c + 1] === '-' ? (d = m(f[c + 2]), c += 2) : d = j; b.push([j, d]); d < 65 || j > 122 || (d < 65 || j > 90 || b.push([Math.max(65, j) | 32, Math.min(d, 90) | 32]), d < 97 || j > 122 || b.push([Math.max(97, j) & -33, Math.min(d, 122) & -33])); } }b.sort((a, f) => a[0] - f[0] || f[1] - a[1]); f = []; j = [NaN, NaN]; for (c = 0; c < b.length; ++c)i = b[c], i[0] <= j[1] + 1 ? j[1] = Math.max(j[1], i[1]) : f.push(j = i); b = ['[']; o && b.push('^'); b.push.apply(b, a); for (c = 0; c -< f.length; ++c)i = f[c], b.push(e(i[0])), i[1] > i[0] && (i[1] + 1 > i[0] && b.push('-'), b.push(e(i[1]))); b.push(']'); return b.join(''); - } function y(a) { - for (var f = a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g), b = f.length, d = [], c = 0, i = 0; c < b; ++c) { var j = f[c]; j === '(' ? ++i : j.charAt(0) === '\\' && (j = +j.substring(1)) && j <= i && (d[j] = -1); } for (c = 1; c < d.length; ++c)d[c] === -1 && (d[c] = ++t); for (i = c = 0; c < b; ++c) { - j = f[c], j === '(' ? (++i, d[i] === void 0 && (f[c] = '(?:')) : j.charAt(0) === '\\' -&& (j = +j.substring(1)) && j <= i && (f[c] = `\\${d[i]}`); - } for (i = c = 0; c < b; ++c)f[c] === '^' && f[c + 1] !== '^' && (f[c] = ''); if (a.ignoreCase && s) for (c = 0; c < b; ++c)j = f[c], a = j.charAt(0), j.length >= 2 && a === '[' ? f[c] = h(j) : a !== '\\' && (f[c] = j.replace(/[A-Za-z]/g, (a) => { a = a.charCodeAt(0); return `[${String.fromCharCode(a & -33, a | 32)}]`; })); return f.join(''); - } for (var t = 0, s = !1, l = !1, p = 0, d = a.length; p < d; ++p) { var g = a[p]; if (g.ignoreCase)l = !0; else if (/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi, ''))) { s = !0; l = !1; break; } } for (var r = { - b: 8, t: 9, n: 10, v: 11, f: 12, r: 13, - }, n = [], p = 0, d = a.length; p < d; ++p) { g = a[p]; if (g.global || g.multiline) throw Error(`${g}`); n.push(`(?:${y(g)})`); } return RegExp(n.join('|'), l ? 'gi' : 'g'); - } function M(a) { - function m(a) { - switch (a.nodeType) { - case 1: if (e.test(a.className)) break; for (var g = a.firstChild; g; g = g.nextSibling)m(g); g = a.nodeName; if (g === 'BR' || g === 'LI')h[s] = '\n', t[s << 1] = y++, t[s++ << 1 | 1] = a; break; case 3: case 4: g = a.nodeValue, g.length && (g = p ? g.replace(/\r\n?/g, '\n') : g.replace(/[\t\n\r ]+/g, ' '), h[s] = g, t[s << 1] = y, y += g.length, - t[s++ << 1 | 1] = a); - } - } var e = /(?:^|\s)nocode(?:\s|$)/; var h = []; var y = 0; var t = []; var s = 0; let l; a.currentStyle ? l = a.currentStyle.whiteSpace : window.getComputedStyle && (l = document.defaultView.getComputedStyle(a, q).getPropertyValue('white-space')); var p = l && l.substring(0, 3) === 'pre'; m(a); return { a: h.join('').replace(/\n$/, ''), c: t }; - } function B(a, m, e, h) { m && (a = { a: m, d: a }, e(a), h.push.apply(h, a.e)); } function x(a, m) { - function e(a) { - for (var l = a.d, p = [l, 'pln'], d = 0, g = a.a.match(y) || [], r = {}, n = 0, z = g.length; n < z; ++n) { - const f = g[n]; let b = r[f]; let o = void 0; var c; if (typeof b -=== 'string')c = !1; else { var i = h[f.charAt(0)]; if (i)o = f.match(i[1]), b = i[0]; else { for (c = 0; c < t; ++c) if (i = m[c], o = f.match(i[1])) { b = i[0]; break; }o || (b = 'pln'); } if ((c = b.length >= 5 && b.substring(0, 5) === 'lang-') && !(o && typeof o[1] === 'string'))c = !1, b = 'src'; c || (r[f] = b); }i = d; d += f.length; if (c) { c = o[1]; let j = f.indexOf(c); let k = j + c.length; o[2] && (k = f.length - o[2].length, j = k - c.length); b = b.substring(5); B(l + i, f.substring(0, j), e, p); B(l + i + j, c, C(b, c), p); B(l + i + k, f.substring(k), e, p); } else p.push(l + i, b); - }a.e = p; - } var h = {}; let y; (function () { - for (var e = a.concat(m), - l = [], p = {}, d = 0, g = e.length; d < g; ++d) { let r = e[d]; let n = r[3]; if (n) for (let k = n.length; --k >= 0;)h[n.charAt(k)] = r; r = r[1]; n = `${r}`; p.hasOwnProperty(n) || (l.push(r), p[n] = q); }l.push(/[\S\s]/); y = L(l); - }()); var t = m.length; return e; - } function u(a) { - const m = []; const e = []; a.tripleQuotedStrings ? m.push(['str', /^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/, q, "'\""]) : a.multiLineStrings ? m.push(['str', /^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, - q, "'\"`"]) : m.push(['str', /^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/, q, "\"'"]); a.verbatimStrings && e.push(['str', /^@"(?:[^"]|"")*(?:"|$)/, q]); let h = a.hashComments; h && (a.cStyleComments ? (h > 1 ? m.push(['com', /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, q, '#']) : m.push(['com', /^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/, q, '#']), e.push(['str', /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/, q])) : m.push(['com', /^#[^\n\r]*/, - q, '#'])); a.cStyleComments && (e.push(['com', /^\/\/[^\n\r]*/, q]), e.push(['com', /^\/\*[\S\s]*?(?:\*\/|$)/, q])); a.regexLiterals && e.push(['lang-regex', /^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]); (h = a.types) && e.push(['typ', h]); a = (`${a.keywords}`).replace( - /^ | $/g, - '', - ); a.length && e.push(['kwd', RegExp(`^(?:${a.replace(/[\s,]+/g, '|')})\\b`), q]); m.push(['pln', /^\s+/, q, ' \r\n\t\xa0']); e.push(['lit', /^@[$_a-z][\w$@]*/i, q], ['typ', /^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/, q], ['pln', /^[$_a-z][\w$@]*/i, q], ['lit', /^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i, q, '0123456789'], ['pln', /^\\[\S\s]?/, q], ['pun', /^.[^\s\w"-$'./@\\`]*/, q]); return x(m, e); - } function D(a, m) { - function e(a) { - switch (a.nodeType) { - case 1: if (k.test(a.className)) break; if (a.nodeName === 'BR') { - h(a), - a.parentNode && a.parentNode.removeChild(a); - } else for (a = a.firstChild; a; a = a.nextSibling)e(a); break; case 3: case 4: if (p) { let b = a.nodeValue; const d = b.match(t); if (d) { const c = b.substring(0, d.index); a.nodeValue = c; (b = b.substring(d.index + d[0].length)) && a.parentNode.insertBefore(s.createTextNode(b), a.nextSibling); h(a); c || a.parentNode.removeChild(a); } } - } - } function h(a) { - function b(a, d) { const e = d ? a.cloneNode(!1) : a; var f = a.parentNode; if (f) { var f = b(f, 1); let g = a.nextSibling; f.appendChild(e); for (let h = g; h; h = g)g = h.nextSibling, f.appendChild(h); } return e; } - for (;!a.nextSibling;) if (a = a.parentNode, !a) return; for (var a = b(a.nextSibling, 0), e; (e = a.parentNode) && e.nodeType === 1;)a = e; d.push(a); - } var k = /(?:^|\s)nocode(?:\s|$)/; var t = /\r\n?|\n/; var s = a.ownerDocument; let l; a.currentStyle ? l = a.currentStyle.whiteSpace : window.getComputedStyle && (l = s.defaultView.getComputedStyle(a, q).getPropertyValue('white-space')); var p = l && l.substring(0, 3) === 'pre'; for (l = s.createElement('LI'); a.firstChild;)l.appendChild(a.firstChild); for (var d = [l], g = 0; g < d.length; ++g)e(d[g]); m === (m | 0) && d[0].setAttribute( - 'value', - m, - ); const r = s.createElement('OL'); r.className = 'linenums'; for (var n = Math.max(0, m - 1 | 0) || 0, g = 0, z = d.length; g < z; ++g)l = d[g], l.className = `L${(g + n) % 10}`, l.firstChild || l.appendChild(s.createTextNode('\xa0')), r.appendChild(l); a.appendChild(r); - } function k(a, m) { for (let e = m.length; --e >= 0;) { const h = m[e]; A.hasOwnProperty(h) ? window.console && console.warn('cannot override language handler %s', h) : A[h] = a; } } function C(a, m) { if (!a || !A.hasOwnProperty(a))a = /^\s*= o && (h += 2); e >= c && (a += 2); - } - } catch (w) { 'console' in window && console.log(w && w.stack ? w.stack : w); } - } var v = ['break,continue,do,else,for,if,return,while']; var w = [[v, 'auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile'], - 'catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof']; const F = [w, 'alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where']; const G = [w, 'abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient']; - const H = [G, 'as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var']; var w = [w, 'debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN']; const I = [v, 'and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None']; - const J = [v, 'alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END']; var v = [v, 'case,done,elif,esac,eval,fi,function,in,local,set,then,until']; const K = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/; const N = /\S/; const O = u({ - keywords: [F, H, w, `caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END${ - I}`, J, v], - hashComments: !0, - cStyleComments: !0, - multiLineStrings: !0, - regexLiterals: !0, - }); var A = {}; k(O, ['default-code']); k( - x([], [['pln', /^[^]*(?:>|$)/], ['com', /^<\!--[\S\s]*?(?:--\>|$)/], ['lang-', /^<\?([\S\s]+?)(?:\?>|$)/], ['lang-', /^<%([\S\s]+?)(?:%>|$)/], ['pun', /^(?:<[%?]|[%?]>)/], ['lang-', /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i], ['lang-js', /^]*>([\S\s]*?)(<\/script\b[^>]*>)/i], ['lang-css', /^]*>([\S\s]*?)(<\/style\b[^>]*>)/i], ['lang-in.tag', /^(<\/?[a-z][^<>]*>)/i]]), - ['default-markup', 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl'], - ); k(x([['pln', /^\s+/, q, ' \t\r\n'], ['atv', /^(?:"[^"]*"?|'[^']*'?)/, q, "\"'"]], [['tag', /^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i], ['atn', /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i], ['lang-uq.val', /^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/], ['pun', /^[/<->]+/], ['lang-js', /^on\w+\s*=\s*"([^"]+)"/i], ['lang-js', /^on\w+\s*=\s*'([^']+)'/i], ['lang-js', /^on\w+\s*=\s*([^\s"'>]+)/i], ['lang-css', /^style\s*=\s*"([^"]+)"/i], ['lang-css', /^style\s*=\s*'([^']+)'/i], ['lang-css', - /^style\s*=\s*([^\s"'>]+)/i]]), ['in.tag']); k(x([], [['atv', /^[\S\s]+/]]), ['uq.val']); k(u({ - keywords: F, hashComments: !0, cStyleComments: !0, types: K, - }), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']); k(u({ keywords: 'null,true,false' }), ['json']); k(u({ - keywords: H, hashComments: !0, cStyleComments: !0, verbatimStrings: !0, types: K, - }), ['cs']); k(u({ keywords: G, cStyleComments: !0 }), ['java']); k(u({ keywords: v, hashComments: !0, multiLineStrings: !0 }), ['bsh', 'csh', 'sh']); k( - u({ - keywords: I, hashComments: !0, multiLineStrings: !0, tripleQuotedStrings: !0, - }), - ['cv', 'py'], - ); k(u({ - keywords: 'caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END', hashComments: !0, multiLineStrings: !0, regexLiterals: !0, - }), ['perl', 'pl', 'pm']); k(u({ - keywords: J, hashComments: !0, multiLineStrings: !0, regexLiterals: !0, - }), ['rb']); k(u({ keywords: w, cStyleComments: !0, regexLiterals: !0 }), ['js']); k(u({ - keywords: 'all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes', - hashComments: 3, - cStyleComments: !0, - multilineStrings: !0, - tripleQuotedStrings: !0, - regexLiterals: !0, - }), ['coffee']); k(x([], [['str', /^[\S\s]+/]]), ['regex']); window.prettyPrintOne = function (a, m, e) { const h = document.createElement('PRE'); h.innerHTML = a; e && D(h, e); E({ g: m, i: e, h }); return h.innerHTML; }; window.prettyPrint = function (a) { - function m() { - for (let e = window.PR_SHOULD_USE_CONTINUATION ? l.now() + 250 : Infinity; p < h.length && l.now() < e; p++) { - const n = h[p]; var k = n.className; if (k.indexOf('prettyprint') >= 0) { - var k = k.match(g); var f; var b; if (b = !k) { b = n; for (var o = void 0, c = b.firstChild; c; c = c.nextSibling) var i = c.nodeType, o = i === 1 ? o ? b : c : i === 3 ? N.test(c.nodeValue) ? b : o : o; b = (f = o === b ? void 0 : o) && f.tagName === 'CODE'; }b && (k = f.className.match(g)); k && (k = k[1]); b = !1; for (o = n.parentNode; o; o = o.parentNode) if ((o.tagName === 'pre' || o.tagName === 'code' || o.tagName === 'xmp') && o.className && o.className.indexOf('prettyprint') >= 0) { b = !0; break; }b || ((b = (b = n.className.match(/\blinenums\b(?::(\d+))?/)) ? b[1] && b[1].length ? +b[1] : !0 : !1) && D(n, b), d = { g: k, h: n, i: b }, E(d)); - } - }p < h.length ? setTimeout( - m, - 250, - ) : a && a(); - } for (var e = [document.getElementsByTagName('pre'), document.getElementsByTagName('code'), document.getElementsByTagName('xmp')], h = [], k = 0; k < e.length; ++k) for (let t = 0, s = e[k].length; t < s; ++t)h.push(e[k][t]); var e = q; var l = Date; l.now || (l = { now() { return +new Date(); } }); var p = 0; let d; var g = /\blang(?:uage)?-([\w.]+)(?!\S)/; m(); - }; window.PR = { - createSimpleLexer: x, - registerLangHandler: k, - sourceDecorator: u, - PR_ATTRIB_NAME: 'atn', - PR_ATTRIB_VALUE: 'atv', - PR_COMMENT: 'com', - PR_DECLARATION: 'dec', - PR_KEYWORD: 'kwd', - PR_LITERAL: 'lit', - PR_NOCODE: 'nocode', - PR_PLAIN: 'pln', - PR_PUNCTUATION: 'pun', - PR_SOURCE: 'src', - PR_STRING: 'str', - PR_TAG: 'tag', - PR_TYPE: 'typ', - }; -}()); +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p