more jsdoc stuff

f372e1a69d274448878d4255388e1bbfe8ee1a17

BPplays <andymalbp@gmail.com>

2 files changed, +15 -2Ignore whitespace
server.js+13 -0
@@ -248,28 +248,41 @@ app.use(compression());
248app.use(responseTime());248app.use(responseTime());
249249
250250
251/** @type {number} */
251const server_port = cliArguments.port ?? process.env.SILLY_TAVERN_PORT ?? getConfigValue('port', DEFAULT_PORT);252const server_port = cliArguments.port ?? process.env.SILLY_TAVERN_PORT ?? getConfigValue('port', DEFAULT_PORT);
253/** @type {boolean} */
252const autorun = (cliArguments.autorun ?? getConfigValue('autorun', DEFAULT_AUTORUN)) && !cliArguments.ssl;254const autorun = (cliArguments.autorun ?? getConfigValue('autorun', DEFAULT_AUTORUN)) && !cliArguments.ssl;
255/** @type {boolean} */
253const listen = cliArguments.listen ?? getConfigValue('listen', DEFAULT_LISTEN);256const listen = cliArguments.listen ?? getConfigValue('listen', DEFAULT_LISTEN);
257/** @type {boolean} */
254const enableCorsProxy = cliArguments.corsProxy ?? getConfigValue('enableCorsProxy', DEFAULT_CORS_PROXY);258const enableCorsProxy = cliArguments.corsProxy ?? getConfigValue('enableCorsProxy', DEFAULT_CORS_PROXY);
255const enableWhitelist = cliArguments.whitelist ?? getConfigValue('whitelistMode', DEFAULT_WHITELIST);259const enableWhitelist = cliArguments.whitelist ?? getConfigValue('whitelistMode', DEFAULT_WHITELIST);
260/** @type {string} */
256const dataRoot = cliArguments.dataRoot ?? getConfigValue('dataRoot', './data');261const dataRoot = cliArguments.dataRoot ?? getConfigValue('dataRoot', './data');
262/** @type {boolean} */
257const disableCsrf = cliArguments.disableCsrf ?? getConfigValue('disableCsrfProtection', DEFAULT_CSRF_DISABLED);263const disableCsrf = cliArguments.disableCsrf ?? getConfigValue('disableCsrfProtection', DEFAULT_CSRF_DISABLED);
258const basicAuthMode = cliArguments.basicAuthMode ?? getConfigValue('basicAuthMode', DEFAULT_BASIC_AUTH);264const basicAuthMode = cliArguments.basicAuthMode ?? getConfigValue('basicAuthMode', DEFAULT_BASIC_AUTH);
259const perUserBasicAuth = getConfigValue('perUserBasicAuth', DEFAULT_PER_USER_BASIC_AUTH);265const perUserBasicAuth = getConfigValue('perUserBasicAuth', DEFAULT_PER_USER_BASIC_AUTH);
266/** @type {boolean} */
260const enableAccounts = getConfigValue('enableUserAccounts', DEFAULT_ACCOUNTS);267const enableAccounts = getConfigValue('enableUserAccounts', DEFAULT_ACCOUNTS);
261268
262const uploadsPath = path.join(dataRoot, UPLOADS_DIRECTORY);269const uploadsPath = path.join(dataRoot, UPLOADS_DIRECTORY);
263270
264271
272/** @type {boolean|'auto'} */
265let enableIPv6 = stringToBool(cliArguments.enableIPv6) ?? getConfigValue('protocol.ipv6', DEFAULT_ENABLE_IPV6);273let enableIPv6 = stringToBool(cliArguments.enableIPv6) ?? getConfigValue('protocol.ipv6', DEFAULT_ENABLE_IPV6);
274/** @type {boolean|'auto'} */
266let enableIPv4 = stringToBool(cliArguments.enableIPv4) ?? getConfigValue('protocol.ipv4', DEFAULT_ENABLE_IPV4);275let enableIPv4 = stringToBool(cliArguments.enableIPv4) ?? getConfigValue('protocol.ipv4', DEFAULT_ENABLE_IPV4);
267276
277/** @type {string} */
268const autorunHostname = cliArguments.autorunHostname ?? getConfigValue('autorunHostname', DEFAULT_AUTORUN_HOSTNAME);278const autorunHostname = cliArguments.autorunHostname ?? getConfigValue('autorunHostname', DEFAULT_AUTORUN_HOSTNAME);
279/** @type {number} */
269const autorunPortOverride = cliArguments.autorunPortOverride ?? getConfigValue('autorunPortOverride', DEFAULT_AUTORUN_PORT);280const autorunPortOverride = cliArguments.autorunPortOverride ?? getConfigValue('autorunPortOverride', DEFAULT_AUTORUN_PORT);
270281
282/** @type {boolean} */
271const dnsPreferIPv6 = cliArguments.dnsPreferIPv6 ?? getConfigValue('dnsPreferIPv6', DEFAULT_PREFER_IPV6);283const dnsPreferIPv6 = cliArguments.dnsPreferIPv6 ?? getConfigValue('dnsPreferIPv6', DEFAULT_PREFER_IPV6);
272284
285/** @type {boolean} */
273const avoidLocalhost = cliArguments.avoidLocalhost ?? getConfigValue('avoidLocalhost', DEFAULT_AVOID_LOCALHOST);286const avoidLocalhost = cliArguments.avoidLocalhost ?? getConfigValue('avoidLocalhost', DEFAULT_AVOID_LOCALHOST);
274287
275const proxyEnabled = cliArguments.requestProxyEnabled ?? getConfigValue('requestProxy.enabled', DEFAULT_PROXY_ENABLED);288const proxyEnabled = cliArguments.requestProxyEnabled ?? getConfigValue('requestProxy.enabled', DEFAULT_PROXY_ENABLED);
src/util.js+2 -2
@@ -748,8 +748,8 @@ export async function canResolve(name, useIPv6 = true, useIPv4 = true) {
748748
749/**749/**
750 * converts string to boolean accepts 'true' or 'false' else it returns the string put in750 * converts string to boolean accepts 'true' or 'false' else it returns the string put in
751 * @param {string} str Input string751 * @param {string|null} str Input string or null
752 * @returns {boolean|string} boolean else original input string752 * @returns {boolean|string|null} boolean else original input string or null if input is
753 */753 */
754export function stringToBool(str) {754export function stringToBool(str) {
755 if (str === 'true') return true;755 if (str === 'true') return true;