mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 00:17:45 +08:00
feat: 重要通知模块、Server 酱独立配置与额度提醒
- 新增重要通知统一模块(邮件 + Server 酱)作为后台任务通知出口
- 拆出独立的 Server 酱 配置页(SendKey + Markdown 模板,支持 {title}/{body} 变量替换),通过仪表盘内置工具入口进入
- 新增提供商额度提醒后台 worker:余额低于阈值时通过重要通知推送,提供商配置页加入额度提醒开关与阈值
- 重要通知页加入配置可用性守卫:未配置任一通道时禁用总开关,未配置邮件/SendKey 时禁用对应通道开关
- 测试通知端点支持 channel 过滤(all/email/server_chan),并绕过总开关与通道开关,便于配置阶段先验证通道
- 修复:测试通知路由未在 buffered-body 白名单导致 channel 参数丢失、测试时邮件分支被误触发
- 修复:sub2api 验证响应中 username 为 null 时正确回退到 email,避免误报"验证响应缺少: 用户信息"
Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
d51b44d642
commit
6c16f399d4
@@ -754,6 +754,14 @@ async fn gateway_handles_admin_modules_status_locally_with_trusted_admin_princip
|
||||
.with_system_config_values_for_tests(vec![
|
||||
("module.oauth.enabled".to_string(), json!(true)),
|
||||
("module.management_tokens.enabled".to_string(), json!(true)),
|
||||
(
|
||||
"module.important_notification.email_enabled".to_string(),
|
||||
json!(true),
|
||||
),
|
||||
(
|
||||
"module.important_notification.email_recipients".to_string(),
|
||||
json!("[email protected]"),
|
||||
),
|
||||
("smtp_host".to_string(), json!("smtp.example.com")),
|
||||
("smtp_from_email".to_string(), json!("[email protected]")),
|
||||
]);
|
||||
@@ -796,9 +804,13 @@ async fn gateway_handles_admin_modules_status_locally_with_trusted_admin_princip
|
||||
"/admin/modules/chat-pii-redaction"
|
||||
);
|
||||
assert_eq!(
|
||||
payload["notification_email"]["config_validated"],
|
||||
payload["important_notification"]["config_validated"],
|
||||
json!(true)
|
||||
);
|
||||
assert_eq!(
|
||||
payload["important_notification"]["admin_route"],
|
||||
"/admin/modules/important-notification"
|
||||
);
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
gateway_handle.abort();
|
||||
@@ -828,6 +840,14 @@ async fn gateway_handles_admin_modules_status_locally_with_bearer_admin_session(
|
||||
.with_system_config_values_for_tests(vec![
|
||||
("module.oauth.enabled".to_string(), json!(true)),
|
||||
("module.management_tokens.enabled".to_string(), json!(true)),
|
||||
(
|
||||
"module.important_notification.email_enabled".to_string(),
|
||||
json!(true),
|
||||
),
|
||||
(
|
||||
"module.important_notification.email_recipients".to_string(),
|
||||
json!("[email protected]"),
|
||||
),
|
||||
("smtp_host".to_string(), json!("smtp.example.com")),
|
||||
("smtp_from_email".to_string(), json!("[email protected]")),
|
||||
]);
|
||||
@@ -855,7 +875,7 @@ async fn gateway_handles_admin_modules_status_locally_with_bearer_admin_session(
|
||||
assert_eq!(payload["oauth"]["config_validated"], json!(true));
|
||||
assert_eq!(payload["management_tokens"]["active"], json!(true));
|
||||
assert_eq!(
|
||||
payload["notification_email"]["config_validated"],
|
||||
payload["important_notification"]["config_validated"],
|
||||
json!(true)
|
||||
);
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
Reference in New Issue
Block a user