fix: 调整路由顺序,修复静态文件被JWT拦截的问题

- 将 /static/{tail:.*} 路由移到受保护 scope 之前
- 确保静态文件无需认证即可访问
This commit is contained in:
2026-04-15 11:51:59 +08:00
parent 913a235e5c
commit a819a0db91
9 changed files with 728 additions and 678 deletions

View File

@@ -298,3 +298,24 @@ pub struct UpdatePaymentRequest {
pub is_paid: bool,
pub paid_expires_at: Option<String>, // ISO 8601 格式
}
// 应用状态结构体
#[derive(Clone)]
pub struct AppState {
pub jwt_secret: String,
pub wechat_appid: String,
pub wechat_secret: String,
}
impl AppState {
pub fn load() -> Result<Self, String> {
Ok(Self {
jwt_secret: std::env::var("JWT_SECRET")
.map_err(|_| "环境变量JWT_SECRET未设置".to_string())?,
wechat_appid: std::env::var("WECHAT_APPID")
.map_err(|_| "环境变量WECHAT_APPID未设置".to_string())?,
wechat_secret: std::env::var("WECHAT_SECRET")
.map_err(|_| "环境变量WECHAT_SECRET未设置".to_string())?,
})
}
}