Logging: Support URL in webhook author object

This commit is contained in:
Palapeli 2026-04-06 01:15:31 -04:00
parent 8260fcf584
commit 4efc2f1231
No known key found for this signature in database
GPG Key ID: 1FFE8F556A474925

View File

@ -17,15 +17,22 @@ func contains(slice []string, item string) bool {
return false
}
type WebhookAuthorConfig struct {
Name string `xml:",chardata"`
URL string `xml:"url,attr,omitempty"`
}
type WebhookConfig struct {
Enabled bool `xml:"enabled"`
URL string `xml:"url"`
Author string `xml:"author,omitempty"`
EventTypes []string `xml:"eventTypes>event"`
Enabled bool `xml:"enabled"`
URL string `xml:"url"`
// e.g. <author url="https://example.com">Author Name</author>
Author WebhookAuthorConfig `xml:"author,omitempty"`
EventTypes []string `xml:"eventTypes>event"`
}
type webhookAuthor struct {
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
}
type webhookEmbed struct {
@ -59,8 +66,8 @@ func (w WebhookConfig) ReportEvent(eventType string, eventData map[string]any) {
Title: "> **" + eventType + "**",
}
if w.Author != "" {
embed.Author = webhookAuthor{Name: w.Author}
if w.Author.Name != "" {
embed.Author = webhookAuthor{Name: w.Author.Name, URL: w.Author.URL}
}
for key, value := range eventData {