mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
* 🔒 feat: Add Content Security Policy using Helmet middleware * 🔒 feat: Set trust proxy and refine Content Security Policy directives * 🎨 feat: add `copy-tex` to improve copying KaTeX (#7308) When selecting equations and using copy paste, uses the correct latex code. Co-authored-by: Ruben Talstra <RubenTalstra1211@outlook.com> * 🔃 refactor: `AgentFooter` to conditionally render buttons based on `activePanel` (#7306) * 🚀 feat: Add `Cloudflare Turnstile` support (#5987) * 🚀 feat: Add @marsidev/react-turnstile dependency to package.json and package-lock.json * 🚀 feat: Integrate Cloudflare Turnstile configuration support in AppService and add schema validation * 🚀 feat: Implemented Cloudflare Turnstile integration in Login and Registration forms * 🚀 feat: Enhance AppService tests with additional mocks and configuration setups * 🚀 feat: Comment out outdated config version warning tests in AppService.spec.js * 🚀 feat: Remove outdated warning tests and add new checks for environment variables and API health * 🔧 test: Update AppService.spec.js to use expect.anything() for paths validation * 🔧 test: Refactor AppService.spec.js to streamline mocks and enhance clarity * 🔧 chore: removed not needed test * Potential fix for code scanning alert no. 5638: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5629: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5642: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Update turnstile.js * Potential fix for code scanning alert no. 5634: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5646: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * Potential fix for code scanning alert no. 5647: Ensure code is properly formatted, use insertion, deletion, or replacement to obtain desired formatting. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * 🔒 feat: Refactor Content Security Policy setup to use Helmet middleware with custom directives * 🔒 feat: Enhance Content Security Policy to include Sandpack Bundler URL * 🔒 feat: Update Content Security Policy and integrate Turnstile captcha support --------- Co-authored-by: andresgit <9771158+andresgit@users.noreply.github.com> Co-authored-by: matt burnett <mawburn@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
const { removeNullishValues } = require('librechat-data-provider');
|
|
const { logger } = require('~/config');
|
|
|
|
/**
|
|
* Loads and maps the Cloudflare Turnstile configuration.
|
|
*
|
|
* Expected config structure:
|
|
*
|
|
* turnstile:
|
|
* siteKey: "your-site-key-here"
|
|
* options:
|
|
* language: "auto" // "auto" or an ISO 639-1 language code (e.g. en)
|
|
* size: "normal" // Options: "normal", "compact", "flexible", or "invisible"
|
|
*
|
|
* @param {TCustomConfig | undefined} config - The loaded custom configuration.
|
|
* @param {TConfigDefaults} configDefaults - The custom configuration default values.
|
|
* @returns {TCustomConfig['turnstile']} The mapped Turnstile configuration.
|
|
*/
|
|
function loadTurnstileConfig(config, configDefaults) {
|
|
const { turnstile: customTurnstile = {} } = config ?? {};
|
|
const { turnstile: defaults = {} } = configDefaults;
|
|
|
|
/** @type {TCustomConfig['turnstile']} */
|
|
const loadedTurnstile = removeNullishValues({
|
|
siteKey: customTurnstile.siteKey ?? defaults.siteKey,
|
|
options: customTurnstile.options ?? defaults.options,
|
|
});
|
|
|
|
const enabled = Boolean(loadedTurnstile.siteKey);
|
|
|
|
if (enabled) {
|
|
logger.info(
|
|
'Turnstile is ENABLED with configuration:\n' + JSON.stringify(loadedTurnstile, null, 2),
|
|
);
|
|
} else {
|
|
logger.info('Turnstile is DISABLED (no siteKey provided).');
|
|
}
|
|
|
|
return loadedTurnstile;
|
|
}
|
|
|
|
module.exports = {
|
|
loadTurnstileConfig,
|
|
};
|