mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +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
|
|
@ -26,8 +26,6 @@ DOMAIN_SERVER=http://localhost:3080
|
||||||
|
|
||||||
NO_INDEX=true
|
NO_INDEX=true
|
||||||
|
|
||||||
SHOW_BIRTHDAY_ICON=true
|
|
||||||
|
|
||||||
#===============#
|
#===============#
|
||||||
# Debug Logging #
|
# Debug Logging #
|
||||||
#===============#
|
#===============#
|
||||||
|
|
@ -325,8 +323,15 @@ FIREBASE_APP_ID=
|
||||||
|
|
||||||
# NODE_ENV=
|
# NODE_ENV=
|
||||||
|
|
||||||
|
# If using Redis, you should flush the cache after changing any LibreChat settings
|
||||||
# REDIS_URI=
|
# REDIS_URI=
|
||||||
# USE_REDIS=
|
# USE_REDIS=
|
||||||
|
|
||||||
|
# Give the AI Icon a Birthday Hat :)
|
||||||
|
# Will show automatically on February 11th (LibreChat's birthday)
|
||||||
|
# Set this to false to disable the birthday hat
|
||||||
|
# Set to true to enable all the time.
|
||||||
|
# SHOW_BIRTHDAY_ICON=true
|
||||||
|
|
||||||
# E2E_USER_EMAIL=
|
# E2E_USER_EMAIL=
|
||||||
# E2E_USER_PASSWORD=
|
# E2E_USER_PASSWORD=
|
||||||
|
|
@ -11,6 +11,7 @@ const configureSocialLogins = require('./socialLogins');
|
||||||
const { connectDb, indexSync } = require('~/lib/db');
|
const { connectDb, indexSync } = require('~/lib/db');
|
||||||
const AppService = require('./services/AppService');
|
const AppService = require('./services/AppService');
|
||||||
const noIndex = require('./middleware/noIndex');
|
const noIndex = require('./middleware/noIndex');
|
||||||
|
const { isEnabled } = require('~/server/utils');
|
||||||
const { logger } = require('~/config');
|
const { logger } = require('~/config');
|
||||||
|
|
||||||
const routes = require('./routes');
|
const routes = require('./routes');
|
||||||
|
|
@ -53,7 +54,7 @@ const startServer = async () => {
|
||||||
passport.use(await jwtLogin());
|
passport.use(await jwtLogin());
|
||||||
passport.use(passportLogin());
|
passport.use(passportLogin());
|
||||||
|
|
||||||
if (ALLOW_SOCIAL_LOGIN?.toLowerCase() === 'true') {
|
if (isEnabled(ALLOW_SOCIAL_LOGIN)) {
|
||||||
configureSocialLogins(app);
|
configureSocialLogins(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
|
const { defaultSocialLogins } = require('librechat-data-provider');
|
||||||
const { isEnabled } = require('~/server/utils');
|
const { isEnabled } = require('~/server/utils');
|
||||||
const { logger } = require('~/config');
|
const { logger } = require('~/config');
|
||||||
|
|
||||||
|
|
@ -15,7 +16,7 @@ router.get('/', async function (req, res) {
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
appTitle: process.env.APP_TITLE || 'LibreChat',
|
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,
|
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
|
||||||
facebookLoginEnabled:
|
facebookLoginEnabled:
|
||||||
!!process.env.FACEBOOK_CLIENT_ID && !!process.env.FACEBOOK_CLIENT_SECRET,
|
!!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 { initializeFirebase } = require('./Files/Firebase/initialize');
|
||||||
const loadCustomConfig = require('./Config/loadCustomConfig');
|
const loadCustomConfig = require('./Config/loadCustomConfig');
|
||||||
const handleRateLimits = require('./Config/handleRateLimits');
|
const handleRateLimits = require('./Config/handleRateLimits');
|
||||||
|
|
@ -35,10 +40,13 @@ const AppService = async (app) => {
|
||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const socialLogins = config?.registration?.socialLogins ?? defaultSocialLogins;
|
||||||
|
|
||||||
if (!Object.keys(config).length) {
|
if (!Object.keys(config).length) {
|
||||||
app.locals = {
|
app.locals = {
|
||||||
availableTools,
|
availableTools,
|
||||||
fileStrategy,
|
fileStrategy,
|
||||||
|
socialLogins,
|
||||||
paths,
|
paths,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -52,13 +60,6 @@ const AppService = async (app) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRateLimits(config?.rateLimits);
|
handleRateLimits(config?.rateLimits);
|
||||||
const socialLogins = config?.registration?.socialLogins ?? [
|
|
||||||
'google',
|
|
||||||
'facebook',
|
|
||||||
'openid',
|
|
||||||
'github',
|
|
||||||
'discord',
|
|
||||||
];
|
|
||||||
|
|
||||||
const endpointLocals = {};
|
const endpointLocals = {};
|
||||||
if (config?.endpoints?.[EModelEndpoint.assistants]) {
|
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');
|
const AppService = require('./AppService');
|
||||||
|
|
||||||
|
|
@ -240,6 +240,7 @@ describe('AppService updating app.locals', () => {
|
||||||
expect(app.locals.paths).toBeDefined();
|
expect(app.locals.paths).toBeDefined();
|
||||||
expect(app.locals.availableTools).toBeDefined();
|
expect(app.locals.availableTools).toBeDefined();
|
||||||
expect(app.locals.fileStrategy).toEqual(FileSources.local);
|
expect(app.locals.fileStrategy).toEqual(FileSources.local);
|
||||||
|
expect(app.locals.socialLogins).toEqual(defaultSocialLogins);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update app.locals with values from loadCustomConfig', async () => {
|
it('should update app.locals with values from loadCustomConfig', async () => {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import { EModelEndpoint, eModelEndpointSchema } from './schemas';
|
||||||
import { fileConfigSchema } from './file-config';
|
import { fileConfigSchema } from './file-config';
|
||||||
import { FileSources } from './types/files';
|
import { FileSources } from './types/files';
|
||||||
|
|
||||||
|
export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord'];
|
||||||
|
|
||||||
export const fileSourceSchema = z.nativeEnum(FileSources);
|
export const fileSourceSchema = z.nativeEnum(FileSources);
|
||||||
|
|
||||||
export const assistantEndpointSchema = z.object({
|
export const assistantEndpointSchema = z.object({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue