mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-16 15:35:31 +01:00
👥 fix: Reinstate Default Social Login Values (#1811)
* fix: social logins accidentally removed default in AppService, reinstated and added test * chore: move birthday to OTHER section and make disabled by default
This commit is contained in:
parent
60b1d1332c
commit
637a1a41c2
6 changed files with 25 additions and 14 deletions
|
|
@ -11,6 +11,7 @@ const configureSocialLogins = require('./socialLogins');
|
|||
const { connectDb, indexSync } = require('~/lib/db');
|
||||
const AppService = require('./services/AppService');
|
||||
const noIndex = require('./middleware/noIndex');
|
||||
const { isEnabled } = require('~/server/utils');
|
||||
const { logger } = require('~/config');
|
||||
|
||||
const routes = require('./routes');
|
||||
|
|
@ -53,7 +54,7 @@ const startServer = async () => {
|
|||
passport.use(await jwtLogin());
|
||||
passport.use(passportLogin());
|
||||
|
||||
if (ALLOW_SOCIAL_LOGIN?.toLowerCase() === 'true') {
|
||||
if (isEnabled(ALLOW_SOCIAL_LOGIN)) {
|
||||
configureSocialLogins(app);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
const express = require('express');
|
||||
const { defaultSocialLogins } = require('librechat-data-provider');
|
||||
const { isEnabled } = require('~/server/utils');
|
||||
const { logger } = require('~/config');
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ router.get('/', async function (req, res) {
|
|||
try {
|
||||
const payload = {
|
||||
appTitle: process.env.APP_TITLE || 'LibreChat',
|
||||
socialLogins: req.app.locals.socialLogins,
|
||||
socialLogins: req.app.locals.socialLogins ?? defaultSocialLogins,
|
||||
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
|
||||
facebookLoginEnabled:
|
||||
!!process.env.FACEBOOK_CLIENT_ID && !!process.env.FACEBOOK_CLIENT_SECRET,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
const { FileSources, EModelEndpoint, Constants } = require('librechat-data-provider');
|
||||
const {
|
||||
FileSources,
|
||||
EModelEndpoint,
|
||||
Constants,
|
||||
defaultSocialLogins,
|
||||
} = require('librechat-data-provider');
|
||||
const { initializeFirebase } = require('./Files/Firebase/initialize');
|
||||
const loadCustomConfig = require('./Config/loadCustomConfig');
|
||||
const handleRateLimits = require('./Config/handleRateLimits');
|
||||
|
|
@ -35,10 +40,13 @@ const AppService = async (app) => {
|
|||
]),
|
||||
});
|
||||
|
||||
const socialLogins = config?.registration?.socialLogins ?? defaultSocialLogins;
|
||||
|
||||
if (!Object.keys(config).length) {
|
||||
app.locals = {
|
||||
availableTools,
|
||||
fileStrategy,
|
||||
socialLogins,
|
||||
paths,
|
||||
};
|
||||
|
||||
|
|
@ -52,13 +60,6 @@ const AppService = async (app) => {
|
|||
}
|
||||
|
||||
handleRateLimits(config?.rateLimits);
|
||||
const socialLogins = config?.registration?.socialLogins ?? [
|
||||
'google',
|
||||
'facebook',
|
||||
'openid',
|
||||
'github',
|
||||
'discord',
|
||||
];
|
||||
|
||||
const endpointLocals = {};
|
||||
if (config?.endpoints?.[EModelEndpoint.assistants]) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { FileSources } = require('librechat-data-provider');
|
||||
const { FileSources, defaultSocialLogins } = require('librechat-data-provider');
|
||||
|
||||
const AppService = require('./AppService');
|
||||
|
||||
|
|
@ -240,6 +240,7 @@ describe('AppService updating app.locals', () => {
|
|||
expect(app.locals.paths).toBeDefined();
|
||||
expect(app.locals.availableTools).toBeDefined();
|
||||
expect(app.locals.fileStrategy).toEqual(FileSources.local);
|
||||
expect(app.locals.socialLogins).toEqual(defaultSocialLogins);
|
||||
});
|
||||
|
||||
it('should update app.locals with values from loadCustomConfig', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue