diff --git a/.env.example b/.env.example index c51f714301..51bfc3a66f 100644 --- a/.env.example +++ b/.env.example @@ -26,8 +26,6 @@ DOMAIN_SERVER=http://localhost:3080 NO_INDEX=true -SHOW_BIRTHDAY_ICON=true - #===============# # Debug Logging # #===============# @@ -325,8 +323,15 @@ FIREBASE_APP_ID= # NODE_ENV= +# If using Redis, you should flush the cache after changing any LibreChat settings # REDIS_URI= # 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_PASSWORD= +# E2E_USER_PASSWORD= \ No newline at end of file diff --git a/api/server/index.js b/api/server/index.js index 5d35434bd2..dd8a8ac7c2 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -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); } diff --git a/api/server/routes/config.js b/api/server/routes/config.js index be92910306..efee7fb539 100644 --- a/api/server/routes/config.js +++ b/api/server/routes/config.js @@ -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, diff --git a/api/server/services/AppService.js b/api/server/services/AppService.js index 5089392ed9..69e9276120 100644 --- a/api/server/services/AppService.js +++ b/api/server/services/AppService.js @@ -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]) { diff --git a/api/server/services/AppService.spec.js b/api/server/services/AppService.spec.js index 2bd33cbb90..bedda9e3fd 100644 --- a/api/server/services/AppService.spec.js +++ b/api/server/services/AppService.spec.js @@ -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 () => { diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts index 7da785e95c..1864cd7ddd 100644 --- a/packages/data-provider/src/config.ts +++ b/packages/data-provider/src/config.ts @@ -4,6 +4,8 @@ import { EModelEndpoint, eModelEndpointSchema } from './schemas'; import { fileConfigSchema } from './file-config'; import { FileSources } from './types/files'; +export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord']; + export const fileSourceSchema = z.nativeEnum(FileSources); export const assistantEndpointSchema = z.object({