feat(admin): 登录改页内弹窗 + P1 站点设置(页头/侧栏)
- 登录:LoginDialog(Modal)替代 /login 页面;/login 重定向回首页 - 设置接口:GET /api/settings 公开读、PATCH 需登录 + version 乐观锁(409/400) - setting 表存 site JSON:页头(启用/速度/条目+标签+色调)、侧栏(hidden/order) - /admin:Tabs 页头/侧栏,条目增删与上下移,保存后首页生效 - 首页应用设置:ticker 文本占位符与速度、侧栏顺序与显隐 - 测试 42 passed(settings 5 例)
This commit is contained in:
@@ -30,6 +30,10 @@ pub enum StashError {
|
||||
/// 统一收敛成一个变体,避免把 rusqlite 的类型泄漏到库的公开 API。
|
||||
#[error("数据库错误: {0}")]
|
||||
Database(String),
|
||||
|
||||
/// 乐观锁冲突:资源在本次编辑期间被别人改过。
|
||||
#[error("冲突: {0}")]
|
||||
Conflict(String),
|
||||
}
|
||||
|
||||
impl IntoResponse for StashError {
|
||||
@@ -37,6 +41,7 @@ impl IntoResponse for StashError {
|
||||
let (status, err_msg) = match self {
|
||||
StashError::NotFound(msg) => (StatusCode::NOT_FOUND, msg),
|
||||
StashError::InvalidDirectory(msg) => (StatusCode::BAD_REQUEST, msg),
|
||||
StashError::Conflict(msg) => (StatusCode::CONFLICT, msg),
|
||||
_ => (StatusCode::INTERNAL_SERVER_ERROR, self.to_string()),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user