主题系统从带数据库/事务/repo 层/远程下载/配置管理/主题市场的重型架构, 彻底简化为纯文件系统操作: 后端: - 主题数据全部存放在 data/themes/ 目录,不经过数据库 - 删除主题配置功能(managed/raw/redirect schema、配置存取 API、 ThemeConfiguration model、theme_configurations 表、repo 层) - 删除远程下载(URL 安装、GitHub Release 更新、SSRF 防护、SHA-256) - 删除版本范围检查(semver 解析/比较/匹配、pikaVersion 校验) - 删除主题市场 - ThemeService 不再持有 db,合并为 theme.go + theme_util.go 两个文件 - 主题类型从 models 包移到 service 包(非数据库模型) - 保留:ZIP 上传解压(含目录穿越防护)、目录扫描列表、启用/删除、 覆盖安装、默认主题回退、启动恢复、入口 HTML 渲染缓存 前端 portal(官方默认主题): - 从 47 个碎片文件精简到 15 个,按标准目录组织 - 删除 theme-sdk 包,API 客户端和类型内联回 portal,完全自包含 - 按职责拆分:types.ts / api.ts / constants.ts / lib/utils.ts / contexts/ColorMode.tsx / hooks/index.ts / components.tsx / pages/ - 每个页面一个文件,图表和子组件内联,fork 二开只需看一个文件
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
database:
|
|
enabled: true
|
|
type: postgres
|
|
postgres:
|
|
hostname: pika-postgresql
|
|
port: 5432
|
|
username: pika
|
|
password: pika
|
|
database: pika
|
|
show_sql: false
|
|
log:
|
|
level: debug # 日志等级 debug,info,waring,error
|
|
filename: ./logs/pika.log
|
|
|
|
server:
|
|
addr: "0.0.0.0:8080"
|
|
ip_extractor: "x-forwarded-for"
|
|
ip_trust_list:
|
|
- "0.0.0.0/0"
|
|
|
|
App:
|
|
# 主题文件存储在数据库之外,Docker 部署必须持久化 /app/data。
|
|
Theme:
|
|
Dir: "./data/themes"
|
|
|
|
JWT:
|
|
Secret: "" # 替换为任意 UUID 字符串
|
|
ExpiresHours: 168 # 7天
|
|
|
|
# Basic Auth 用户配置(使用 bcrypt 加密)
|
|
# 生成密码命令: htpasswd -nBC 12 '' | tr -d ':\n'
|
|
# 或使用 Go: bcrypt.GenerateFromPassword([]byte("your_password"), bcrypt.DefaultCost)
|
|
Users:
|
|
admin: "$2y$12$7DXcOiX1D59xNTIn5riUKusAPLP88LxxoczWmUT83MBj5EFznbp8a" # 默认密码: admin123
|
|
|
|
# OIDC 认证配置(可选)
|
|
OIDC:
|
|
Enabled: false
|
|
Issuer: "https://your-oidc-provider.com"
|
|
ClientID: "your-client-id"
|
|
ClientSecret: "your-client-secret"
|
|
RedirectURL: "http://localhost:8080/admin/oidc/callback" # 前端回调页面
|
|
|
|
# GitHub OAuth 认证配置(可选)
|
|
# 创建 GitHub OAuth App: https://github.com/settings/developers
|
|
GitHub:
|
|
Enabled: false
|
|
ClientID: "your-github-client-id"
|
|
ClientSecret: "your-github-client-secret"
|
|
RedirectURL: "http://localhost:8080/admin/github/callback" # 前端回调页面
|
|
AllowedUsers: # 允许登录的 GitHub 用户名白名单,不配置或留空则允许所有用户
|
|
- "your-github-username"
|
|
- "another-username"
|
|
GeoIP:
|
|
Enabled: false
|
|
DBPath: "./GeoLite2-City.mmdb"
|
|
VictoriaMetrics:
|
|
Enabled: true
|
|
URL: "http://victoriametrics:8428"
|
|
RetentionDays: 7 # 数据保留时长
|
|
WriteTimeout: 60 # 写超时时间(秒)
|
|
QueryTimeout: 60 # 读超时时间(秒)
|