feat: add favicon configuration

This commit is contained in:
ShiYu
2025-10-28 11:01:46 +08:00
parent 51326dea08
commit 138296e5a6
6 changed files with 15 additions and 3 deletions

View File

@@ -37,10 +37,13 @@ async def get_all_config(
@router.get("/status")
async def get_system_status():
logo = await ConfigCenter.get("APP_LOGO", "/logo.svg")
favicon = await ConfigCenter.get("APP_FAVICON", logo)
system_info = {
"version": VERSION,
"title": await ConfigCenter.get("APP_NAME", "Foxel"),
"logo": await ConfigCenter.get("APP_LOGO", "/logo.svg"),
"logo": logo,
"favicon": favicon,
"is_initialized": await has_users(),
"app_domain": await ConfigCenter.get("APP_DOMAIN"),
"file_domain": await ConfigCenter.get("FILE_DOMAIN"),

View File

@@ -18,9 +18,14 @@ function AppInner() {
const status = await getStatus();
setStatus(status);
document.title = status.title;
const favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement;
let favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement | null;
if (!favicon) {
favicon = document.createElement('link');
favicon.rel = 'icon';
document.head.appendChild(favicon);
}
if (favicon) {
favicon.href = status.logo;
favicon.href = status.favicon || status.logo;
}
} catch (error) {
console.error("Failed to check initialization status:", error);

View File

@@ -19,6 +19,7 @@ export interface SystemStatus {
version: string;
title: string;
logo: string;
favicon: string;
is_initialized: boolean;
app_domain?: string;
file_domain?: string;

View File

@@ -328,6 +328,7 @@ export const en = {
'Clear Vector DB': 'Clear Vector DB',
'App Name': 'App Name',
'Logo URL': 'Logo URL',
'Favicon URL': 'Favicon URL',
'App Domain': 'App Domain',
'File Domain': 'File Domain',
'Vision API URL': 'Vision API URL',

View File

@@ -333,6 +333,7 @@ export const zh = {
'Clear Vector DB': '清空向量库',
'App Name': '应用名称',
'Logo URL': 'LOGO地址',
'Favicon URL': 'Favicon 地址',
'App Domain': '应用域名',
'File Domain': '文件域名',
'Vision API URL': '视觉模型 API 地址',

View File

@@ -26,6 +26,7 @@ interface SystemSettingsPageProps {
const APP_CONFIG_KEYS: { key: string, label: string, default?: string }[] = [
{ key: 'APP_NAME', label: 'App Name' },
{ key: 'APP_LOGO', label: 'Logo URL' },
{ key: 'APP_FAVICON', label: 'Favicon URL', default: '/logo.svg' },
{ key: 'APP_DOMAIN', label: 'App Domain' },
{ key: 'FILE_DOMAIN', label: 'File Domain' },
];