feat(datasource): add WeCom document integration and callback setup
- Implemented WeCom document connector to sync smart documents and WeDrive files into WeKnora. - Added detailed documentation for WeCom integration, including setup instructions for callback URL and API access. - Enhanced frontend localization to support WeCom-specific messages and instructions. - Updated data source management UI to include WeCom configuration options and callback URL handling. - Improved error handling and validation for WeCom API interactions.
This commit is contained in:
@@ -61,6 +61,7 @@ type RouterParams struct {
|
||||
OrganizationHandler *handler.OrganizationHandler
|
||||
IMHandler *handler.IMHandler
|
||||
DataSourceHandler *handler.DataSourceHandler
|
||||
WecomCallbackHandler *handler.WecomCallbackHandler
|
||||
}
|
||||
|
||||
// NewRouter 创建新的路由
|
||||
@@ -109,6 +110,9 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
// IM 回调路由(在认证中间件之前注册,使用各平台自身的签名验证)
|
||||
RegisterIMRoutes(r, params.IMHandler)
|
||||
|
||||
// WeCom callback verification (before auth — WeCom uses its own signature)
|
||||
RegisterWecomCallbackRoutes(r, params.WecomCallbackHandler)
|
||||
|
||||
// 认证中间件
|
||||
r.Use(middleware.Auth(params.TenantService, params.UserService, params.Config))
|
||||
|
||||
@@ -775,3 +779,10 @@ func RegisterDataSourceRoutes(r *gin.RouterGroup, handler *handler.DataSourceHan
|
||||
ds.GET("/logs/:log_id", handler.GetSyncLog)
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterWecomCallbackRoutes registers the WeCom callback verification route.
|
||||
// Must be registered BEFORE auth middleware since WeCom uses its own msg_signature verification.
|
||||
func RegisterWecomCallbackRoutes(r *gin.Engine, h *handler.WecomCallbackHandler) {
|
||||
r.GET("/api/v1/wecom/callback/:datasource_id", h.HandleCallback)
|
||||
r.POST("/api/v1/wecom/callback/:datasource_id", h.HandleCallback)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user