fix(channel): add wechatoa webhook delivery and proxy config (#356)

Unify webhook handling across channel adapters and add the WeChat Official Account channel so inbound routing and replies work without platform-specific handlers. Add adapter-scoped proxy support and stable config field ordering so restricted network environments can deliver WeChat and Telegram messages reliably.
This commit is contained in:
BBQ
2026-04-10 21:26:11 +08:00
committed by GitHub
parent 4d3f2de7e2
commit f376a2abe3
47 changed files with 2361 additions and 315 deletions
+10 -1
View File
@@ -81,7 +81,7 @@ func shouldSkipJWT(path string) bool {
if strings.HasPrefix(path, "/api/docs") {
return true
}
if strings.HasPrefix(path, "/channels/feishu/webhook/") {
if isPublicChannelWebhookPath(path) {
return true
}
if strings.HasPrefix(path, "/email/mailgun/webhook/") {
@@ -98,3 +98,12 @@ func shouldSkipJWT(path string) bool {
}
return false
}
func isPublicChannelWebhookPath(path string) bool {
if !strings.HasPrefix(path, "/channels/") {
return false
}
trimmed := strings.Trim(strings.TrimPrefix(path, "/channels/"), "/")
parts := strings.Split(trimmed, "/")
return len(parts) >= 3 && strings.TrimSpace(parts[0]) != "" && parts[1] == "webhook" && strings.TrimSpace(parts[2]) != ""
}
+2 -1
View File
@@ -2,7 +2,7 @@ package server
import "testing"
func TestShouldSkipJWT_FeishuWebhookPaths(t *testing.T) {
func TestShouldSkipJWT_ChannelWebhookPaths(t *testing.T) {
t.Parallel()
cases := []struct {
@@ -10,6 +10,7 @@ func TestShouldSkipJWT_FeishuWebhookPaths(t *testing.T) {
want bool
}{
{path: "/channels/feishu/webhook/cfg-1", want: true},
{path: "/channels/wechatoa/webhook/cfg-1", want: true},
{path: "/channels/feishu/webhook", want: false},
{path: "/api/channels/feishu/webhook", want: false},
}