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());
248248app.use(responseTime());
249249
250250
251+/** @type {number} */
251252const server_port = cliArguments.port ?? process.env.SILLY_TAVERN_PORT ?? getConfigValue('port', DEFAULT_PORT);
253+/** @type {boolean} */
252254const autorun = (cliArguments.autorun ?? getConfigValue('autorun', DEFAULT_AUTORUN)) && !cliArguments.ssl;
255+/** @type {boolean} */
253256const listen = cliArguments.listen ?? getConfigValue('listen', DEFAULT_LISTEN);
257+/** @type {boolean} */
254258const enableCorsProxy = cliArguments.corsProxy ?? getConfigValue('enableCorsProxy', DEFAULT_CORS_PROXY);
255259const enableWhitelist = cliArguments.whitelist ?? getConfigValue('whitelistMode', DEFAULT_WHITELIST);
260+/** @type {string} */
256261const dataRoot = cliArguments.dataRoot ?? getConfigValue('dataRoot', './data');
262+/** @type {boolean} */
257263const disableCsrf = cliArguments.disableCsrf ?? getConfigValue('disableCsrfProtection', DEFAULT_CSRF_DISABLED);
258264const basicAuthMode = cliArguments.basicAuthMode ?? getConfigValue('basicAuthMode', DEFAULT_BASIC_AUTH);
259265const perUserBasicAuth = getConfigValue('perUserBasicAuth', DEFAULT_PER_USER_BASIC_AUTH);
266+/** @type {boolean} */
260267const enableAccounts = getConfigValue('enableUserAccounts', DEFAULT_ACCOUNTS);
261268
262269const uploadsPath = path.join(dataRoot, UPLOADS_DIRECTORY);
263270
264271
272+/** @type {boolean|'auto'} */
265273let enableIPv6 = stringToBool(cliArguments.enableIPv6) ?? getConfigValue('protocol.ipv6', DEFAULT_ENABLE_IPV6);
274+/** @type {boolean|'auto'} */
266275let enableIPv4 = stringToBool(cliArguments.enableIPv4) ?? getConfigValue('protocol.ipv4', DEFAULT_ENABLE_IPV4);
267276
277+/** @type {string} */
268278const autorunHostname = cliArguments.autorunHostname ?? getConfigValue('autorunHostname', DEFAULT_AUTORUN_HOSTNAME);
279+/** @type {number} */
269280const autorunPortOverride = cliArguments.autorunPortOverride ?? getConfigValue('autorunPortOverride', DEFAULT_AUTORUN_PORT);
270281
282+/** @type {boolean} */
271283const dnsPreferIPv6 = cliArguments.dnsPreferIPv6 ?? getConfigValue('dnsPreferIPv6', DEFAULT_PREFER_IPV6);
272284
285+/** @type {boolean} */
273286const avoidLocalhost = cliArguments.avoidLocalhost ?? getConfigValue('avoidLocalhost', DEFAULT_AVOID_LOCALHOST);
274287
275288const 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
749749/**
750750 * converts string to boolean accepts 'true' or 'false' else it returns the string put in
751751 * @param {string|null} str Input string or null
752752 * @returns {boolean|string|null} boolean else original input string or null if input is
753753 */
754754export function stringToBool(str) {
755755 if (str === 'true') return true;