-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
🚀 feat: Add Cloudflare Turnstile
support
#5987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a7aea80
🚀 feat: Add @marsidev/react-turnstile dependency to package.json and …
rubentalstra fe3819f
🚀 feat: Integrate Cloudflare Turnstile configuration support in AppSe…
rubentalstra 3c89105
🚀 feat: Implemented Cloudflare Turnstile integration in Login and Reg…
rubentalstra 8925042
🚀 feat: Enhance AppService tests with additional mocks and configurat…
rubentalstra 971a2fc
🚀 feat: Comment out outdated config version warning tests in AppServi…
rubentalstra 02947c5
🚀 feat: Remove outdated warning tests and add new checks for environm…
rubentalstra 564e85b
Merge branch 'main' into feat/CAPTCHA
rubentalstra 788094f
Merge branch 'main' into feat/CAPTCHA
rubentalstra db171b2
Merge branch 'main' into feat/CAPTCHA
rubentalstra 0f2d06d
Merge branch 'main' into feat/CAPTCHA
rubentalstra 504ac61
🔧 test: Update AppService.spec.js to use expect.anything() for paths …
rubentalstra f0104ac
🔧 test: Refactor AppService.spec.js to streamline mocks and enhance c…
rubentalstra 540da99
Merge branch 'main' into feat/CAPTCHA
rubentalstra 95e5a31
Merge branch 'main' into feat/CAPTCHA
rubentalstra 21ab4e3
Merge branch 'main' into feat/CAPTCHA
rubentalstra 637025b
Merge branch 'main' into feat/CAPTCHA
rubentalstra d517454
🔧 chore: removed not needed test
rubentalstra 40782dc
Merge branch 'main' into feat/CAPTCHA
rubentalstra 547ade3
Potential fix for code scanning alert no. 5638: Ensure code is proper…
rubentalstra ef0047e
Potential fix for code scanning alert no. 5629: Ensure code is proper…
rubentalstra 9131873
Potential fix for code scanning alert no. 5642: Ensure code is proper…
rubentalstra f4daeb2
Update turnstile.js
rubentalstra ee1b816
Potential fix for code scanning alert no. 5634: Ensure code is proper…
rubentalstra a1cd9b1
Potential fix for code scanning alert no. 5646: Ensure code is proper…
rubentalstra 64b7e2f
Potential fix for code scanning alert no. 5647: Ensure code is proper…
rubentalstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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, | ||
}); | ||
|
||
logger.info('Turnstile configuration loaded:\n' + JSON.stringify(loadedTurnstile, null, 2)); | ||
return loadedTurnstile; | ||
} | ||
|
||
module.exports = { | ||
|
||
loadTurnstileConfig | ||
|
||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.