Documentation
¶
Overview ¶
wechat_qr.go implements the Weixin QR-login HTTP session flow.
Index ¶
- func RegisterAccessRoutes(router *swagger.RouteGroup, h *Handler)
- func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
- type AuthorizeCheckRequest
- type AuthorizeCheckResponse
- type BlockedUpdateRequest
- type BotManager
- func (bm *BotManager) ChatStore() (bot.ChatStoreInterface, error)
- func (bm *BotManager) GetStatus() []BotStatus
- func (bm *BotManager) GetStore() *db.ImBotSettingsStore
- func (bm *BotManager) GetTBClient() tbclient.TBClient
- func (bm *BotManager) IsRunning(uuid string) bool
- func (bm *BotManager) PairingManager() *bot.PairingManager
- func (bm *BotManager) RestartBot(ctx context.Context, uuid string) error
- func (bm *BotManager) Shutdown()
- func (bm *BotManager) StartAllEnabled(ctx context.Context) error
- func (bm *BotManager) StartBot(ctx context.Context, uuid string) error
- func (bm *BotManager) StopAll()
- func (bm *BotManager) StopBot(uuid string) error
- func (bm *BotManager) Sync(ctx context.Context) error
- type BotStatus
- type CapabilityListResponse
- type CapabilityUpdateRequest
- type CapabilityUpdateResponse
- type CreateRequest
- type DeleteResponse
- type DirectChatDetailResponse
- type DirectChatListResponse
- type FeishuRegHandler
- type FeishuRegStartData
- type FeishuRegStartRequest
- type FeishuRegStartResponse
- type FeishuRegStatusData
- type FeishuRegStatusResponse
- type GroupActorPutRequest
- type GroupActorsResponse
- type GroupDetailResponse
- type GroupListResponse
- type Handler
- func (h *Handler) AuthorizeDirectChat(c *gin.Context)
- func (h *Handler) AuthorizeGroup(c *gin.Context)
- func (h *Handler) ChatStore() (bot.ChatStoreInterface, error)
- func (h *Handler) CreateRoute(c *gin.Context)
- func (h *Handler) CreateSettings(c *gin.Context)
- func (h *Handler) DeleteDirectChat(c *gin.Context)
- func (h *Handler) DeleteGroup(c *gin.Context)
- func (h *Handler) DeleteGroupActor(c *gin.Context)
- func (h *Handler) DeleteRoute(c *gin.Context)
- func (h *Handler) DeleteSettings(c *gin.Context)
- func (h *Handler) GetDirectChat(c *gin.Context)
- func (h *Handler) GetGroup(c *gin.Context)
- func (h *Handler) GetPairingCode(c *gin.Context)
- func (h *Handler) GetPlatformConfig(c *gin.Context)
- func (h *Handler) GetPlatforms(c *gin.Context)
- func (h *Handler) GetRoute(c *gin.Context)
- func (h *Handler) GetSettings(c *gin.Context)
- func (h *Handler) ListCapabilities(c *gin.Context)
- func (h *Handler) ListDirectChats(c *gin.Context)
- func (h *Handler) ListGroupActors(c *gin.Context)
- func (h *Handler) ListGroups(c *gin.Context)
- func (h *Handler) ListRoutes(c *gin.Context)
- func (h *Handler) ListSettings(c *gin.Context)
- func (h *Handler) PutCapability(c *gin.Context)
- func (h *Handler) PutDirectChatBlocked(c *gin.Context)
- func (h *Handler) PutDirectChatPermission(c *gin.Context)
- func (h *Handler) PutDirectChatPermissions(c *gin.Context)
- func (h *Handler) PutGroupActor(c *gin.Context)
- func (h *Handler) PutGroupActorPermission(c *gin.Context)
- func (h *Handler) PutGroupBlocked(c *gin.Context)
- func (h *Handler) PutGroupCapability(c *gin.Context)
- func (h *Handler) Reload(c *gin.Context)
- func (h *Handler) RestartBot(c *gin.Context)
- func (h *Handler) RestartBotByUUID(ctx context.Context, uuid string) error
- func (h *Handler) RotatePairingCode(c *gin.Context)
- func (h *Handler) Shutdown()
- func (h *Handler) StartAllEnabled(ctx context.Context) error
- func (h *Handler) StopAll()
- func (h *Handler) Sync(ctx context.Context) error
- func (h *Handler) ToggleSettings(c *gin.Context)
- func (h *Handler) UnpairDirectChat(c *gin.Context)
- func (h *Handler) UpdateRoute(c *gin.Context)
- func (h *Handler) UpdateSettings(c *gin.Context)
- type LifecycleController
- type ListResponse
- type OKResponse
- type PairingCodeResponse
- type PermissionUpdateRequest
- type PermissionWrite
- type PermissionsUpdateRequest
- type PlatformConfig
- type PlatformConfigResponse
- type PlatformsResponse
- type QRStartData
- type QRStartRequest
- type QRStartResponse
- type QRStatusData
- type QRStatusResponse
- type RouteListResponse
- type RouteResponse
- type RouteTargetRequest
- type RouteWriteRequest
- type SettingsResponse
- type ToggleResponse
- type UpdateRequest
- type WeChatQRLoginHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAccessRoutes ¶ added in v0.260806.1
func RegisterAccessRoutes(router *swagger.RouteGroup, h *Handler)
func RegisterRoutes ¶
func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)
RegisterRoutes registers all ImBot settings routes with swagger documentation
Types ¶
type AuthorizeCheckRequest ¶ added in v0.260806.1
type AuthorizeCheckRequest struct {
ActorID string `json:"actor_id,omitempty"`
Capability access.CapabilityName `json:"capability"`
Action access.ActionName `json:"action"`
RouteID string `json:"route_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
}
type AuthorizeCheckResponse ¶ added in v0.260806.1
type AuthorizeCheckResponse struct {
Decision access.AuthorizationDecision `json:"decision"`
}
type BlockedUpdateRequest ¶ added in v0.260806.1
type BlockedUpdateRequest struct {
Blocked *bool `json:"blocked"`
}
type BotManager ¶
type BotManager struct {
// contains filtered or unexported fields
}
BotManager manages the lifecycle of ImBot instances. It encapsulates the internal bot.Manager and provides a clean interface for the imbotsettings module to control bot lifecycle.
func NewBotManager ¶
func NewBotManager(ctx context.Context, cfg *config.Config, channelRegistry *channel.Registry) (*BotManager, error)
NewBotManager creates a new BotManager with all required dependencies. channelRegistry is wired into the internal bot.Manager before the background sync loop starts (see below) so every bot it brings up — including bots enabled before the server started — registers itself as a remote.channel.Channel. Passing it here rather than through a later SetChannelRegistry call closes a startup race: periodicBotSync's initial sync runs in its own goroutine immediately after construction, and used to be able to Start() bots before a subsequent SetChannelRegistry call landed, permanently starting them with no channel (Claude Code hooks and the bot interaction API would then find "bot not running" for a bot that was, in fact, running). channelRegistry may be nil (e.g. swagger doc generation, which never drives real chats).
func (*BotManager) ChatStore ¶ added in v0.260801.1
func (bm *BotManager) ChatStore() (bot.ChatStoreInterface, error)
ChatStore returns the chat store shared by every running bot.
The store is owned by the StoreManager and must NOT be closed by callers: closing it would pull persistence out from under every running bot. Used by the GET /bots/:bot/chats API to list the chats a bot can reach (so callers of /notify and /interact can discover the channel-native chat_id those endpoints require).
func (*BotManager) GetStatus ¶
func (bm *BotManager) GetStatus() []BotStatus
GetStatus returns the status of all configured bots.
func (*BotManager) GetStore ¶
func (bm *BotManager) GetStore() *db.ImBotSettingsStore
GetStore returns the underlying settings store.
func (*BotManager) GetTBClient ¶
func (bm *BotManager) GetTBClient() tbclient.TBClient
GetTBClient returns the TBClient for SmartGuide model configuration.
func (*BotManager) IsRunning ¶
func (bm *BotManager) IsRunning(uuid string) bool
IsRunning checks if a bot is currently running.
func (*BotManager) PairingManager ¶ added in v0.260514.1
func (bm *BotManager) PairingManager() *bot.PairingManager
PairingManager returns the underlying TOFU pairing manager for HTTP/CLI handlers that need to mint, read, or rotate pairing codes.
func (*BotManager) RestartBot ¶ added in v0.260514.1
func (bm *BotManager) RestartBot(ctx context.Context, uuid string) error
RestartBot stops a single bot and starts it again, preserving its UUID. Useful for recovering from a panic-isolated bot or applying configuration changes without restarting the whole server. Waits for the stop to fully complete (up to 5s via WaitForStop in StopBot) before starting again so the new instance does not race with the old goroutine.
func (*BotManager) Shutdown ¶
func (bm *BotManager) Shutdown()
Shutdown stops all running bots and cleans up resources.
func (*BotManager) StartAllEnabled ¶
func (bm *BotManager) StartAllEnabled(ctx context.Context) error
StartAllEnabled starts all bots that have enabled: true in their settings. Logs errors for individual bots but continues starting others.
func (*BotManager) StartBot ¶
func (bm *BotManager) StartBot(ctx context.Context, uuid string) error
StartBot starts a single bot by UUID. If the bot is already running, this is a no-op.
func (*BotManager) StopBot ¶
func (bm *BotManager) StopBot(uuid string) error
StopBot stops a single bot by UUID. If the bot is not running, this is a no-op. Waits up to 5 seconds for the bot to fully stop before returning.
type BotStatus ¶
type BotStatus struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Platform string `json:"platform"`
Running bool `json:"running"`
Error string `json:"error,omitempty"`
}
BotStatus represents the runtime status of a bot.
type CapabilityListResponse ¶ added in v0.260806.1
type CapabilityListResponse struct {
Capabilities []access.BotCapability `json:"capabilities"`
BotRunning bool `json:"bot_running"`
}
type CapabilityUpdateRequest ¶ added in v0.260806.1
type CapabilityUpdateRequest struct {
Enabled bool `json:"enabled"`
Config json.RawMessage `json:"config,omitempty"`
}
type CapabilityUpdateResponse ¶ added in v0.260806.1
type CapabilityUpdateResponse struct {
Capability access.BotCapability `json:"capability"`
BotRunning bool `json:"bot_running"`
Reason string `json:"reason,omitempty"`
}
type CreateRequest ¶
type CreateRequest struct {
UUID string `json:"uuid,omitempty"`
Name string `json:"name,omitempty"`
Platform string `json:"platform"`
AuthType string `json:"auth_type"`
Auth map[string]string `json:"auth"`
ProxyURL string `json:"proxy_url,omitempty"`
ChatID string `json:"chat_id_lock,omitempty"`
BashAllowlist []string `json:"bash_allowlist,omitempty"`
DefaultCwd string `json:"default_cwd,omitempty"` // Default working directory
DefaultAgent string `json:"default_agent,omitempty"` // Default Agent UUID
Enabled bool `json:"enabled"`
Token string `json:"token,omitempty"` // Legacy field
SmartGuideProvider string `json:"smartguide_provider,omitempty"` // Provider UUID
SmartGuideModel string `json:"smartguide_model,omitempty"` // Model identifier
RequirePairing *bool `json:"require_pairing,omitempty"` // TOFU pairing gate; nil → platform default
Capabilities map[access.CapabilityName]CapabilityUpdateRequest `json:"capabilities,omitempty"`
}
CreateRequest represents the request to create ImBot settings
type DeleteResponse ¶
DeleteResponse represents the response for delete operations
type DirectChatDetailResponse ¶ added in v0.260806.1
type DirectChatDetailResponse struct {
Chat access.DirectChat `json:"chat"`
Permissions []access.Permission `json:"permissions"`
}
type DirectChatListResponse ¶ added in v0.260806.1
type DirectChatListResponse struct {
Chats []DirectChatDetailResponse `json:"chats"`
}
type FeishuRegHandler ¶ added in v0.260531.1
type FeishuRegHandler struct {
// contains filtered or unexported fields
}
FeishuRegHandler drives the Feishu/Lark one-click app registration flow (OAuth 2.0 Device Authorization Grant, RFC 8628). The SDK's RegisterApp is a single blocking call that emits the QR link via a callback and then polls until the user authorizes, so it runs in a background goroutine while the HTTP layer exposes a start/status/cancel session model that mirrors the Weixin QR flow.
func NewFeishuRegHandler ¶ added in v0.260531.1
func NewFeishuRegHandler(settingsStore *db.ImBotSettingsStore) *FeishuRegHandler
NewFeishuRegHandler creates a new Feishu/Lark one-click registration handler.
func (*FeishuRegHandler) QRCancel ¶ added in v0.260531.1
func (h *FeishuRegHandler) QRCancel(c *gin.Context)
QRCancel cancels a pending registration session.
func (*FeishuRegHandler) QRStart ¶ added in v0.260531.1
func (h *FeishuRegHandler) QRStart(c *gin.Context)
QRStart initiates the one-click registration flow and returns the QR link.
func (*FeishuRegHandler) QRStatus ¶ added in v0.260531.1
func (h *FeishuRegHandler) QRStatus(c *gin.Context)
QRStatus reports the current state of the registration session.
type FeishuRegStartData ¶ added in v0.260531.1
type FeishuRegStartData struct {
QRURL string `json:"qr_url"` // Verification link; render as a QR code or open directly
ExpiresIn int `json:"expires_in"` // Link lifetime in seconds
}
FeishuRegStartData is the data for the registration start response.
type FeishuRegStartRequest ¶ added in v0.260531.1
type FeishuRegStartRequest struct {
BotUUID string `json:"bot_uuid" binding:"required"`
BotName string `json:"bot_name,omitempty"` // Optional: bot display name (for deferred creation)
BotPlatform string `json:"bot_platform,omitempty"` // Optional: "feishu" or "lark" (for deferred creation)
}
FeishuRegStartRequest is the request to start one-click app registration.
type FeishuRegStartResponse ¶ added in v0.260531.1
type FeishuRegStartResponse struct {
Success bool `json:"success"`
Data FeishuRegStartData `json:"data"`
Error string `json:"error,omitempty"`
}
FeishuRegStartResponse is the response for starting one-click registration.
type FeishuRegStatusData ¶ added in v0.260531.1
type FeishuRegStatusData struct {
Status string `json:"status"` // pending, confirmed, expired, denied, error
BotUUID string `json:"bot_uuid,omitempty"` // Real bot UUID after confirmed (may differ for deferred creation)
TenantBrand string `json:"tenant_brand,omitempty"` // "feishu" or "lark", reported by the SDK on confirmation
}
FeishuRegStatusData is the data for the registration status response.
type FeishuRegStatusResponse ¶ added in v0.260531.1
type FeishuRegStatusResponse struct {
Success bool `json:"success"`
Data FeishuRegStatusData `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
FeishuRegStatusResponse is the response for polling registration status.
type GroupActorPutRequest ¶ added in v0.260806.1
type GroupActorsResponse ¶ added in v0.260806.1
type GroupActorsResponse struct {
Actors []access.GroupActor `json:"actors"`
}
type GroupDetailResponse ¶ added in v0.260806.1
type GroupDetailResponse struct {
Group access.Group `json:"group"`
Capabilities map[access.CapabilityName]access.AccessEffect `json:"capabilities"`
Actors []access.GroupActor `json:"actors"`
}
type GroupListResponse ¶ added in v0.260806.1
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles ImBot settings HTTP requests
func NewHandler ¶
func NewHandler(ctx context.Context, cfg *config.Config, channelRegistry *channel.Registry) (*Handler, error)
NewHandler creates a new ImBot settings handler. channelRegistry is passed straight through to NewBotManager — see its doc comment for why this must happen at construction time rather than via a later SetChannelRegistry call.
func (*Handler) AuthorizeDirectChat ¶ added in v0.260806.1
func (*Handler) AuthorizeGroup ¶ added in v0.260806.1
func (*Handler) ChatStore ¶ added in v0.260801.1
func (h *Handler) ChatStore() (bot.ChatStoreInterface, error)
ChatStore returns the chat store shared by every running bot. It is owned by the StoreManager — do not Close it. Used by the notify module to implement GET /bots/:bot/chats.
func (*Handler) CreateRoute ¶ added in v0.260806.1
func (*Handler) CreateSettings ¶
CreateSettings creates a new ImBot configuration
func (*Handler) DeleteDirectChat ¶ added in v0.260806.1
func (*Handler) DeleteGroup ¶ added in v0.260806.1
func (*Handler) DeleteGroupActor ¶ added in v0.260806.1
func (*Handler) DeleteRoute ¶ added in v0.260806.1
func (*Handler) DeleteSettings ¶
DeleteSettings deletes an ImBot configuration
func (*Handler) GetDirectChat ¶ added in v0.260806.1
func (*Handler) GetPairingCode ¶ added in v0.260514.1
GetPairingCode reveals the bot's current TOFU pairing code so the operator can /bind from their DM. The cleartext code is included in the response; every reveal is recorded in the audit log.
func (*Handler) GetPlatformConfig ¶
GetPlatformConfig returns auth configuration for a specific platform
func (*Handler) GetPlatforms ¶
GetPlatforms returns all supported ImBot platforms with their configurations
func (*Handler) GetSettings ¶
GetSettings returns a single ImBot configuration by UUID
func (*Handler) ListCapabilities ¶ added in v0.260806.1
func (*Handler) ListDirectChats ¶ added in v0.260806.1
func (*Handler) ListGroupActors ¶ added in v0.260806.1
func (*Handler) ListGroups ¶ added in v0.260806.1
func (*Handler) ListRoutes ¶ added in v0.260806.1
func (*Handler) ListSettings ¶
ListSettings returns all ImBot configurations
func (*Handler) PutCapability ¶ added in v0.260806.1
func (*Handler) PutDirectChatBlocked ¶ added in v0.260806.1
func (*Handler) PutDirectChatPermission ¶ added in v0.260806.1
func (*Handler) PutDirectChatPermissions ¶ added in v0.260806.1
PutDirectChatPermissions applies a batch of explicit Direct Chat permission rows in one store transaction, so a preset can never half-apply.
func (*Handler) PutGroupActor ¶ added in v0.260806.1
func (*Handler) PutGroupActorPermission ¶ added in v0.260806.1
func (*Handler) PutGroupBlocked ¶ added in v0.260806.1
func (*Handler) PutGroupCapability ¶ added in v0.260806.1
func (*Handler) Reload ¶ added in v0.260514.1
Reload is the HTTP handler for POST /imbot-admin/reload. Re-reads bot settings and starts/stops bots to match the current enabled flags. Does not restart bots whose enabled state has not changed.
func (*Handler) RestartBot ¶ added in v0.260514.1
RestartBot is the HTTP handler for POST /imbot-admin/restart/:uuid. Restarts a single bot without affecting the rest of the server.
func (*Handler) RestartBotByUUID ¶ added in v0.260514.1
RestartBotByUUID stops then starts a single bot. Used by both the admin HTTP endpoint and the LifecycleController interface.
func (*Handler) RotatePairingCode ¶ added in v0.260514.1
RotatePairingCode mints a fresh pairing code, replacing any existing one. The previous code is invalidated immediately. Every rotation is audited.
func (*Handler) Shutdown ¶
func (h *Handler) Shutdown()
Shutdown stops all running bots and cleans up resources
func (*Handler) StartAllEnabled ¶
StartAllEnabled starts all enabled bots (delegates to BotManager)
func (*Handler) StopAll ¶
func (h *Handler) StopAll()
StopAll stops all running bots (delegates to BotManager)
func (*Handler) ToggleSettings ¶
ToggleSettings toggles the enabled status of an ImBot configuration
func (*Handler) UnpairDirectChat ¶ added in v0.260806.1
func (*Handler) UpdateRoute ¶ added in v0.260806.1
func (*Handler) UpdateSettings ¶
UpdateSettings updates an existing ImBot configuration
type LifecycleController ¶ added in v0.260514.1
type LifecycleController interface {
StartAllEnabled(ctx context.Context) error
StopAll()
RestartBotByUUID(ctx context.Context, uuid string) error
Sync(ctx context.Context) error
Shutdown()
}
LifecycleController is the narrow surface the server uses to drive the imbot module's lifecycle. Replacing the previous untyped interface{} + inline type assertions makes the contract explicit and is the single seam at which an out-of-process implementation could later be swapped in.
type ListResponse ¶
ListResponse represents the response for listing ImBot settings
type OKResponse ¶ added in v0.260806.1
type OKResponse struct {
OK bool `json:"ok"`
}
type PairingCodeResponse ¶ added in v0.260514.1
type PairingCodeResponse struct {
Success bool `json:"success"`
Active bool `json:"active"` // false = no live code (bot stopped, expired, or non-TOFU)
Code string `json:"code,omitempty"` // cleartext pairing code, present iff Active
ExpiresAt string `json:"expires_at,omitempty"` // RFC3339 expiry, present iff Active
Message string `json:"message,omitempty"`
}
PairingCodeResponse represents the response for pairing-code reveal/rotate.
type PermissionUpdateRequest ¶ added in v0.260806.1
type PermissionUpdateRequest struct {
Effect access.AccessEffect `json:"effect"`
}
type PermissionWrite ¶ added in v0.260806.1
type PermissionWrite struct {
Capability access.CapabilityName `json:"capability"`
Action access.ActionName `json:"action"`
Effect access.AccessEffect `json:"effect"`
}
PermissionWrite is one explicit capability/action/effect row in a batch permission update.
type PermissionsUpdateRequest ¶ added in v0.260806.1
type PermissionsUpdateRequest struct {
Permissions []PermissionWrite `json:"permissions"`
}
PermissionsUpdateRequest carries a batch of permission rows that must be applied atomically.
type PlatformConfig ¶
type PlatformConfig struct {
Platform string `json:"platform"`
DisplayName string `json:"display_name"`
AuthType string `json:"auth_type"`
Category string `json:"category"`
Fields []imbot.FieldSpec `json:"fields"`
}
PlatformConfig represents a platform configuration
type PlatformConfigResponse ¶
type PlatformConfigResponse struct {
Success bool `json:"success"`
Platform PlatformConfig `json:"platform"`
}
PlatformConfigResponse represents the response for platform config
type PlatformsResponse ¶
type PlatformsResponse struct {
Success bool `json:"success"`
Platforms []PlatformConfig `json:"platforms"`
Categories gin.H `json:"categories"`
}
PlatformsResponse represents the response for listing platforms
type QRStartData ¶
type QRStartData struct {
QrCodeID string `json:"qrcode_id"`
QrCodeData string `json:"qrcode_data"`
ExpiresIn int `json:"expires_in"`
}
QRStartData is the data for QR start response
type QRStartRequest ¶
type QRStartRequest struct {
BotUUID string `json:"bot_uuid" binding:"required"`
BotType string `json:"bot_type,omitempty"` // Optional bot type (default: "3")
BotName string `json:"bot_name,omitempty"` // Optional: bot display name (for deferred creation)
BotPlatform string `json:"bot_platform,omitempty"` // Optional: platform (for deferred creation)
}
QRStartRequest is the request to start QR login
type QRStartResponse ¶
type QRStartResponse struct {
Success bool `json:"success"`
Data QRStartData `json:"data"`
Error string `json:"error,omitempty"`
}
QRStartResponse is the response for QR start
type QRStatusData ¶
type QRStatusData struct {
Status string `json:"status"` // wait, scaned, confirmed, expired
BotUUID string `json:"bot_uuid,omitempty"` // Real bot UUID after confirmed (may differ from session UUID for new bots)
}
QRStatusData is the data for QR status response
type QRStatusResponse ¶
type QRStatusResponse struct {
Success bool `json:"success"`
Data QRStatusData `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
QRStatusResponse is the response for QR status
type RouteListResponse ¶ added in v0.260806.1
type RouteResponse ¶ added in v0.260806.1
type RouteTargetRequest ¶ added in v0.260806.1
type RouteTargetRequest struct {
Kind access.TargetKind `json:"kind"`
ID string `json:"id"`
}
type RouteWriteRequest ¶ added in v0.260806.1
type RouteWriteRequest struct {
Name string `json:"name"`
Source string `json:"source"`
Events []string `json:"events"`
Target RouteTargetRequest `json:"target"`
Enabled bool `json:"enabled"`
Options json.RawMessage `json:"options,omitempty"`
GrantNotify bool `json:"grant_notify,omitempty"`
}
type SettingsResponse ¶
type SettingsResponse struct {
Success bool `json:"success"`
Settings db.Settings `json:"settings"`
}
SettingsResponse represents the response for a single ImBot settings
type ToggleResponse ¶
ToggleResponse represents the response for toggling ImBot settings
type UpdateRequest ¶
type UpdateRequest struct {
Name string `json:"name,omitempty"`
Platform string `json:"platform,omitempty"`
AuthType string `json:"auth_type,omitempty"`
Auth map[string]string `json:"auth,omitempty"`
ProxyURL string `json:"proxy_url,omitempty"`
ChatID string `json:"chat_id_lock,omitempty"`
BashAllowlist []string `json:"bash_allowlist,omitempty"`
DefaultCwd *string `json:"default_cwd,omitempty"` // Pointer for partial update
DefaultAgent *string `json:"default_agent,omitempty"` // Pointer for partial update
Enabled *bool `json:"enabled,omitempty"` // Pointer to allow partial update
Token string `json:"token,omitempty"` // Legacy field
SmartGuideProvider *string `json:"smartguide_provider,omitempty"` // Provider UUID
SmartGuideModel *string `json:"smartguide_model,omitempty"` // Model identifier
RequirePairing *bool `json:"require_pairing,omitempty"` // TOFU pairing gate; nil → unchanged
}
UpdateRequest represents the request to update ImBot settings
type WeChatQRLoginHandler ¶
type WeChatQRLoginHandler struct {
// contains filtered or unexported fields
}
WeChatQRLoginHandler handles Weixin QR code login flow
func NewWeChatQRLoginHandler ¶
func NewWeChatQRLoginHandler(settingsStore *db.ImBotSettingsStore) *WeChatQRLoginHandler
NewWeChatQRLoginHandler creates a new Weixin QR login handler
func (*WeChatQRLoginHandler) QRCancel ¶
func (h *WeChatQRLoginHandler) QRCancel(c *gin.Context)
QRCancel cancels the pending QR login
func (*WeChatQRLoginHandler) QRStart ¶
func (h *WeChatQRLoginHandler) QRStart(c *gin.Context)
QRStart initiates the QR code login flow
func (*WeChatQRLoginHandler) QRStatus ¶
func (h *WeChatQRLoginHandler) QRStatus(c *gin.Context)
QRStatus polls the QR code login status