mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Claude Opus 4.8
Steven Enamakel
parent
9198444ffd
commit
6ce4f52972
@@ -154,12 +154,9 @@ async fn serve_mock_backend() -> (
|
||||
let app = Router::new()
|
||||
.route("/auth/me", get(mock_auth_me))
|
||||
.route("/api/auth/me", get(mock_auth_me))
|
||||
.route("/auth/login-token/consume", post(mock_consume_login_token))
|
||||
.route(
|
||||
"/telegram/login-tokens/{token}/consume",
|
||||
post(mock_consume_login_token),
|
||||
)
|
||||
.route(
|
||||
"/api/telegram/login-tokens/{token}/consume",
|
||||
"/api/auth/login-token/consume",
|
||||
post(mock_consume_login_token),
|
||||
)
|
||||
.route(
|
||||
@@ -370,11 +367,17 @@ async fn static_auth_me(
|
||||
}))
|
||||
}
|
||||
|
||||
async fn mock_consume_login_token(AxumPath(token): AxumPath<String>) -> Json<Value> {
|
||||
async fn mock_consume_login_token(Json(body): Json<Value>) -> Json<Value> {
|
||||
// Token now arrives in the JSON body (`{ token }`), not the URL path, and the
|
||||
// response field is `jwt` (matches backend `routes/auth.ts`).
|
||||
let token = body
|
||||
.get("token")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or_default();
|
||||
Json(json!({
|
||||
"success": true,
|
||||
"data": {
|
||||
"jwtToken": format!("jwt-from-{token}")
|
||||
"jwt": format!("jwt-from-{token}")
|
||||
}
|
||||
}))
|
||||
}
|
||||
@@ -2106,6 +2109,7 @@ async fn config_save_and_load_encrypts_channel_secret_fields() {
|
||||
config.search.querit.api_key = Some("querit-secret".into());
|
||||
config.channels_config.telegram = Some(TelegramConfig {
|
||||
bot_token: "telegram-secret".into(),
|
||||
chat_id: None,
|
||||
allowed_users: vec!["alice".into()],
|
||||
stream_mode: Default::default(),
|
||||
draft_update_interval_ms: 1000,
|
||||
|
||||
@@ -77,6 +77,7 @@ async fn config_secrets_roundtrip_via_keyring_backed_master_key_migration() {
|
||||
channels_config: openhuman_core::openhuman::config::schema::ChannelsConfig {
|
||||
telegram: Some(TelegramConfig {
|
||||
bot_token: "tg-bot-secret".into(),
|
||||
chat_id: None,
|
||||
allowed_users: vec!["alice".into()],
|
||||
stream_mode: StreamMode::default(),
|
||||
draft_update_interval_ms: 1000,
|
||||
|
||||
@@ -74,6 +74,7 @@ async fn config_secrets_create_master_key_in_keyring_on_fresh_install() {
|
||||
channels_config: openhuman_core::openhuman::config::schema::ChannelsConfig {
|
||||
telegram: Some(TelegramConfig {
|
||||
bot_token: "fresh-tg-secret".into(),
|
||||
chat_id: None,
|
||||
allowed_users: vec!["bob".into()],
|
||||
stream_mode: StreamMode::default(),
|
||||
draft_update_interval_ms: 1000,
|
||||
|
||||
@@ -252,6 +252,13 @@ impl Channel for CapturingChannel {
|
||||
"capture"
|
||||
}
|
||||
|
||||
// External channel exposes a proactive delivery target so the proactive
|
||||
// router resolves a recipient for it (#3794 — recipient-less proactive sends
|
||||
// are skipped for channels that return `None`).
|
||||
fn proactive_target(&self) -> Option<String> {
|
||||
Some("capture".to_string())
|
||||
}
|
||||
|
||||
async fn send(&self, message: &SendMessage) -> Result<()> {
|
||||
self.sent
|
||||
.lock()
|
||||
@@ -2207,7 +2214,9 @@ async fn proactive_subscriber_routes_web_and_active_external_channel_without_net
|
||||
let sent = capture.sent.lock().expect("capture lock").clone();
|
||||
assert_eq!(sent.len(), 1);
|
||||
assert_eq!(sent[0].content, "send through active external channel");
|
||||
assert_eq!(sent[0].recipient, "");
|
||||
// Recipient is now resolved from the channel's proactive_target (#3794),
|
||||
// rather than the previously-empty recipient.
|
||||
assert_eq!(sent[0].recipient, "capture");
|
||||
|
||||
subscriber.set_active_channel(Some("web".into()));
|
||||
subscriber
|
||||
|
||||
Reference in New Issue
Block a user