mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
* feat(auth.js): add validation for registration endpoint using validateRegistration middleware feat(validateRegistration.js): add middleware to validate registration based on ALLOW_REGISTRATION environment variable * fix(config.js): fix registrationEnabled and socialLoginEnabled variables to handle case-insensitive environment variable values * refactor(validateRegistration.js): remove console.log statement * chore(playwright.yml): skip browser download during yarn install chore(playwright.yml): place Playwright binaries to node_modules/@playwright/test chore(playwright.yml): install Playwright dependencies using npx playwright install-deps chore(playwright.yml): install Playwright chromium browser using npx playwright install chromium chore(playwright.yml): install @playwright/test@latest using npm install -D @playwright/test@latest chore(playwright.yml): run Playwright tests using npm run e2e:ci * chore(playwright.yml): change npm install order and update comment The order of the npm install commands in the "Install Playwright Browsers" step has been changed to first install @playwright/test@latest and then install chromium. Additionally, the comment explaining the PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD variable has been updated to mention npm install instead of yarn install. * chore(playwright.yml): remove commented out code for caching and add separate steps for installing Playwright dependencies and browsers
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
|
|
router.get('/', async function (req, res) {
|
|
try {
|
|
const appTitle = process.env.APP_TITLE || 'LibreChat';
|
|
const googleLoginEnabled = !!process.env.GOOGLE_CLIENT_ID && !!process.env.GOOGLE_CLIENT_SECRET;
|
|
const openidLoginEnabled =
|
|
!!process.env.OPENID_CLIENT_ID &&
|
|
!!process.env.OPENID_CLIENT_SECRET &&
|
|
!!process.env.OPENID_ISSUER &&
|
|
!!process.env.OPENID_SESSION_SECRET;
|
|
const openidLabel = process.env.OPENID_BUTTON_LABEL || 'Login with OpenID';
|
|
const openidImageUrl = process.env.OPENID_IMAGE_URL;
|
|
const githubLoginEnabled = !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET;
|
|
const discordLoginEnabled =
|
|
!!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET;
|
|
const serverDomain = process.env.DOMAIN_SERVER || 'http://localhost:3080';
|
|
const registrationEnabled = process.env.ALLOW_REGISTRATION?.toLowerCase() === 'true';
|
|
const socialLoginEnabled = process.env.ALLOW_SOCIAL_LOGIN?.toLowerCase() === 'true';
|
|
const emailEnabled =
|
|
!!process.env.EMAIL_SERVICE &&
|
|
!!process.env.EMAIL_USERNAME &&
|
|
!!process.env.EMAIL_PASSWORD &&
|
|
!!process.env.EMAIL_FROM;
|
|
|
|
return res.status(200).send({
|
|
appTitle,
|
|
googleLoginEnabled,
|
|
openidLoginEnabled,
|
|
openidLabel,
|
|
openidImageUrl,
|
|
githubLoginEnabled,
|
|
discordLoginEnabled,
|
|
serverDomain,
|
|
registrationEnabled,
|
|
socialLoginEnabled,
|
|
emailEnabled,
|
|
});
|
|
} catch (err) {
|
|
console.error(err);
|
|
return res.status(500).send({ error: err.message });
|
|
}
|
|
});
|
|
|
|
module.exports = router;
|