mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 10:57:03 +08:00
feat: 支持系统设置中自定义全站名称和副标题
新增 site_name 和 site_subtitle 两个系统配置项,允许管理员在后台自定义 站点品牌名称(默认 Aether)和副标题(默认 AI Gateway)。 - 后端:DEFAULT_CONFIGS 新增配置项,公开 /api/public/site-info 端点 - 后端:邮件发送 app_name 回退链增加 site_name - 前端:新增 useSiteInfo composable 全局缓存站点信息 - 前端:首页、后台布局、登录页、指南页面全部改为动态读取 - 前端:系统设置页新增「站点信息」配置区块 - 前端:配置导出文件名跟随站点名称 - 优化:请求失败允许重试,保存后即时生效无需刷新页面 - 优化:document.title 随站点名称动态更新 Closes #176 Co-authored-by: LewisPen <[email protected]>
This commit is contained in:
@@ -39,11 +39,21 @@ from src.models.endpoint_models import (
|
||||
PublicHealthEvent,
|
||||
)
|
||||
from src.services.health.endpoint import EndpointHealthService
|
||||
from src.services.system.config import SystemConfigService
|
||||
|
||||
router = APIRouter(prefix="/api/public", tags=["System Catalog"])
|
||||
pipeline = ApiRequestPipeline()
|
||||
|
||||
|
||||
@router.get("/site-info")
|
||||
def get_site_info(db: Session = Depends(get_db)) -> dict[str, str]:
|
||||
"""获取站点基本信息(公开接口,无需认证)"""
|
||||
return {
|
||||
"site_name": SystemConfigService.get_config(db, "site_name", default="Aether"),
|
||||
"site_subtitle": SystemConfigService.get_config(db, "site_subtitle", default="AI Gateway"),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/providers", response_model=list[PublicProviderResponse])
|
||||
async def get_public_providers(
|
||||
request: Request,
|
||||
|
||||
@@ -130,8 +130,10 @@ class EmailSenderService:
|
||||
return False, error
|
||||
|
||||
# 生成邮件内容
|
||||
# 优先使用 email_app_name,否则回退到 smtp_from_name
|
||||
# 优先使用 email_app_name,否则回退到 site_name,最后回退到 smtp_from_name
|
||||
app_name = SystemConfigService.get_config(db, "email_app_name", default=None)
|
||||
if not app_name:
|
||||
app_name = SystemConfigService.get_config(db, "site_name", default=None)
|
||||
if not app_name:
|
||||
app_name = SystemConfigService.get_config(db, "smtp_from_name", default="Aether")
|
||||
|
||||
|
||||
@@ -85,6 +85,15 @@ class SystemConfigService:
|
||||
|
||||
# 默认配置
|
||||
DEFAULT_CONFIGS = {
|
||||
# 站点信息
|
||||
"site_name": {
|
||||
"value": "Aether",
|
||||
"description": "站点名称,显示在页面标题、导航栏、登录页面和邮件中",
|
||||
},
|
||||
"site_subtitle": {
|
||||
"value": "AI Gateway",
|
||||
"description": "站点副标题,显示在导航栏品牌名称下方",
|
||||
},
|
||||
REQUEST_RECORD_LEVEL_KEY: {
|
||||
"value": RequestRecordLevel.BASIC.value,
|
||||
"description": "请求记录级别:basic(基本信息), headers(含请求/响应头), full(完整请求/响应)",
|
||||
|
||||
Reference in New Issue
Block a user