feat(embed): always show channel key via detail API
Fetch publish tokens when opening an embed channel drawer so deploy snippets stay available after browser restarts, while list endpoints still omit secrets.
This commit is contained in:
@@ -603,6 +603,22 @@ func patchEmbedChatPayload(body io.Reader, ch *types.EmbedChannel, agentMode boo
|
||||
return patched, nil
|
||||
}
|
||||
|
||||
// GetEmbedChannel returns a single embed channel for management, including the
|
||||
// publish token so admins can copy deploy snippets at any time.
|
||||
func (h *EmbedChannelHandler) GetEmbedChannel(c *gin.Context) {
|
||||
channelID := strings.TrimSpace(c.Param("channel_id"))
|
||||
tenantID := c.GetUint64(types.TenantIDContextKey.String())
|
||||
ch, err := h.embedSvc.GetOwnedChannel(c.Request.Context(), tenantID, channelID)
|
||||
if err != nil {
|
||||
writeEmbedMgmtError(c, err)
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": embedChannelResponse(ch, ch.PublishToken),
|
||||
})
|
||||
}
|
||||
|
||||
// GetEmbedChannelStats returns lightweight usage stats for an embed channel.
|
||||
func (h *EmbedChannelHandler) GetEmbedChannelStats(c *gin.Context) {
|
||||
channelID := strings.TrimSpace(c.Param("channel_id"))
|
||||
|
||||
Reference in New Issue
Block a user