canopy/www/doc/server/global.html

7386 lines
83 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2></h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="cache"><span class="type-signature"></span>cache<span class="type-signature"></span></h4>
<div class="description">
Basic RAM-Based cache of links, so we don't have to re-pull things after we get them
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_linkUtils.js.html">utils/linkUtils.js</a>, <a href="utils_linkUtils.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
<h4 class="name" id="channelBanSchema"><span class="type-signature">(constant) </span>channelBanSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Documents representing a user ban from a single channel
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_channelBanSchema.js.html">schemas/channel/channelBanSchema.js</a>, <a href="schemas_channel_channelBanSchema.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="channelPermissionSchema"><span class="type-signature">(constant) </span>channelPermissionSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Sub-Document representing permission structure for a single channel
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_channelPermissionSchema.js.html">schemas/channel/channelPermissionSchema.js</a>, <a href="schemas_channel_channelPermissionSchema.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h4 class="name" id="channelSchema"><span class="type-signature">(constant) </span>channelSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Documents containing de-hydrated representations of Canopy Stream/Chat Channels
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_channelSchema.js.html">schemas/channel/channelSchema.js</a>, <a href="schemas_channel_channelSchema.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
<h4 class="name" id="chatSchema"><span class="type-signature">(constant) </span>chatSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents representing a single chat message
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_chatSchema.js.html">schemas/channel/chatSchema.js</a>, <a href="schemas_channel_chatSchema.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="daysToExpire"><span class="type-signature">(constant) </span>daysToExpire<span class="type-signature"></span></h4>
<div class="description">
Email change token retention time
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_emailChangeSchema.js.html">schemas/user/emailChangeSchema.js</a>, <a href="schemas_user_emailChangeSchema.js.html#line36">line 36</a>
</li></ul></dd>
</dl>
<h4 class="name" id="daysToExpire"><span class="type-signature">(constant) </span>daysToExpire<span class="type-signature"></span></h4>
<div class="description">
Password reset token retention time
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_passwordResetSchema.js.html">schemas/user/passwordResetSchema.js</a>, <a href="schemas_user_passwordResetSchema.js.html#line36">line 36</a>
</li></ul></dd>
</dl>
<h4 class="name" id="emailChangeSchema"><span class="type-signature">(constant) </span>emailChangeSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Document representing a single email change request
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_emailChangeSchema.js.html">schemas/user/emailChangeSchema.js</a>, <a href="schemas_user_emailChangeSchema.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
<h4 class="name" id="emoteSchema"><span class="type-signature">(constant) </span>emoteSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents represnting site-wide emotes
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_emoteSchema.js.html">schemas/emoteSchema.js</a>, <a href="schemas_emoteSchema.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="failedAttempts"><span class="type-signature">(constant) </span>failedAttempts<span class="type-signature"></span></h4>
<div class="description">
Create failed sign-in cache since it's easier and more preformant to implement it this way than adding extra burdon to the database
Server restarts are far and few between. It would take multiple during a single bruteforce attempt for this to become an issue.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="flairSchema"><span class="type-signature">(constant) </span>flairSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents representing chat flair
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_flairSchema.js.html">schemas/flairSchema.js</a>, <a href="schemas_flairSchema.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="lifetime"><span class="type-signature">(constant) </span>lifetime<span class="type-signature"></span></h4>
<div class="description">
Captcha lifetime in minutes
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_altchaUtils.js.html">utils/altchaUtils.js</a>, <a href="utils_altchaUtils.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h4 class="name" id="maxAttempts"><span class="type-signature">(constant) </span>maxAttempts<span class="type-signature"></span></h4>
<div class="description">
How many attempts to lock user account out for the day
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line38">line 38</a>
</li></ul></dd>
</dl>
<h4 class="name" id="mediaSchema"><span class="type-signature">(constant) </span>mediaSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema representing a single piece of media
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_media_mediaSchema.js.html">schemas/channel/media/mediaSchema.js</a>, <a href="schemas_channel_media_mediaSchema.js.html#line23">line 23</a>
</li></ul></dd>
</dl>
<h4 class="name" id="passwordResetSchema"><span class="type-signature">(constant) </span>passwordResetSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents containing a single expiring password reset token
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_passwordResetSchema.js.html">schemas/user/passwordResetSchema.js</a>, <a href="schemas_user_passwordResetSchema.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
<h4 class="name" id="permissionSchema"><span class="type-signature">(constant) </span>permissionSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for the singular site-wide permission document
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_permissionSchema.js.html">schemas/permissionSchema.js</a>, <a href="schemas_permissionSchema.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="playlistMediaProperties"><span class="type-signature">(constant) </span>playlistMediaProperties<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents represnting a piece of media held in a playlist
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_media_playlistMediaSchema.js.html">schemas/channel/media/playlistMediaSchema.js</a>, <a href="schemas_channel_media_playlistMediaSchema.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="playlistSchema"><span class="type-signature">(constant) </span>playlistSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Documents representing playlists full of media
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_media_playlistSchema.js.html">schemas/channel/media/playlistSchema.js</a>, <a href="schemas_channel_media_playlistSchema.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h4 class="name" id="queuedProperties"><span class="type-signature">(constant) </span>queuedProperties<span class="type-signature"></span></h4>
<div class="description">
DB Schema for documents representing a queued media object
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_media_queuedMediaSchema.js.html">schemas/channel/media/queuedMediaSchema.js</a>, <a href="schemas_channel_media_queuedMediaSchema.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="rankEnum"><span class="type-signature">(constant) </span>rankEnum<span class="type-signature"></span></h4>
<div class="description">
Rank Enum, lists all known permission ranks from lowest to highest.
This originally belonged to the permissionSchema, but this avoids circular dependencies.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_channel_channelPermissionSchema.js.html">schemas/channel/channelPermissionSchema.js</a>, <a href="schemas_channel_channelPermissionSchema.js.html#line25">line 25</a>
</li></ul></dd>
</dl>
<h4 class="name" id="spent"><span class="type-signature">(constant) </span>spent<span class="type-signature"></span></h4>
<div class="description">
Create empty array to hold cache of spent payloads to protect against replay attacks
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_altchaUtils.js.html">utils/altchaUtils.js</a>, <a href="utils_altchaUtils.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h4 class="name" id="statSchema"><span class="type-signature">(constant) </span>statSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for single document for keeping track of server stats
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_statSchema.js.html">schemas/statSchema.js</a>, <a href="schemas_statSchema.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h4 class="name" id="throttleAttempts"><span class="type-signature">(constant) </span>throttleAttempts<span class="type-signature"></span></h4>
<div class="description">
How many failed attempts required to throttle with altcha
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line33">line 33</a>
</li></ul></dd>
</dl>
<h4 class="name" id="tokeCommandSchema"><span class="type-signature">(constant) </span>tokeCommandSchema<span class="type-signature"></span></h4>
<div class="description">
Mongoose Schema representing a toke command
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_tokebot_tokeCommandSchema.js.html">schemas/tokebot/tokeCommandSchema.js</a>, <a href="schemas_tokebot_tokeCommandSchema.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="transporter"><span class="type-signature">(constant) </span>transporter<span class="type-signature"></span></h4>
<div class="description">
nodemailer transport object, generated from options specific in our config file
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_mailUtils.js.html">utils/mailUtils.js</a>, <a href="utils_mailUtils.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="typeEnum"><span class="type-signature">(constant) </span>typeEnum<span class="type-signature"></span></h4>
<div class="description">
"Enum" for emote type property
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_emoteSchema.js.html">schemas/emoteSchema.js</a>, <a href="schemas_emoteSchema.js.html#line27">line 27</a>
</li></ul></dd>
</dl>
<h4 class="name" id="userBanSchema"><span class="type-signature">(constant) </span>userBanSchema<span class="type-signature"></span></h4>
<div class="description">
DB Schema for Documents representing a single user's ban
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_userBanSchema.js.html">schemas/user/userBanSchema.js</a>, <a href="schemas_user_userBanSchema.js.html#line28">line 28</a>
</li></ul></dd>
</dl>
<h4 class="name" id="userSchema"><span class="type-signature">(constant) </span>userSchema<span class="type-signature"></span></h4>
<div class="description">
Mongoose Schema for a document representing a single canopy user
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="schemas_user_userSchema.js.html">schemas/user/userSchema.js</a>, <a href="schemas_user_userSchema.js.html#line39">line 39</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="authenticateSession"><span class="type-signature"></span>authenticateSession<span class="signature">(user, pass, req)</span><span class="type-signature"></span></h4>
<div class="description">
Sole and Singular Session Authentication method.
All logins should happen through here, all other site-wide authentication should happen by sessions authenticated by this model.
This is important, as reducing authentication endpoints reduces attack surface.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Username to login as</td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Password to authenticat session with</td>
</tr>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">express.Request</span>
</td>
<td class="description last">Express request object w/ session to authenticate</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Username of authticated user upon success
</div>
<h4 class="name" id="comparePassword"><span class="type-signature"></span>comparePassword<span class="signature">(pass, hash)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Sitewide password for authenticating/comparing passwords agianst hashes
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Plaintext Password</td>
</tr>
<tr>
<td class="name"><code>hash</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Salty Hash</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_hashUtils.js.html">utils/hashUtils.js</a>, <a href="utils_hashUtils.js.html#line42">line 42</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if authentication success
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="consoleWarn"><span class="type-signature"></span>consoleWarn<span class="signature">(string)</span><span class="type-signature"></span></h4>
<div class="description">
Prints warning text to server console
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>string</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">String to print to console</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line145">line 145</a>
</li></ul></dd>
</dl>
<h4 class="name" id="errorHandler"><span class="type-signature"></span>errorHandler<span class="signature">(res, msg, type, status)</span><span class="type-signature"> &rarr; {Express.Response}</span></h4>
<div class="description">
Main error handling function
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last">Response being sent out to the client who caused the issue</td>
</tr>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error message to send the client</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error type to send back to the client</td>
</tr>
<tr>
<td class="name"><code>status</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">HTTP(s) Status Code to send back to the client</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line51">line 51</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
If we have a usable Express Response object, return it back after it's been cashed
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Express.Response</span>
</dd>
</dl>
<h4 class="name" id="errorMiddleware"><span class="type-signature"></span>errorMiddleware<span class="signature">(err, req, res, next)</span><span class="type-signature"></span></h4>
<div class="description">
Basic error-handling middleware to ensure we're not dumping stack traces to the client, as that would be insecure
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>err</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">Error to handle</td>
</tr>
<tr>
<td class="name"><code>req</code></td>
<td class="type">
<span class="param-type">Express.Request</span>
</td>
<td class="description last">Express Request</td>
</tr>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last">Express Response</td>
</tr>
<tr>
<td class="name"><code>next</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">Next function in the Express middleware chain (Not that it's getting called XP)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line156">line 156</a>
</li></ul></dd>
</dl>
<h4 class="name" id="escapeRegex"><span class="type-signature"></span>escapeRegex<span class="signature">(string)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
I won't lie this line was whole-sale ganked from stack overflow like a fucking skid
In my defense I only did it because js-runtime-devs are taking fucking eons to implement RegExp.escape()
This should be replaced once that function becomes available in mainline versions of node.js:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>string</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Regex string to escape</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_regexUtils.js.html">utils/regexUtils.js</a>, <a href="utils_regexUtils.js.html#line26">line 26</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The Escaped String
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="exceptionHandler"><span class="type-signature"></span>exceptionHandler<span class="signature">(res, err)</span><span class="type-signature"></span></h4>
<div class="description">
Handles exceptions which where directly the fault of user action >:(
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>res</code></td>
<td class="type">
<span class="param-type">Express.Response</span>
</td>
<td class="description last">Express Response object to bitch at</td>
</tr>
<tr>
<td class="name"><code>err</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">Error created by the jerk in question</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<h4 class="name" id="exceptionSmith"><span class="type-signature"></span>exceptionSmith<span class="signature">(msg, type)</span><span class="type-signature"> &rarr; {Error}</span></h4>
<div class="description">
Creates and returns a custom exception, tagged as a 'custom' exception, using the 'custom' boolean property.
This is used to denote that this error was generated on purpose, with a human readable message, that can be securely sent to the client.
Unexpected exceptions should only be logged internally, however, as they may contain sensitive data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error message to send the client</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error type to send back to the client</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line29">line 29</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The exception to smith
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Error</span>
</dd>
</dl>
<h4 class="name" id="fetchMetadata"><span class="type-signature"></span>fetchMetadata<span class="signature">(fullID, title)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Pulls metadate for a given archive.org item
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fullID</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Full path of the requested upload</td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Title to add to media object</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_internetArchiveUtils.js.html">utils/media/internetArchiveUtils.js</a>, <a href="utils_media_internetArchiveUtils.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Generated list of media objects from given upload path
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="fetchVideoMetadata"><span class="type-signature">(async) </span>fetchVideoMetadata<span class="signature">(link, title, type)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Generic single video YTDLP function meant to be used by service-sepecific fetchers which will then be used to fetch video metadata
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>link</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Link to video in question</td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Title to add to the given media objects</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Link type to attach to the resulting media object</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_ytdlpUtils.js.html">utils/media/ytdlpUtils.js</a>, <a href="utils_media_ytdlpUtils.js.html#line103">line 103</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of Media objects containing relevant metadata
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="fetchYoutubeMetadata"><span class="type-signature"></span>fetchYoutubeMetadata<span class="signature">(id, title)</span><span class="type-signature"> &rarr; {Media}</span></h4>
<div class="description">
Pulls metadata for a single youtube video via YT-DLP
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Youtube Video ID</td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Title to add to the given media object</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_ytdlpUtils.js.html">utils/media/ytdlpUtils.js</a>, <a href="utils_media_ytdlpUtils.js.html#line38">line 38</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Media object containing relevant metadata
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Media</span>
</dd>
</dl>
<h4 class="name" id="fetchYoutubePlaylistMetadata"><span class="type-signature"></span>fetchYoutubePlaylistMetadata<span class="signature">(id, title)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Pulls metadata for a playlist of youtube videos via YT-DLP
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Youtube Playlist ID</td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Title to add to the given media objects</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_ytdlpUtils.js.html">utils/media/ytdlpUtils.js</a>, <a href="utils_media_ytdlpUtils.js.html#line65">line 65</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Array of Media objects containing relevant metadata
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="genCaptcha"><span class="type-signature"></span>genCaptcha<span class="signature">(difficulty, uniqueSecret)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Generates captcha challenges to send down to the browser
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>difficulty</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">Challange Difficulty (x100K internally)</td>
</tr>
<tr>
<td class="name"><code>uniqueSecret</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Secret to salt the challange hash with</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_altchaUtils.js.html">utils/altchaUtils.js</a>, <a href="utils_altchaUtils.js.html#line38">line 38</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Altcha Challenge hash
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="getLoginAttempts"><span class="type-signature"></span>getLoginAttempts<span class="signature">(user)</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
Returns how many failed login attempts within the past day or so since the last login has occured for a given user
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">User to check map against</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line171">line 171</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
of failed login attempts
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getMediaType"><span class="type-signature"></span>getMediaType<span class="signature">(url)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Detects media type by URL
I'd be lying if this didn't take at least some inspiration/regex patterns from extractQueryParam() in cytube/forest's browser-side 'util.js'
Still this has some improvements like url pre-checks and the fact that it's handled serverside, recuing possibility of bad requests.
Some of the regex expressions for certain services have also been improved, such as youtube, and the fore.st-unique archive.org
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">URL to determine media type of</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_yanker.js.html">utils/media/yanker.js</a>, <a href="utils_media_yanker.js.html#line102">line 102</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
containing URL type and clipped ID string
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="hashIP"><span class="type-signature"></span>hashIP<span class="signature">(ip)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Site-wide IP hashing/salting function
Provides a basic level of privacy by only logging salted hashes of IP's
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ip</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">IP to hash</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_hashUtils.js.html">utils/hashUtils.js</a>, <a href="utils_hashUtils.js.html#line53">line 53</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Hashed/Salted IP Adress
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="hashPassword"><span class="type-signature"></span>hashPassword<span class="signature">(pass)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
Sitewide function for hashing passwords
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Password to hash</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_hashUtils.js.html">utils/hashUtils.js</a>, <a href="utils_hashUtils.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Hashed/Salted password
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="kickoff"><span class="type-signature"></span>kickoff<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Kicks off first run of scheduled functions before scheduling functions for regular callback
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_scheduler.js.html">utils/scheduler.js</a>, <a href="utils_scheduler.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h4 class="name" id="killSession"><span class="type-signature"></span>killSession<span class="signature">(session)</span><span class="type-signature"></span></h4>
<div class="description">
Logs user out and destroys all server-side traces of a given session
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>session</code></td>
<td class="type">
<span class="param-type">express-session.session</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line162">line 162</a>
</li></ul></dd>
</dl>
<h4 class="name" id="localExceptionHandler"><span class="type-signature"></span>localExceptionHandler<span class="signature">(err)</span><span class="type-signature"></span></h4>
<div class="description">
Handles local exceptions which where not directly created by user interaction
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>err</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">Exception to handle</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h4 class="name" id="mailem"><span class="type-signature"></span>mailem<span class="signature">(to, subject, body, htmlBody)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Sends an email as tokebot to the requested user w/ the requested body and signature
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>to</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">String containing the email address to send to</td>
</tr>
<tr>
<td class="name"><code>subject</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Subject line of the email to send</td>
</tr>
<tr>
<td class="name"><code>body</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Body contents, either HTML or Plaintext</td>
</tr>
<tr>
<td class="name"><code>htmlBody</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Whether or not Body contents should be sent as HTML or Plaintext</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_mailUtils.js.html">utils/mailUtils.js</a>, <a href="utils_mailUtils.js.html#line45">line 45</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Sent mail info
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="markLink"><span class="type-signature"></span>markLink<span class="signature">(link)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Validates links and returns a marked link object that can be returned to the client to format/embed accordingly
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>link</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">URL to Validate</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_linkUtils.js.html">utils/linkUtils.js</a>, <a href="utils_linkUtils.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Marked link object
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id="processExpiredAttempts"><span class="type-signature"></span>processExpiredAttempts<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Nightly Function Call which iterates through the failed login attempts map, removing any which haven't been attempted in over a da yeahy
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_sessionUtils.js.html">utils/sessionUtils.js</a>, <a href="utils_sessionUtils.js.html#line179">line 179</a>
</li></ul></dd>
</dl>
<h4 class="name" id="refreshRawLink"><span class="type-signature"></span>refreshRawLink<span class="signature">(mediaObj)</span><span class="type-signature"> &rarr; {ScheduledMedia}</span></h4>
<div class="description">
Refreshes raw links on relevant media objects
Useful for sources like youtube, who only provide expiring raw links
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>mediaObj</code></td>
<td class="type">
<span class="param-type">ScheduledMedia</span>
</td>
<td class="description last">Media Object to refresh</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_yanker.js.html">utils/media/yanker.js</a>, <a href="utils_media_yanker.js.html#line66">line 66</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Refreshed media object
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">ScheduledMedia</span>
</dd>
</dl>
<h4 class="name" id="schedule"><span class="type-signature"></span>schedule<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Schedules all timed jobs accross the server
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_scheduler.js.html">utils/scheduler.js</a>, <a href="utils_scheduler.js.html#line32">line 32</a>
</li></ul></dd>
</dl>
<h4 class="name" id="securityCheck"><span class="type-signature"></span>securityCheck<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Basic security check which runs on startup.
Warns server admin against unsafe config options.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_configCheck.js.html">utils/configCheck.js</a>, <a href="utils_configCheck.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h4 class="name" id="sendAddressVerification"><span class="type-signature"></span>sendAddressVerification<span class="signature">(requestDB, userDB, newEmail)</span><span class="type-signature"></span></h4>
<div class="description">
Sends address verification email
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>requestDB</code></td>
<td class="type">
<span class="param-type">Mongoose.Document</span>
</td>
<td class="description last">DB Document Object for the current email change request token</td>
</tr>
<tr>
<td class="name"><code>userDB</code></td>
<td class="type">
<span class="param-type">Mongoose.Document</span>
</td>
<td class="description last">DB Document Object for the user we're verifying email against</td>
</tr>
<tr>
<td class="name"><code>newEmail</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">New email address to send to</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_mailUtils.js.html">utils/mailUtils.js</a>, <a href="utils_mailUtils.js.html#line76">line 76</a>
</li></ul></dd>
</dl>
<h4 class="name" id="socketCriticalExceptionHandler"><span class="type-signature"></span>socketCriticalExceptionHandler<span class="signature">(socket, err)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Generates error messages and drops connection for critical errors caused by socket.io interaction
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket error originated from</td>
</tr>
<tr>
<td class="name"><code>err</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">Error created by the jerk in question</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line126">line 126</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Passthrough from socket.disconnect
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="socketErrorHandler"><span class="type-signature"></span>socketErrorHandler<span class="signature">(socket, msg, type)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Basic error-handling for socket.io so we don't just silently swallow errors.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket error originated from</td>
</tr>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error message to send the client</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Error type to send back to the client</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line96">line 96</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Passthrough from socket.emit
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="socketExceptionHandler"><span class="type-signature"></span>socketExceptionHandler<span class="signature">(socket, err)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
Generates error messages for simple errors generated by socket.io interaction
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>socket</code></td>
<td class="type">
<span class="param-type">Socket</span>
</td>
<td class="description last">Socket error originated from</td>
</tr>
<tr>
<td class="name"><code>err</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last">Error created by the jerk in question</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_loggerUtils.js.html">utils/loggerUtils.js</a>, <a href="utils_loggerUtils.js.html#line106">line 106</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- Passthrough from socket.emit
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="verify"><span class="type-signature"></span>verify<span class="signature">(payload, uniqueSecret)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
Verifies completed altcha challenges handed over from the user
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Completed Altcha Payload</td>
</tr>
<tr>
<td class="name"><code>uniqueSecret</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Server-side Unique Secret to verify payload came from server-generated challenge</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_altchaUtils.js.html">utils/altchaUtils.js</a>, <a href="utils_altchaUtils.js.html#line59">line 59</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if payload is a valid and unique altcha challenge which originated from this server
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="yankMedia"><span class="type-signature"></span>yankMedia<span class="signature">(url, title)</span><span class="type-signature"> &rarr; {Array}</span></h4>
<div class="description">
Checks a given URL and runs the proper metadata fetching function to create a media object from any supported URL
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">URL to yank media against</td>
</tr>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">Title to apply to yanked media</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_yanker.js.html">utils/media/yanker.js</a>, <a href="utils_media_yanker.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Returns list of yanked media objects on success
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="ytdlpFetch"><span class="type-signature">(async) </span>ytdlpFetch<span class="signature">(link, format)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
Basic async YT-DLP Fetch wrapper, ensuring config
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>link</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="default">
</td>
<td class="description last">Link to fetch using YT-DLP</td>
</tr>
<tr>
<td class="name"><code>format</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="default">
b
</td>
<td class="description last">Format string to hand YT-DLP, defaults to 'b'</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_media_ytdlpUtils.js.html">utils/media/ytdlpUtils.js</a>, <a href="utils_media_ytdlpUtils.js.html#line139">line 139</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Metadata dump from YT-DLP
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="activeChannel.html">activeChannel</a></li><li><a href="channelManager.html">channelManager</a></li><li><a href="chat.html">chat</a></li><li><a href="chatBuffer.html">chatBuffer</a></li><li><a href="chatHandler.html">chatHandler</a></li><li><a href="commandPreprocessor.html">commandPreprocessor</a></li><li><a href="commandProcessor.html">commandProcessor</a></li><li><a href="connectedUser.html">connectedUser</a></li><li><a href="media.html">media</a></li><li><a href="playlistHandler.html">playlistHandler</a></li><li><a href="queue.html">queue</a></li><li><a href="queuedMedia.html">queuedMedia</a></li><li><a href="tokebot.html">tokebot</a></li></ul><h3>Global</h3><ul><li><a href="global.html#authenticateSession">authenticateSession</a></li><li><a href="global.html#cache">cache</a></li><li><a href="global.html#channelBanSchema">channelBanSchema</a></li><li><a href="global.html#channelPermissionSchema">channelPermissionSchema</a></li><li><a href="global.html#channelSchema">channelSchema</a></li><li><a href="global.html#chatSchema">chatSchema</a></li><li><a href="global.html#comparePassword">comparePassword</a></li><li><a href="global.html#consoleWarn">consoleWarn</a></li><li><a href="global.html#daysToExpire">daysToExpire</a></li><li><a href="global.html#emailChangeSchema">emailChangeSchema</a></li><li><a href="global.html#emoteSchema">emoteSchema</a></li><li><a href="global.html#errorHandler">errorHandler</a></li><li><a href="global.html#errorMiddleware">errorMiddleware</a></li><li><a href="global.html#escapeRegex">escapeRegex</a></li><li><a href="global.html#exceptionHandler">exceptionHandler</a></li><li><a href="global.html#exceptionSmith">exceptionSmith</a></li><li><a href="global.html#failedAttempts">failedAttempts</a></li><li><a href="global.html#fetchMetadata">fetchMetadata</a></li><li><a href="global.html#fetchVideoMetadata">fetchVideoMetadata</a></li><li><a href="global.html#fetchYoutubeMetadata">fetchYoutubeMetadata</a></li><li><a href="global.html#fetchYoutubePlaylistMetadata">fetchYoutubePlaylistMetadata</a></li><li><a href="global.html#flairSchema">flairSchema</a></li><li><a href="global.html#genCaptcha">genCaptcha</a></li><li><a href="global.html#getLoginAttempts">getLoginAttempts</a></li><li><a href="global.html#getMediaType">getMediaType</a></li><li><a href="global.html#hashIP">hashIP</a></li><li><a href="global.html#hashPassword">hashPassword</a></li><li><a href="global.html#kickoff">kickoff</a></li><li><a href="global.html#killSession">killSession</a></li><li><a href="global.html#lifetime">lifetime</a></li><li><a href="global.html#localExceptionHandler">localExceptionHandler</a></li><li><a href="global.html#mailem">mailem</a></li><li><a href="global.html#markLink">markLink</a></li><li><a href="global.html#maxAttempts">maxAttempts</a></li><li><a href="global.html#mediaSchema">mediaSchema</a></li><li><a href="global.html#passwordResetSchema">passwordResetSchema</a></li><li><a href="global.html#permissionSchema">permissionSchema</a></li><li><a href="global.html#playlistMediaProperties">playlistMediaProperties</a></li><li><a href="global.html#playlistSchema">playlistSchema</a></li><li><a href="global.html#processExpiredAttempts">processExpiredAttempts</a></li><li><a href="global.html#queuedProperties">queuedProperties</a></li><li><a href="global.html#rankEnum">rankEnum</a></li><li><a href="global.html#refreshRawLink">refreshRawLink</a></li><li><a href="global.html#schedule">schedule</a></li><li><a href="global.html#securityCheck">securityCheck</a></li><li><a href="global.html#sendAddressVerification">sendAddressVerification</a></li><li><a href="global.html#socketCriticalExceptionHandler">socketCriticalExceptionHandler</a></li><li><a href="global.html#socketErrorHandler">socketErrorHandler</a></li><li><a href="global.html#socketExceptionHandler">socketExceptionHandler</a></li><li><a href="global.html#spent">spent</a></li><li><a href="global.html#statSchema">statSchema</a></li><li><a href="global.html#throttleAttempts">throttleAttempts</a></li><li><a href="global.html#tokeCommandSchema">tokeCommandSchema</a></li><li><a href="global.html#transporter">transporter</a></li><li><a href="global.html#typeEnum">typeEnum</a></li><li><a href="global.html#userBanSchema">userBanSchema</a></li><li><a href="global.html#userSchema">userSchema</a></li><li><a href="global.html#verify">verify</a></li><li><a href="global.html#yankMedia">yankMedia</a></li><li><a href="global.html#ytdlpFetch">ytdlpFetch</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Tue Sep 02 2025 07:43:33 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>