Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/openfang-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ hmac = { workspace = true }
hex = { workspace = true }
socket2 = { workspace = true }
reqwest = { workspace = true }
qrcode = "0.14"

[dev-dependencies]
tokio-test = { workspace = true }
Expand Down
18 changes: 18 additions & 0 deletions crates/openfang-api/src/channel_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use openfang_channels::messenger::MessengerAdapter;
use openfang_channels::reddit::RedditAdapter;
use openfang_channels::revolt::RevoltAdapter;
use openfang_channels::viber::ViberAdapter;
use openfang_channels::wechat::WeChatAdapter;
// Wave 4
use openfang_channels::flock::FlockAdapter;
use openfang_channels::guilded::GuildedAdapter;
Expand Down Expand Up @@ -784,6 +785,7 @@ impl ChannelBridgeHandle for KernelBridgeAdapter {
"mastodon" => channels.mastodon.as_ref().map(|c| c.overrides.clone()),
"bluesky" => channels.bluesky.as_ref().map(|c| c.overrides.clone()),
"feishu" => channels.feishu.as_ref().map(|c| c.overrides.clone()),
"wechat" => channels.wechat.as_ref().map(|c| c.overrides.clone()),
"revolt" => channels.revolt.as_ref().map(|c| c.overrides.clone()),
// Wave 4
"nextcloud" => channels.nextcloud.as_ref().map(|c| c.overrides.clone()),
Expand Down Expand Up @@ -1093,6 +1095,7 @@ pub async fn start_channel_bridge_with_config(
|| config.mastodon.is_some()
|| config.bluesky.is_some()
|| config.feishu.is_some()
|| config.wechat.is_some()
|| config.revolt.is_some()
// Wave 4
|| config.nextcloud.is_some()
Expand Down Expand Up @@ -1445,6 +1448,20 @@ pub async fn start_channel_bridge_with_config(
}
}

// WeChat iLink
if let Some(ref wc_config) = config.wechat {
let adapter = Arc::new(WeChatAdapter::new(
wc_config.bot_token_env.clone(),
wc_config.account_id_env.clone(),
wc_config.user_id_env.clone(),
wc_config.allowed_users.clone(),
wc_config.api_base_url.clone(),
wc_config.cdn_base_url.clone(),
wc_config.state_dir.clone(),
));
adapters.push((adapter, wc_config.default_agent.clone()));
}

// Revolt
if let Some(ref rv_config) = config.revolt {
if let Some(token) = read_token(&rv_config.bot_token_env, "Revolt") {
Expand Down Expand Up @@ -1854,6 +1871,7 @@ mod tests {
assert!(config.channels.mastodon.is_none());
assert!(config.channels.bluesky.is_none());
assert!(config.channels.feishu.is_none());
assert!(config.channels.wechat.is_none());
assert!(config.channels.revolt.is_none());
// Wave 4
assert!(config.channels.nextcloud.is_none());
Expand Down
Loading