mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add alternative local vectors source.
x5 speed boost!!
This commit is contained in:
13
src/util.js
13
src/util.js
@ -1,6 +1,7 @@
|
||||
const path = require('path');
|
||||
const child_process = require('child_process');
|
||||
const commandExistsSync = require('command-exists').sync;
|
||||
const _ = require('lodash');
|
||||
|
||||
/**
|
||||
* Returns the config object from the config.conf file.
|
||||
@ -16,6 +17,17 @@ function getConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the given key from the config object.
|
||||
* @param {string} key - Key to get from the config object
|
||||
* @param {any} defaultValue - Default value to return if the key is not found
|
||||
* @returns {any} Value for the given key
|
||||
*/
|
||||
function getConfigValue(key, defaultValue = null) {
|
||||
const config = getConfig();
|
||||
return _.get(config, key, defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the Basic Auth header value for the given user and password.
|
||||
* @param {string} auth username:password
|
||||
@ -67,6 +79,7 @@ function delay(ms) {
|
||||
|
||||
module.exports = {
|
||||
getConfig,
|
||||
getConfigValue,
|
||||
getVersion,
|
||||
getBasicAuthHeader,
|
||||
delay,
|
||||
|
Reference in New Issue
Block a user