mirror of
https://github.com/gl-inet/glkvm-cloud.git
synced 2026-09-23 03:03:21 +00:00
9459b4709c
- SMTP config with TLS/STARTTLS/plain support and test email - Notification rules for device online, offline, and remote access - Recipient management with add/remove endpoints - Async email sending via goroutines to avoid blocking device runtime - Admin settings page with SMTP, rules, and recipients sections - Bell icon added to sidebar menu - i18n support for all 7 languages Signed-off-by: GL.iNet-Yongping.Xie <yongping.xie@gl-inet.com>
29 lines
915 B
Go
29 lines
915 B
Go
package notification
|
|
|
|
// SMTPConfig holds mail server settings. Only one row exists (singleton).
|
|
type SMTPConfig struct {
|
|
Host string `json:"host"`
|
|
Port int `json:"port"`
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
FromEmail string `json:"fromEmail"`
|
|
Encryption string `json:"encryption"` // "none", "tls", "starttls"
|
|
Enabled bool `json:"enabled"`
|
|
UpdatedAt int64 `json:"updatedAt"`
|
|
}
|
|
|
|
// NotifyRules controls which event categories trigger email notifications.
|
|
type NotifyRules struct {
|
|
DeviceOnline bool `json:"deviceOnline"`
|
|
DeviceOffline bool `json:"deviceOffline"`
|
|
RemoteAccess bool `json:"remoteAccess"` // SSH + Web + Control
|
|
UpdatedAt int64 `json:"updatedAt"`
|
|
}
|
|
|
|
// Recipient is a notification email address.
|
|
type Recipient struct {
|
|
ID int64 `json:"id"`
|
|
Email string `json:"email"`
|
|
CreatedAt int64 `json:"createdAt"`
|
|
}
|