mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
fix: make /get/ui_theme_settings public for all users to access custom branding
This commit is contained in:
parent
fd1a986596
commit
382614911f
2 changed files with 23 additions and 22 deletions
|
|
@ -539,13 +539,15 @@ async def update_sso_settings(sso_config: SSOConfig):
|
|||
@router.get(
|
||||
"/get/ui_theme_settings",
|
||||
tags=["UI Theme Settings"],
|
||||
dependencies=[Depends(user_api_key_auth)],
|
||||
response_model=UIThemeSettingsResponse,
|
||||
)
|
||||
async def get_ui_theme_settings():
|
||||
"""
|
||||
Get UI theme configuration from the litellm_settings.
|
||||
Returns current logo settings for UI customization.
|
||||
|
||||
Note: This endpoint is public (no authentication required) so all users can see custom branding.
|
||||
Only the /update/ui_theme_settings endpoint requires authentication for admins to change settings.
|
||||
"""
|
||||
from litellm.proxy.proxy_server import proxy_config
|
||||
|
||||
|
|
|
|||
|
|
@ -25,34 +25,33 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, accessTo
|
|||
const [logoUrl, setLogoUrl] = useState<string | null>(null);
|
||||
|
||||
// Load logo URL from backend on mount
|
||||
// Note: /get/ui_theme_settings is now a public endpoint (no auth required)
|
||||
// so all users can see custom branding set by admins
|
||||
useEffect(() => {
|
||||
const loadLogoSettings = async () => {
|
||||
if (accessToken) {
|
||||
try {
|
||||
const proxyBaseUrl = getProxyBaseUrl();
|
||||
const url = proxyBaseUrl ? `${proxyBaseUrl}/get/ui_theme_settings` : '/get/ui_theme_settings';
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${accessToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
if (data.values?.logo_url) {
|
||||
setLogoUrl(data.values.logo_url);
|
||||
}
|
||||
try {
|
||||
const proxyBaseUrl = getProxyBaseUrl();
|
||||
const url = proxyBaseUrl ? `${proxyBaseUrl}/get/ui_theme_settings` : '/get/ui_theme_settings';
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
if (data.values?.logo_url) {
|
||||
setLogoUrl(data.values.logo_url);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load logo settings from backend:', error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('Failed to load logo settings from backend:', error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
loadLogoSettings();
|
||||
}, [accessToken]);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ logoUrl, setLogoUrl }}>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue