mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
feat: add CUSTOM_FOOTER env variable (#1098)
This commit is contained in:
parent
4ce585f77d
commit
05c4c7e551
4 changed files with 49 additions and 47 deletions
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
APP_TITLE=LibreChat
|
APP_TITLE=LibreChat
|
||||||
|
|
||||||
|
# Uncomment to add a custom footer.
|
||||||
|
# Uncomment and make empty "" to remove the footer.
|
||||||
|
# CUSTOM_FOOTER="My custom footer"
|
||||||
|
|
||||||
# The server will listen to localhost:3080 by default. You can change the target IP as you want.
|
# The server will listen to localhost:3080 by default. You can change the target IP as you want.
|
||||||
# If you want to make this server available externally, for example to share the server with others
|
# If you want to make this server available externally, for example to share the server with others
|
||||||
# or expose this from a Docker container, set host to 0.0.0.0 or your external IP interface.
|
# or expose this from a Docker container, set host to 0.0.0.0 or your external IP interface.
|
||||||
|
|
|
||||||
|
|
@ -4,45 +4,36 @@ const { isEnabled } = require('../utils');
|
||||||
|
|
||||||
router.get('/', async function (req, res) {
|
router.get('/', async function (req, res) {
|
||||||
try {
|
try {
|
||||||
const appTitle = process.env.APP_TITLE || 'LibreChat';
|
const payload = {
|
||||||
const googleLoginEnabled = !!process.env.GOOGLE_CLIENT_ID && !!process.env.GOOGLE_CLIENT_SECRET;
|
appTitle: process.env.APP_TITLE || 'LibreChat',
|
||||||
const facebookLoginEnabled =
|
googleLoginEnabled: !!process.env.GOOGLE_CLIENT_ID && !!process.env.GOOGLE_CLIENT_SECRET,
|
||||||
!!process.env.FACEBOOK_CLIENT_ID && !!process.env.FACEBOOK_CLIENT_SECRET;
|
facebookLoginEnabled:
|
||||||
const openidLoginEnabled =
|
!!process.env.FACEBOOK_CLIENT_ID && !!process.env.FACEBOOK_CLIENT_SECRET,
|
||||||
|
openidLoginEnabled:
|
||||||
!!process.env.OPENID_CLIENT_ID &&
|
!!process.env.OPENID_CLIENT_ID &&
|
||||||
!!process.env.OPENID_CLIENT_SECRET &&
|
!!process.env.OPENID_CLIENT_SECRET &&
|
||||||
!!process.env.OPENID_ISSUER &&
|
!!process.env.OPENID_ISSUER &&
|
||||||
!!process.env.OPENID_SESSION_SECRET;
|
!!process.env.OPENID_SESSION_SECRET,
|
||||||
const openidLabel = process.env.OPENID_BUTTON_LABEL || 'Login with OpenID';
|
openidLabel: process.env.OPENID_BUTTON_LABEL || 'Login with OpenID',
|
||||||
const openidImageUrl = process.env.OPENID_IMAGE_URL;
|
openidImageUrl: process.env.OPENID_IMAGE_URL,
|
||||||
const githubLoginEnabled = !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET;
|
githubLoginEnabled: !!process.env.GITHUB_CLIENT_ID && !!process.env.GITHUB_CLIENT_SECRET,
|
||||||
const discordLoginEnabled =
|
discordLoginEnabled: !!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET,
|
||||||
!!process.env.DISCORD_CLIENT_ID && !!process.env.DISCORD_CLIENT_SECRET;
|
serverDomain: process.env.DOMAIN_SERVER || 'http://localhost:3080',
|
||||||
const serverDomain = process.env.DOMAIN_SERVER || 'http://localhost:3080';
|
registrationEnabled: isEnabled(process.env.ALLOW_REGISTRATION),
|
||||||
const registrationEnabled = isEnabled(process.env.ALLOW_REGISTRATION);
|
socialLoginEnabled: isEnabled(process.env.ALLOW_SOCIAL_LOGIN),
|
||||||
const socialLoginEnabled = isEnabled(process.env.ALLOW_SOCIAL_LOGIN);
|
emailEnabled:
|
||||||
const checkBalance = isEnabled(process.env.CHECK_BALANCE);
|
!process.env.EMAIL_SERVICE &&
|
||||||
const emailEnabled =
|
|
||||||
!!process.env.EMAIL_SERVICE &&
|
|
||||||
!!process.env.EMAIL_USERNAME &&
|
!!process.env.EMAIL_USERNAME &&
|
||||||
!!process.env.EMAIL_PASSWORD &&
|
!!process.env.EMAIL_PASSWORD &&
|
||||||
!!process.env.EMAIL_FROM;
|
!!process.env.EMAIL_FROM,
|
||||||
|
checkBalance: isEnabled(process.env.CHECK_BALANCE),
|
||||||
|
};
|
||||||
|
|
||||||
return res.status(200).send({
|
if (typeof process.env.CUSTOM_FOOTER === 'string') {
|
||||||
appTitle,
|
payload.customFooter = process.env.CUSTOM_FOOTER;
|
||||||
googleLoginEnabled,
|
}
|
||||||
facebookLoginEnabled,
|
|
||||||
openidLoginEnabled,
|
return res.status(200).send(payload);
|
||||||
openidLabel,
|
|
||||||
openidImageUrl,
|
|
||||||
githubLoginEnabled,
|
|
||||||
discordLoginEnabled,
|
|
||||||
serverDomain,
|
|
||||||
registrationEnabled,
|
|
||||||
socialLoginEnabled,
|
|
||||||
emailEnabled,
|
|
||||||
checkBalance,
|
|
||||||
});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return res.status(500).send({ error: err.message });
|
return res.status(500).send({ error: err.message });
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ export default function Footer() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="hidden px-3 pb-1 pt-2 text-center text-xs text-black/50 dark:text-white/50 md:block md:px-4 md:pb-4 md:pt-3">
|
<div className="hidden px-3 pb-1 pt-2 text-center text-xs text-black/50 dark:text-white/50 md:block md:px-4 md:pb-4 md:pt-3">
|
||||||
|
{typeof config?.customFooter === 'string' ? (
|
||||||
|
config.customFooter
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<a
|
<a
|
||||||
href="https://github.com/danny-avila/LibreChat"
|
href="https://github.com/danny-avila/LibreChat"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|
@ -17,6 +21,8 @@ export default function Footer() {
|
||||||
{config?.appTitle || 'LibreChat'} v0.6.0
|
{config?.appTitle || 'LibreChat'} v0.6.0
|
||||||
</a>
|
</a>
|
||||||
{' - '}. {localize('com_ui_pay_per_call')}
|
{' - '}. {localize('com_ui_pay_per_call')}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ export type TStartupConfig = {
|
||||||
socialLoginEnabled: boolean;
|
socialLoginEnabled: boolean;
|
||||||
emailEnabled: boolean;
|
emailEnabled: boolean;
|
||||||
checkBalance: boolean;
|
checkBalance: boolean;
|
||||||
|
customFooter?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TRefreshTokenResponse = {
|
export type TRefreshTokenResponse = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue