Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: send all notifications from the manager, add environment info to notifications (#2046)
Kyle Mendell8257c877c000
diff --git a/backend/internal/bootstrap/services_bootstrap.go b/backend/internal/bootstrap/services_bootstrap.goindex a6ed5ae26..d1d4aaa26 100644--- a/backend/internal/bootstrap/services_bootstrap.go+++ b/backend/internal/bootstrap/services_bootstrap.go@@ -68,7 +68,8 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Configsvcs.ContainerRegistry = services.NewContainerRegistryService(db, func(ctx context.Context) (services.RegistryDaemonClient, error) {return dockerClient.GetClient(ctx)})- svcs.Notification = services.NewNotificationService(db, cfg)+ svcs.Environment = services.NewEnvironmentService(db, httpClient, svcs.Docker, svcs.Event, svcs.Settings)+ svcs.Notification = services.NewNotificationService(db, cfg, svcs.Environment)svcs.Apprise = services.NewAppriseService(db, cfg)svcs.Vulnerability = services.NewVulnerabilityService(db, svcs.Docker, svcs.Event, svcs.Settings, svcs.Notification)svcs.Dashboard = services.NewDashboardService(db, svcs.Docker, svcs.Vulnerability)@@ -78,7 +79,6 @@ func initializeServices(ctx context.Context, db *database.DB, cfg *config.Configsvcs.Build = services.NewBuildService(db, svcs.Settings, svcs.Docker, svcs.ContainerRegistry, svcs.GitRepository)svcs.BuildWorkspace = services.NewBuildWorkspaceService(svcs.Settings)svcs.Project = services.NewProjectService(db, svcs.Settings, svcs.Event, svcs.Image, svcs.Docker, svcs.Build)- svcs.Environment = services.NewEnvironmentService(db, httpClient, svcs.Docker, svcs.Event, svcs.Settings)svcs.Container = services.NewContainerService(db, svcs.Event, svcs.Docker, svcs.Image, svcs.Settings)svcs.Volume = services.NewVolumeService(db, svcs.Docker, svcs.Event, svcs.Settings, svcs.Container, svcs.Image, cfg.BackupVolumeName)svcs.Network = services.NewNetworkService(db, svcs.Docker, svcs.Event)diff --git a/backend/internal/huma/handlers/environments.go b/backend/internal/huma/handlers/environments.goindex 59eb2f502..4c52de179 100644--- a/backend/internal/huma/handlers/environments.go+++ b/backend/internal/huma/handlers/environments.go@@ -874,7 +874,7 @@ func (h *EnvironmentHandler) triggerPostUpdateTasks(ctx context.Context, environ}(detachedCtx, environmentID, updated.Name)}- if pairingSucceeded || (req.AccessToken != nil && *req.AccessToken != "") {+ if updated.AccessToken != nil && *updated.AccessToken != "" && (pairingSucceeded || (req.AccessToken != nil && *req.AccessToken != "") || req.Name != nil) {h.triggerEnvironmentResourceSync(ctx, environmentID, updated.Name, "environment update")}}diff --git a/backend/internal/huma/handlers/notifications.go b/backend/internal/huma/handlers/notifications.goindex 3685ed1ae..3d7a8e0d2 100644--- a/backend/internal/huma/handlers/notifications.go+++ b/backend/internal/huma/handlers/notifications.go@@ -2,11 +2,13 @@ package handlersimport ("context"+ "errors""net/http""strings""github.com/danielgtaylor/huma/v2""github.com/getarcaneapp/arcane/backend/internal/common"+ "github.com/getarcaneapp/arcane/backend/internal/config""github.com/getarcaneapp/arcane/backend/internal/models""github.com/getarcaneapp/arcane/backend/internal/services""github.com/getarcaneapp/arcane/types/base"@@ -16,6 +18,7 @@ import (type NotificationHandler struct {notificationService *services.NotificationServiceappriseService *services.AppriseService //nolint:staticcheck // Apprise still functional, deprecated in favor of Shoutrrr+ config *config.Config}type GetAllNotificationSettingsInput struct {@@ -89,6 +92,15 @@ type TestAppriseNotificationOutput struct {Body base.ApiResponse[base.MessageResponse]}+type DispatchNotificationInput struct {+ APIKey string `header:"X-API-Key" doc:"Remote environment access token"`+ Body notification.DispatchRequest+}++type DispatchNotificationOutput struct {+ Body base.ApiResponse[base.MessageResponse]+}+var supportedNotificationTestTypes = map[string]struct{}{"simple": {},"image-update": {},@@ -114,10 +126,11 @@ func isSupportedNotificationTestType(testType string) bool {// RegisterNotifications registers notification endpoints.////nolint:staticcheck // AppriseService still functional, deprecated in favor of Shoutrrr-func RegisterNotifications(api huma.API, notificationSvc *services.NotificationService, appriseSvc *services.AppriseService) {+func RegisterNotifications(api huma.API, notificationSvc *services.NotificationService, appriseSvc *services.AppriseService, cfg *config.Config) {h := &NotificationHandler{notificationService: notificationSvc,appriseService: appriseSvc,+ config: cfg,}huma.Register(api, huma.Operation{@@ -191,12 +204,31 @@ func RegisterNotifications(api huma.API, notificationSvc *services.NotificationSTags: []string{"Notifications"},Security: []map[string][]string{{"BearerAuth": {}}, {"ApiKeyAuth": {}}},}, h.TestAppriseNotification)++ huma.Register(api, huma.Operation{+ OperationID: "dispatch-notification",+ Method: http.MethodPost,+ Path: "/notifications/dispatch",+ Summary: "Dispatch notification from remote agent to manager",+ Tags: []string{"Notifications"},+ Security: []map[string][]string{{"ApiKeyAuth": {}}},+ }, h.DispatchNotification)+}++func (h *NotificationHandler) rejectIfAgentModeInternal() error {+ if h.config != nil && h.config.AgentMode {+ return huma.Error400BadRequest("notifications are managed on the Arcane manager")+ }+ return nil}func (h *NotificationHandler) GetAllNotificationSettings(ctx context.Context, input *GetAllNotificationSettingsInput) (*GetAllNotificationSettingsOutput, error) {if err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }settings, err := h.notificationService.GetAllSettings(ctx)if err != nil {return nil, huma.Error500InternalServerError((&common.NotificationSettingsListError{Err: err}).Error())@@ -219,6 +251,9 @@ func (h *NotificationHandler) GetNotificationSettings(ctx context.Context, inputif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }provider := models.NotificationProvider(input.Provider)settings, err := h.notificationService.GetSettingsByProvider(ctx, provider)@@ -240,6 +275,9 @@ func (h *NotificationHandler) CreateOrUpdateNotificationSettings(ctx context.Conif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }provider := models.NotificationProvider(input.Body.Provider)if !models.IsValidNotificationProvider(provider) {return nil, huma.Error400BadRequest((&common.InvalidNotificationProviderError{}).Error())@@ -269,6 +307,9 @@ func (h *NotificationHandler) DeleteNotificationSettings(ctx context.Context, inif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }provider := models.NotificationProvider(input.Provider)if err := h.notificationService.DeleteSettings(ctx, provider); err != nil {@@ -287,13 +328,16 @@ func (h *NotificationHandler) TestNotification(ctx context.Context, input *TestNif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }provider := models.NotificationProvider(input.Provider)testType := normalizeNotificationTestType(input.Type)if !isSupportedNotificationTestType(testType) {return nil, huma.Error400BadRequest("invalid notification test type")}- if err := h.notificationService.TestNotification(ctx, provider, testType); err != nil {+ if err := h.notificationService.TestNotification(ctx, input.EnvironmentID, provider, testType); err != nil {return nil, huma.Error500InternalServerError((&common.NotificationTestError{Err: err}).Error())}@@ -309,6 +353,9 @@ func (h *NotificationHandler) GetAppriseSettings(ctx context.Context, input *Getif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }settings, err := h.appriseService.GetSettings(ctx)if err != nil {return nil, huma.Error500InternalServerError("Failed to retrieve Apprise settings", err)@@ -332,6 +379,9 @@ func (h *NotificationHandler) CreateOrUpdateAppriseSettings(ctx context.Context,if err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }if input.Body.Enabled && input.Body.APIURL == "" {return nil, huma.Error400BadRequest("API URL is required when Apprise is enabled")}@@ -362,11 +412,18 @@ func (h *NotificationHandler) TestAppriseNotification(ctx context.Context, inputif err := checkAdmin(ctx); err != nil {return nil, err}+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }testType := normalizeNotificationTestType(input.Type)if !isSupportedNotificationTestType(testType) {return nil, huma.Error400BadRequest("invalid notification test type")}- if err := h.appriseService.TestNotification(ctx, testType); err != nil {+ target, err := h.notificationService.ResolveNotificationTarget(ctx, input.EnvironmentID)+ if err != nil {+ return nil, huma.Error500InternalServerError((&common.AppriseTestError{Err: err}).Error())+ }+ if err := h.appriseService.TestNotification(ctx, target.EnvironmentName, testType); err != nil {return nil, huma.Error500InternalServerError((&common.AppriseTestError{Err: err}).Error())}@@ -377,3 +434,28 @@ func (h *NotificationHandler) TestAppriseNotification(ctx context.Context, input},}, nil}++func (h *NotificationHandler) DispatchNotification(ctx context.Context, input *DispatchNotificationInput) (*DispatchNotificationOutput, error) {+ if err := h.rejectIfAgentModeInternal(); err != nil {+ return nil, err+ }+ if strings.TrimSpace(input.APIKey) == "" {+ return nil, huma.Error401Unauthorized("missing remote environment access token")+ }+ if err := h.notificationService.DispatchNotification(ctx, input.APIKey, input.Body); err != nil {+ if errors.Is(err, services.ErrUnsupportedDispatchKind) {+ return nil, huma.Error400BadRequest("unsupported dispatch kind")+ }+ if errors.Is(err, services.ErrUnauthorizedNotificationDispatch) {+ return nil, huma.Error401Unauthorized("unauthorized")+ }+ return nil, huma.Error500InternalServerError("dispatch failed")+ }++ return &DispatchNotificationOutput{+ Body: base.ApiResponse[base.MessageResponse]{+ Success: true,+ Data: base.MessageResponse{Message: "Notification dispatched successfully"},+ },+ }, nil+}diff --git a/backend/internal/huma/handlers/notifications_test.go b/backend/internal/huma/handlers/notifications_test.goindex a08d7124f..ac1790296 100644--- a/backend/internal/huma/handlers/notifications_test.go+++ b/backend/internal/huma/handlers/notifications_test.go@@ -1,11 +1,36 @@package handlersimport (+ "context"+ "net/http""testing"+ "time"+ "github.com/danielgtaylor/huma/v2"+ "github.com/getarcaneapp/arcane/backend/internal/config"+ "github.com/getarcaneapp/arcane/backend/internal/database"+ "github.com/getarcaneapp/arcane/backend/internal/models"+ "github.com/getarcaneapp/arcane/backend/internal/services"+ notificationdto "github.com/getarcaneapp/arcane/types/notification"+ glsqlite "github.com/glebarez/sqlite""github.com/stretchr/testify/assert"+ "github.com/stretchr/testify/require"+ "gorm.io/gorm")+func setupNotificationHandlerTestService(t *testing.T) (*database.DB, *services.NotificationService) {+ t.Helper()++ db, err := gorm.Open(glsqlite.Open(":memory:"), &gorm.Config{})+ require.NoError(t, err)+ require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}, &models.AppriseSettings{}))++ databaseDB := &database.DB{DB: db}+ envSvc := services.NewEnvironmentService(databaseDB, nil, nil, nil, nil)++ return databaseDB, services.NewNotificationService(databaseDB, &config.Config{}, envSvc)+}+func TestIsSupportedNotificationTestType(t *testing.T) {expected := []string{"simple",@@ -30,3 +55,46 @@ func TestNormalizeNotificationTestType(t *testing.T) {assert.Equal(t, "auto-heal", normalizeNotificationTestType("auto-heal"))assert.Equal(t, "auto-heal", normalizeNotificationTestType(" auto-heal "))}++func TestDispatchNotification_RejectsAgentModeInternal(t *testing.T) {+ h := &NotificationHandler{config: &config.Config{AgentMode: true}}++ resp, err := h.DispatchNotification(context.Background(), &DispatchNotificationInput{})+ require.Nil(t, resp)+ require.Error(t, err)+ assert.Contains(t, err.Error(), "notifications are managed on the Arcane manager")+}++func TestDispatchNotification_ReturnsBadRequestForUnsupportedDispatchKind(t *testing.T) {+ ctx := context.Background()+ db, svc := setupNotificationHandlerTestService(t)+ h := &NotificationHandler{+ notificationService: svc,+ config: &config.Config{},+ }++ token := "remote-token"+ now := time.Now()+ require.NoError(t, db.WithContext(ctx).Create(&models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: now, UpdatedAt: &now},+ Name: "Remote Edge",+ ApiUrl: "http://remote.example",+ Enabled: true,+ Status: string(models.EnvironmentStatusOnline),+ AccessToken: &token,+ }).Error)++ resp, err := h.DispatchNotification(ctx, &DispatchNotificationInput{+ APIKey: token,+ Body: notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKind("bogus_kind"),+ },+ })+ require.Nil(t, resp)+ require.Error(t, err)++ var statusErr huma.StatusError+ require.ErrorAs(t, err, &statusErr)+ require.Equal(t, http.StatusBadRequest, statusErr.GetStatus())+ require.Contains(t, statusErr.Error(), "unsupported dispatch kind")+}diff --git a/backend/internal/huma/huma.go b/backend/internal/huma/huma.goindex 7c67ef4c6..0db6c4f59 100644--- a/backend/internal/huma/huma.go+++ b/backend/internal/huma/huma.go@@ -391,7 +391,7 @@ func registerHandlers(api huma.API, svc *Services) {handlers.RegisterVolumes(api, dockerSvc, volumeSvc)handlers.RegisterContainers(api, containerSvc, dockerSvc)handlers.RegisterNetworks(api, networkSvc, dockerSvc)- handlers.RegisterNotifications(api, notificationSvc, appriseSvc)+ handlers.RegisterNotifications(api, notificationSvc, appriseSvc, cfg)handlers.RegisterUpdater(api, updaterSvc)handlers.RegisterCustomize(api, customizeSearchSvc)handlers.RegisterSystem(api, dockerSvc, systemSvc, systemUpgradeSvc, cfg)diff --git a/backend/internal/middleware/environment_middleware.go b/backend/internal/middleware/environment_middleware.goindex 621d098f4..d6409fe38 100644--- a/backend/internal/middleware/environment_middleware.go+++ b/backend/internal/middleware/environment_middleware.go@@ -151,49 +151,12 @@ func (m *EnvironmentMiddleware) Handle(c *gin.Context) {isEdgeEnvironment := isEdgeEnvironmentURLInternal(apiURL)- // Check if this environment has an active edge tunnel- if tunnel, ok := m.getActiveEdgeTunnelInternal(envID); ok {- slog.DebugContext(c.Request.Context(), "Routing request through edge tunnel", "environment_id", envID, "path", c.Request.URL.Path)-- // Inject agent token into request headers before proxying through the tunnel.- // ProxyHTTPRequest and ProxyWebSocketRequest copy headers from c.Request.Header,- // so setting the token here ensures the agent receives proper authentication.- // Without this, the agent's agentAuth middleware rejects requests with 401- // because the browser's session cookies are not valid on the agent.- if accessToken != nil && *accessToken != "" {- c.Request.Header.Set(remenv.HeaderAgentToken, *accessToken)- c.Request.Header.Set(remenv.HeaderAPIKey, *accessToken)- }-- proxyPath := m.buildProxyPath(c, envID)- if m.isWebSocketUpgrade(c) {- // Route WebSocket through the edge tunnel- edge.ProxyWebSocketRequest(c, tunnel, proxyPath)- } else {- edge.ProxyHTTPRequest(c, tunnel, proxyPath)- }- c.Abort()+ if m.proxyActiveEdgeTunnelInternal(c, envID, accessToken) {return}if isEdgeEnvironment {- edge.TouchTunnelDemand(envID, edge.DefaultTunnelDemandTTL)- tunnel, ok := m.waitForActiveEdgeTunnelInternal(c.Request.Context(), envID, edge.DefaultTunnelAcquireTimeout())- if ok {- slog.InfoContext(c.Request.Context(), "Recovered edge tunnel during request", "environment_id", envID)- // Inject agent token headers for the recovered tunnel path.- if accessToken != nil && *accessToken != "" {- c.Request.Header.Set(remenv.HeaderAgentToken, *accessToken)- c.Request.Header.Set(remenv.HeaderAPIKey, *accessToken)- }-- proxyPath := m.buildProxyPath(c, envID)- if m.isWebSocketUpgrade(c) {- edge.ProxyWebSocketRequest(c, tunnel, proxyPath)- } else {- edge.ProxyHTTPRequest(c, tunnel, proxyPath)- }- c.Abort()+ if m.proxyRecoveredEdgeTunnelInternal(c, envID, accessToken) {return}@@ -211,6 +174,51 @@ func (m *EnvironmentMiddleware) Handle(c *gin.Context) {}}+func (m *EnvironmentMiddleware) proxyActiveEdgeTunnelInternal(c *gin.Context, envID string, accessToken *string) bool {+ tunnel, ok := m.getActiveEdgeTunnelInternal(envID)+ if !ok {+ return false+ }++ slog.DebugContext(c.Request.Context(), "Routing request through edge tunnel", "environment_id", envID, "path", c.Request.URL.Path)+ m.setProxyContextHeadersInternal(c, accessToken)+ m.proxyThroughTunnelInternal(c, tunnel, envID)+ return true+}++func (m *EnvironmentMiddleware) proxyRecoveredEdgeTunnelInternal(c *gin.Context, envID string, accessToken *string) bool {+ edge.TouchTunnelDemand(envID, edge.DefaultTunnelDemandTTL)++ tunnel, ok := m.waitForActiveEdgeTunnelInternal(c.Request.Context(), envID, edge.DefaultTunnelAcquireTimeout())+ if !ok {+ return false+ }++ slog.InfoContext(c.Request.Context(), "Recovered edge tunnel during request", "environment_id", envID)+ m.setProxyContextHeadersInternal(c, accessToken)+ m.proxyThroughTunnelInternal(c, tunnel, envID)+ return true+}++func (m *EnvironmentMiddleware) setProxyContextHeadersInternal(c *gin.Context, accessToken *string) {+ // ProxyHTTPRequest and ProxyWebSocketRequest copy headers from c.Request.Header,+ // so setting these here ensures the agent receives proper authentication.+ if accessToken != nil && *accessToken != "" {+ c.Request.Header.Set(remenv.HeaderAgentToken, *accessToken)+ c.Request.Header.Set(remenv.HeaderAPIKey, *accessToken)+ }+}++func (m *EnvironmentMiddleware) proxyThroughTunnelInternal(c *gin.Context, tunnel *edge.AgentTunnel, envID string) {+ proxyPath := m.buildProxyPath(c, envID)+ if m.isWebSocketUpgrade(c) {+ edge.ProxyWebSocketRequest(c, tunnel, proxyPath)+ } else {+ edge.ProxyHTTPRequest(c, tunnel, proxyPath)+ }+ c.Abort()+}+// hasResourcePath reports whether the request targets a proxiable resource path.// Returns true for paths like /api/environments/{id}/containers (should be proxied).// Returns false for /api/environments/{id} exactly or any management endpoint.@@ -219,8 +227,16 @@ func (m *EnvironmentMiddleware) hasResourcePath(c *gin.Context, envID string) boif !ok || len(suffix) <= 1 || suffix[0] != '/' {return false}+ return !isManagementPathInternal(suffix)+}++func isManagementPathInternal(suffix string) bool {+ if strings.HasPrefix(suffix, "/notifications") {+ return true+ }+_, isManagement := managementEndpointSet[suffix]- return !isManagement+ return isManagement}// extractEnvironmentID gets the environment ID from the request.diff --git a/backend/internal/middleware/environment_middleware_test.go b/backend/internal/middleware/environment_middleware_test.goindex 7964a848f..d9f989260 100644--- a/backend/internal/middleware/environment_middleware_test.go+++ b/backend/internal/middleware/environment_middleware_test.go@@ -77,6 +77,30 @@ func TestEnvironmentMiddleware_KeepsEdgeManagementEndpointsLocal(t *testing.T) {assert.True(t, localHandlerHit)}+func TestEnvironmentMiddleware_KeepsNotificationEndpointsLocal(t *testing.T) {+ gin.SetMode(gin.TestMode)++ middleware := newTestEnvironmentMiddleware()+ router := gin.New()+ api := router.Group("/api")+ api.Use(middleware.Handle)++ localHandlerHit := false+ api.GET("/environments/:id/notifications/settings", func(c *gin.Context) {+ localHandlerHit = true+ c.JSON(http.StatusOK, gin.H{"success": true})+ })++ req := httptest.NewRequest(http.MethodGet, "/api/environments/env-edge/notifications/settings", nil)+ recorder := httptest.NewRecorder()++ router.ServeHTTP(recorder, req)++ assert.Equal(t, http.StatusOK, recorder.Code)+ assert.Contains(t, recorder.Body.String(), "\"success\":true")+ assert.True(t, localHandlerHit)+}+func TestEnvironmentMiddleware_ProxyWebSocketRejectsEdgeTargetsWithoutTunnel(t *testing.T) {gin.SetMode(gin.TestMode)diff --git a/backend/internal/services/apprise_service.go b/backend/internal/services/apprise_service.goindex 27f4048e6..6cf858e08 100644--- a/backend/internal/services/apprise_service.go+++ b/backend/internal/services/apprise_service.go@@ -9,12 +9,12 @@ import ("io""log/slog""net/http"- "strings""time""github.com/getarcaneapp/arcane/backend/internal/config""github.com/getarcaneapp/arcane/backend/internal/database""github.com/getarcaneapp/arcane/backend/internal/models"+ "github.com/getarcaneapp/arcane/backend/pkg/utils/notifications""github.com/getarcaneapp/arcane/types/imageupdate""gorm.io/gorm")@@ -160,31 +160,19 @@ func (s *AppriseService) SendNotification(ctx context.Context, title, body, formreturn nil}-func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response) error {- title := fmt.Sprintf("Container Image Update Available: %s", imageRef)- body := fmt.Sprintf(- "Image: %s\nUpdate Type: %s\nCurrent Digest: %s\nLatest Digest: %s",- imageRef,- updateInfo.UpdateType,- updateInfo.CurrentDigest,- updateInfo.LatestDigest,- )+func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response) error {+ title := fmt.Sprintf("[%s] Container Image Update Available: %s", environmentName, imageRef)+ body := notifications.BuildImageUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, imageRef, updateInfo)return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)}-func (s *AppriseService) SendContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string) error {- title := fmt.Sprintf("Container Updated: %s", containerName)- body := fmt.Sprintf(- "Container: %s\nImage: %s\nPrevious Version: %s\nCurrent Version: %s\nStatus: Updated Successfully",- containerName,- imageRef,- oldDigest,- newDigest,- )+func (s *AppriseService) SendContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string) error {+ title := fmt.Sprintf("[%s] Container Updated: %s", environmentName, containerName)+ body := notifications.BuildContainerUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName, imageRef, oldDigest, newDigest)return s.SendNotification(ctx, title, body, "text", models.NotificationEventContainerUpdate)}-func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error {+func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response) error {if len(updates) == 0 {return nil}@@ -200,33 +188,23 @@ func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, ureturn nil}- title := fmt.Sprintf("%d Container Image Update(s) Available", len(updatesWithChanges))- var body strings.Builder- body.WriteString("The following images have updates available:\n\n")+ title := fmt.Sprintf("[%s] %d Container Image Update(s) Available", environmentName, len(updatesWithChanges))+ body := notifications.BuildBatchImageUpdateNotificationMessage(notifications.MessageFormatPlain, environmentName, updatesWithChanges)- for imageRef, update := range updatesWithChanges {- fmt.Fprintf(&body, "• %s\n Type: %s\n Current: %s\n Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- return s.SendNotification(ctx, title, body.String(), "text", models.NotificationEventImageUpdate)+ return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)}-func (s *AppriseService) TestNotification(ctx context.Context, testType string) error {+func (s *AppriseService) TestNotification(ctx context.Context, environmentName, testType string) error {switch testType {case "vulnerability-found":- title := "Vulnerability Summary Notification"+ title := notifications.BuildEmailSubject(environmentName, "Vulnerability Summary Notification")body := fmt.Sprintf("Summary Date: %s\nCritical: 1\nHigh: 3\nMedium: 2\nLow: 1\nUnknown: 0\nFixable vulnerabilities: 7\nExamples: CVE-2025-1234, CVE-2025-5678, CVE-2026-0001",time.Now().UTC().Format("2006-01-02"),)return s.SendNotification(ctx, title, body, "text", models.NotificationEventVulnerabilityFound)case "prune-report":- title := "System Prune Report"+ title := notifications.BuildEmailSubject(environmentName, "System Prune Report")body := "Containers pruned: 2\nImages deleted: 1\nVolumes deleted: 1\nNetworks deleted: 1\nSpace reclaimed: 3.56 GB"return s.SendNotification(ctx, title, body, "text", models.NotificationEventPruneReport)case "image-update":@@ -238,7 +216,7 @@ func (s *AppriseService) TestNotification(ctx context.Context, testType string)CheckTime: time.Now(),ResponseTimeMs: 100,}- return s.SendImageUpdateNotification(ctx, "nginx:latest", testUpdate)+ return s.SendImageUpdateNotification(ctx, environmentName, "nginx:latest", testUpdate)case "batch-image-update":testUpdates := map[string]*imageupdate.Response{"nginx:latest": {@@ -266,9 +244,9 @@ func (s *AppriseService) TestNotification(ctx context.Context, testType string)ResponseTimeMs: 95,},}- return s.SendBatchImageUpdateNotification(ctx, testUpdates)+ return s.SendBatchImageUpdateNotification(ctx, environmentName, testUpdates)case "simple", "":- title := "Test Notification from Arcane"+ title := notifications.BuildEmailSubject(environmentName, "Test Notification from Arcane")body := "If you're reading this, your Apprise integration is working correctly!"return s.SendNotification(ctx, title, body, "text", models.NotificationEventImageUpdate)default:diff --git a/backend/internal/services/environment_service.go b/backend/internal/services/environment_service.goindex 5c8cd985e..869b8a2be 100644--- a/backend/internal/services/environment_service.go+++ b/backend/internal/services/environment_service.go@@ -45,6 +45,11 @@ type edgeTokenCacheEntry struct {const edgeTokenCacheTTL = time.Minute+var (+ ErrEnvironmentAccessTokenRequired = errors.New("environment access token required")+ ErrInvalidEnvironmentAccessToken = errors.New("invalid environment access token")+)+func NewEnvironmentService(db *database.DB, httpClient *http.Client, dockerService *DockerClientService, eventService *EventService, settingsService *SettingsService) *EnvironmentService {if httpClient == nil {httpClient = http.DefaultClient@@ -660,6 +665,25 @@ func (s *EnvironmentService) GetDB() *database.DB {return s.db}+func (s *EnvironmentService) ResolveEnvironmentByAccessToken(ctx context.Context, token string) (*models.Environment, error) {+ token = strings.TrimSpace(token)+ if token == "" {+ return nil, ErrEnvironmentAccessTokenRequired+ }++ var env models.Environment+ if err := s.db.WithContext(ctx).+ Where("access_token = ?", token).+ First(&env).Error; err != nil {+ if errors.Is(err, gorm.ErrRecordNotFound) {+ return nil, ErrInvalidEnvironmentAccessToken+ }+ return nil, fmt.Errorf("failed to resolve environment by access token: %w", err)+ }++ return &env, nil+}+func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error) {var registries []models.ContainerRegistryif err := s.db.WithContext(ctx).Where("enabled = ?", true).Find(®istries).Error; err != nil {@@ -1046,7 +1070,6 @@ func (s *EnvironmentService) ProxyRequest(ctx context.Context, envID string, metheaders["X-Arcane-Agent-Token"] = *environment.AccessTokenheaders["X-API-Key"] = *environment.AccessToken}-// Use edge-aware client that routes through tunnel for edge environmentsresp, err := edge.DoEdgeAwareRequest(proxyCtx, envID, environment.IsEdge, method, targetURL, path, headers, body)if err != nil {diff --git a/backend/internal/services/environment_service_test.go b/backend/internal/services/environment_service_test.goindex 37ce56c03..e4f607da9 100644--- a/backend/internal/services/environment_service_test.go+++ b/backend/internal/services/environment_service_test.go@@ -26,7 +26,7 @@ func setupEnvironmentServiceTestDB(t *testing.T) *database.DB {db, err := gorm.Open(glsqlite.Open(":memory:"), &gorm.Config{})require.NoError(t, err)- require.NoError(t, db.AutoMigrate(&models.Environment{}, &models.ContainerRegistry{}))+ require.NoError(t, db.AutoMigrate(&models.Environment{}, &models.ContainerRegistry{}, &models.SettingVariable{}))testCfg := &config.Config{EncryptionKey: "test-encryption-key-for-testing-32bytes-min",@@ -39,6 +39,11 @@ func setupEnvironmentServiceTestDB(t *testing.T) *database.DB {func createTestEnvironment(t *testing.T, db *database.DB, id string, apiURL string, accessToken *string) {t.Helper()+ createNamedTestEnvironmentInternal(t, db, id, "env-"+id, apiURL, accessToken)+}++func createNamedTestEnvironmentInternal(t *testing.T, db *database.DB, id, name, apiURL string, accessToken *string) {+ t.Helper()now := time.Now()env := &models.Environment{@@ -47,7 +52,7 @@ func createTestEnvironment(t *testing.T, db *database.DB, id string, apiURL striCreatedAt: now,UpdatedAt: &now,},- Name: "env-" + id,+ Name: name,ApiUrl: apiURL,Status: string(models.EnvironmentStatusOnline),Enabled: true,@@ -343,6 +348,25 @@ func TestEnvironmentService_getCachedEnvironmentIDForTokenInternal_ExpiresAndClerequire.False(t, reverseIndexStillCached)}+func TestEnvironmentService_ResolveEnvironmentByAccessToken(t *testing.T) {+ ctx := context.Background()+ db := setupEnvironmentServiceTestDB(t)+ svc := NewEnvironmentService(db, nil, nil, nil, nil)++ accessToken := "remote-token"+ createNamedTestEnvironmentInternal(t, db, "env-remote", "Remote Alpha", "http://remote.example", &accessToken)++ env, err := svc.ResolveEnvironmentByAccessToken(ctx, accessToken)+ require.NoError(t, err)+ require.NotNil(t, env)+ require.Equal(t, "env-remote", env.ID)+ require.Equal(t, "Remote Alpha", env.Name)++ _, err = svc.ResolveEnvironmentByAccessToken(ctx, "missing-token")+ require.Error(t, err)+ require.ErrorIs(t, err, ErrInvalidEnvironmentAccessToken)+}+func TestEnvironmentService_GenerateDeploymentSnippets_ExplicitlyUsePollTransport(t *testing.T) {svc := NewEnvironmentService(nil, nil, nil, nil, nil)diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.goindex f4a894cc9..4c5f37d04 100644--- a/backend/internal/services/notification_service.go+++ b/backend/internal/services/notification_service.go@@ -6,7 +6,9 @@ import ("encoding/json""errors""fmt"+ "io""log/slog"+ "net/http""net/mail""strings""text/template"@@ -18,9 +20,10 @@ import ("github.com/getarcaneapp/arcane/backend/internal/database""github.com/getarcaneapp/arcane/backend/internal/models""github.com/getarcaneapp/arcane/backend/internal/utils/crypto"- "github.com/getarcaneapp/arcane/backend/internal/utils/notifications"+ "github.com/getarcaneapp/arcane/backend/pkg/utils/notifications""github.com/getarcaneapp/arcane/backend/resources""github.com/getarcaneapp/arcane/types/imageupdate"+ notificationdto "github.com/getarcaneapp/arcane/types/notification""github.com/getarcaneapp/arcane/types/system")@@ -44,6 +47,9 @@ var supportedNotificationTestTypes = map[string]struct{}{notificationTestTypeAutoHeal: {},}+var ErrUnauthorizedNotificationDispatch = errors.New("unauthorized notification dispatch")+var ErrUnsupportedDispatchKind = errors.New("unsupported notification dispatch kind")+// VulnerabilityNotificationPayload is the data sent to all providers for vulnerability_found events.// Only vulnerabilities with a fixed version should trigger this notification.type VulnerabilityNotificationPayload struct {@@ -59,14 +65,187 @@ type VulnerabilityNotificationPayload struct {type NotificationService struct {db *database.DBconfig *config.Config+ environmentSvc *EnvironmentServiceappriseService *AppriseService+ httpClient *http.Client+}++type NotificationTarget struct {+ EnvironmentID string+ EnvironmentName string+}++func logManagerDispatchNotificationInternal(ctx context.Context, target NotificationTarget, kind notificationdto.DispatchKind) {+ slog.InfoContext(ctx,+ "Manager dispatching notification on behalf of agent",+ "environment_id", target.EnvironmentID,+ "environment_name", target.EnvironmentName,+ "kind", string(kind),+ )}-func NewNotificationService(db *database.DB, cfg *config.Config) *NotificationService {+func (s *NotificationService) ResolveNotificationTarget(ctx context.Context, environmentID string) (NotificationTarget, error) {+ return s.resolveNotificationTargetInternal(ctx, environmentID)+}++func NewNotificationService(db *database.DB, cfg *config.Config, environmentSvc *EnvironmentService) *NotificationService {return &NotificationService{db: db,config: cfg,+ environmentSvc: environmentSvc,appriseService: NewAppriseService(db, cfg),+ httpClient: &http.Client{Timeout: 15 * time.Second},+ }+}++func (s *NotificationService) resolveNotificationTargetInternal(ctx context.Context, environmentID string) (NotificationTarget, error) {+ trimmedEnvironmentID := strings.TrimSpace(environmentID)+ if trimmedEnvironmentID == "" {+ trimmedEnvironmentID = "0"+ }++ if s.environmentSvc != nil {+ env, err := s.environmentSvc.GetEnvironmentByID(ctx, trimmedEnvironmentID)+ if err == nil && env != nil {+ environmentName := strings.TrimSpace(env.Name)+ if environmentName == "" && trimmedEnvironmentID == "0" {+ environmentName = "Local Docker"+ }+ return NotificationTarget{+ EnvironmentID: env.ID,+ EnvironmentName: environmentName,+ }, nil+ }+ if trimmedEnvironmentID != "0" {+ return NotificationTarget{}, fmt.Errorf("failed to resolve notification environment: %w", err)+ }+ if err != nil {+ slog.WarnContext(ctx, "Failed to resolve local environment, falling back to 'Local Docker'", "error", err)+ }+ }++ return NotificationTarget{+ EnvironmentID: "0",+ EnvironmentName: "Local Docker",+ }, nil+}++func (s *NotificationService) resolveNotificationTargetForAccessTokenInternal(ctx context.Context, accessToken string) (NotificationTarget, error) {+ if s.environmentSvc == nil {+ return NotificationTarget{}, fmt.Errorf("environment service not initialized")+ }++ env, err := s.environmentSvc.ResolveEnvironmentByAccessToken(ctx, accessToken)+ if err != nil {+ if errors.Is(err, ErrEnvironmentAccessTokenRequired) || errors.Is(err, ErrInvalidEnvironmentAccessToken) {+ return NotificationTarget{}, fmt.Errorf("%w", ErrUnauthorizedNotificationDispatch)+ }+ return NotificationTarget{}, err+ }++ environmentName := strings.TrimSpace(env.Name)+ if environmentName == "" && env.ID == "0" {+ environmentName = "Local Docker"+ }++ return NotificationTarget{+ EnvironmentID: env.ID,+ EnvironmentName: environmentName,+ }, nil+}++func (s *NotificationService) dispatchNotificationToManagerInternal(ctx context.Context, payload notificationdto.DispatchRequest) error {+ if s.config == nil || strings.TrimSpace(s.config.GetManagerBaseURL()) == "" {+ return fmt.Errorf("manager API URL is required for notification dispatch")+ }+ if strings.TrimSpace(s.config.AgentToken) == "" {+ return fmt.Errorf("agent token is required for notification dispatch")+ }++ body, err := json.Marshal(payload)+ if err != nil {+ return fmt.Errorf("failed to marshal notification dispatch payload: %w", err)+ }++ dispatchURL := strings.TrimRight(s.config.GetManagerBaseURL(), "/") + "/api/notifications/dispatch"+ req, err := http.NewRequestWithContext(ctx, http.MethodPost, dispatchURL, bytes.NewReader(body))+ if err != nil {+ return fmt.Errorf("failed to create notification dispatch request: %w", err)+ }+ req.Header.Set("Content-Type", "application/json")+ req.Header.Set("X-API-Key", s.config.AgentToken)++ resp, err := s.httpClient.Do(req) //nolint:gosec // dispatch URL is derived from validated manager configuration+ if err != nil {+ return fmt.Errorf("failed to dispatch notification to manager: %w", err)+ }+ defer func() { _ = resp.Body.Close() }()++ if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {+ return nil+ }++ responseBody, _ := io.ReadAll(resp.Body)+ return fmt.Errorf("manager notification dispatch failed with status %d: %s", resp.StatusCode, strings.TrimSpace(string(responseBody)))+}++func (s *NotificationService) DispatchNotification(ctx context.Context, accessToken string, payload notificationdto.DispatchRequest) error {+ if s.config != nil && s.config.AgentMode {+ return fmt.Errorf("notification dispatch is manager-only")+ }++ target, err := s.resolveNotificationTargetForAccessTokenInternal(ctx, accessToken)+ if err != nil {+ return err+ }++ switch payload.Kind {+ case notificationdto.DispatchKindImageUpdate:+ if payload.ImageUpdate == nil {+ return fmt.Errorf("image update payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendImageUpdateNotificationForTargetInternal(ctx, target, payload.ImageUpdate.ImageRef, &payload.ImageUpdate.UpdateInfo, models.NotificationEventImageUpdate)+ case notificationdto.DispatchKindBatchImageUpdate:+ if payload.BatchImageUpdate == nil {+ return fmt.Errorf("batch image update payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendBatchImageUpdateNotificationForTargetInternal(ctx, target, payload.BatchImageUpdate.Updates)+ case notificationdto.DispatchKindContainerUpdate:+ if payload.ContainerUpdate == nil {+ return fmt.Errorf("container update payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendContainerUpdateNotificationForTargetInternal(ctx, target, payload.ContainerUpdate.ContainerName, payload.ContainerUpdate.ImageRef, payload.ContainerUpdate.OldDigest, payload.ContainerUpdate.NewDigest)+ case notificationdto.DispatchKindVulnerabilityFound:+ if payload.VulnerabilityFound == nil {+ return fmt.Errorf("vulnerability payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendVulnerabilityNotificationForTargetInternal(ctx, target, VulnerabilityNotificationPayload{+ CVEID: payload.VulnerabilityFound.CVEID,+ CVELink: payload.VulnerabilityFound.CVELink,+ Severity: payload.VulnerabilityFound.Severity,+ ImageName: payload.VulnerabilityFound.ImageName,+ FixedVersion: payload.VulnerabilityFound.FixedVersion,+ PkgName: payload.VulnerabilityFound.PkgName,+ InstalledVersion: payload.VulnerabilityFound.InstalledVersion,+ })+ case notificationdto.DispatchKindPruneReport:+ if payload.PruneReport == nil {+ return fmt.Errorf("prune report payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendPruneReportNotificationForTargetInternal(ctx, target, &payload.PruneReport.Result)+ case notificationdto.DispatchKindAutoHeal:+ if payload.AutoHeal == nil {+ return fmt.Errorf("auto-heal payload is required")+ }+ logManagerDispatchNotificationInternal(ctx, target, payload.Kind)+ return s.sendAutoHealNotificationForTargetInternal(ctx, target, payload.AutoHeal.ContainerName, payload.AutoHeal.ContainerID)+ default:+ return fmt.Errorf("%w: %s", ErrUnsupportedDispatchKind, payload.Kind)}}@@ -123,8 +302,31 @@ func (s *NotificationService) DeleteSettings(ctx context.Context, provider model}func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, eventType models.NotificationEventType) error {+ if updateInfo == nil {+ return fmt.Errorf("updateInfo is required")+ }++ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindImageUpdate,+ ImageUpdate: ¬ificationdto.DispatchImageUpdate{+ ImageRef: imageRef,+ UpdateInfo: *updateInfo,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendImageUpdateNotificationForTargetInternal(ctx, target, imageRef, updateInfo, eventType)+}++func (s *NotificationService) sendImageUpdateNotificationForTargetInternal(ctx context.Context, target NotificationTarget, imageRef string, updateInfo *imageupdate.Response, eventType models.NotificationEventType) error {// Send to Apprise if enabled (don't block on error)- if appriseErr := s.appriseService.SendImageUpdateNotification(ctx, imageRef, updateInfo); appriseErr != nil {+ if appriseErr := s.appriseService.SendImageUpdateNotification(ctx, target.EnvironmentName, imageRef, updateInfo); appriseErr != nil {slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)}@@ -147,25 +349,25 @@ func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, ivar sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendDiscordNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendDiscordNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendEmailNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendEmailNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendTelegramNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendTelegramNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendSignalNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendSignalNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendSlackNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendSlackNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendNtfyNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendNtfyNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendPushoverNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendPushoverNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendGotifyNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendGotifyNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendMatrixNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendMatrixNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendGenericNotification(ctx, imageRef, updateInfo, setting.Config)+ sendErr = s.sendGenericNotification(ctx, target.EnvironmentName, imageRef, updateInfo, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -222,8 +424,29 @@ func (s *NotificationService) isEventEnabled(config models.JSON, eventType model}func (s *NotificationService) SendContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string) error {+ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindContainerUpdate,+ ContainerUpdate: ¬ificationdto.DispatchContainerUpdate{+ ContainerName: containerName,+ ImageRef: imageRef,+ OldDigest: oldDigest,+ NewDigest: newDigest,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendContainerUpdateNotificationForTargetInternal(ctx, target, containerName, imageRef, oldDigest, newDigest)+}++func (s *NotificationService) sendContainerUpdateNotificationForTargetInternal(ctx context.Context, target NotificationTarget, containerName, imageRef, oldDigest, newDigest string) error {// Send to Apprise if enabled (don't block on error)- if appriseErr := s.appriseService.SendContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest); appriseErr != nil {+ if appriseErr := s.appriseService.SendContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest); appriseErr != nil {slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)}@@ -246,25 +469,25 @@ func (s *NotificationService) SendContainerUpdateNotification(ctx context.Contexvar sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendDiscordContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendDiscordContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendEmailContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendEmailContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendTelegramContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendTelegramContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendSignalContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendSignalContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendSlackContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendSlackContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendNtfyContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendNtfyContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendPushoverContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendPushoverContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendGotifyContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendGotifyContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendMatrixContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendMatrixContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendGenericContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)+ sendErr = s.sendGenericContainerUpdateNotification(ctx, target.EnvironmentName, containerName, imageRef, oldDigest, newDigest, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -298,98 +521,6 @@ func isVulnerabilitySummaryPayload(payload VulnerabilityNotificationPayload) booreturn strings.HasPrefix(strings.ToUpper(strings.TrimSpace(payload.CVEID)), "DAILY SUMMARY")}-func vulnerabilitySummaryTitleInternal(payload VulnerabilityNotificationPayload) string {- label := strings.TrimSpace(payload.CVEID)- if label == "" {- label = "Daily Summary"- }- return fmt.Sprintf("Daily Vulnerability Summary: %s", label)-}--func vulnerabilitySummaryBodyPlainInternal(payload VulnerabilityNotificationPayload) string {- var sb strings.Builder- sb.WriteString("Daily Vulnerability Summary\n\n")- if strings.TrimSpace(payload.CVEID) != "" {- _, _ = fmt.Fprintf(&sb, "Summary: %s\n", payload.CVEID)- }- if strings.TrimSpace(payload.ImageName) != "" {- _, _ = fmt.Fprintf(&sb, "Overview: %s\n", payload.ImageName)- }- if strings.TrimSpace(payload.FixedVersion) != "" {- _, _ = fmt.Fprintf(&sb, "Fixable vulnerabilities: %s\n", payload.FixedVersion)- }- if strings.TrimSpace(payload.Severity) != "" {- _, _ = fmt.Fprintf(&sb, "Severity breakdown: %s\n", payload.Severity)- }- if strings.TrimSpace(payload.PkgName) != "" {- _, _ = fmt.Fprintf(&sb, "Sample CVEs: %s\n", payload.PkgName)- }- return sb.String()-}--func vulnerabilitySummaryBodyMarkdownInternal(payload VulnerabilityNotificationPayload) string {- var sb strings.Builder- sb.WriteString("📊 **Daily Vulnerability Summary**\n\n")- if strings.TrimSpace(payload.CVEID) != "" {- _, _ = fmt.Fprintf(&sb, "**Summary:** %s\n", payload.CVEID)- }- if strings.TrimSpace(payload.ImageName) != "" {- _, _ = fmt.Fprintf(&sb, "**Overview:** %s\n", payload.ImageName)- }- if strings.TrimSpace(payload.FixedVersion) != "" {- _, _ = fmt.Fprintf(&sb, "**Fixable vulnerabilities:** %s\n", payload.FixedVersion)- }- if strings.TrimSpace(payload.Severity) != "" {- _, _ = fmt.Fprintf(&sb, "**Severity breakdown:** %s\n", payload.Severity)- }- if strings.TrimSpace(payload.PkgName) != "" {- _, _ = fmt.Fprintf(&sb, "**Sample CVEs:** %s\n", payload.PkgName)- }- return sb.String()-}--func vulnerabilitySummaryBodySlackInternal(payload VulnerabilityNotificationPayload) string {- var sb strings.Builder- sb.WriteString("📊 *Daily Vulnerability Summary*\n\n")- if strings.TrimSpace(payload.CVEID) != "" {- _, _ = fmt.Fprintf(&sb, "*Summary:* %s\n", payload.CVEID)- }- if strings.TrimSpace(payload.ImageName) != "" {- _, _ = fmt.Fprintf(&sb, "*Overview:* %s\n", payload.ImageName)- }- if strings.TrimSpace(payload.FixedVersion) != "" {- _, _ = fmt.Fprintf(&sb, "*Fixable vulnerabilities:* %s\n", payload.FixedVersion)- }- if strings.TrimSpace(payload.Severity) != "" {- _, _ = fmt.Fprintf(&sb, "*Severity breakdown:* %s\n", payload.Severity)- }- if strings.TrimSpace(payload.PkgName) != "" {- _, _ = fmt.Fprintf(&sb, "*Sample CVEs:* %s\n", payload.PkgName)- }- return sb.String()-}--func vulnerabilitySummaryBodyHTMLInternal(payload VulnerabilityNotificationPayload) string {- var sb strings.Builder- sb.WriteString("📊 <b>Daily Vulnerability Summary</b>\n\n")- if strings.TrimSpace(payload.CVEID) != "" {- _, _ = fmt.Fprintf(&sb, "<b>Summary:</b> %s\n", payload.CVEID)- }- if strings.TrimSpace(payload.ImageName) != "" {- _, _ = fmt.Fprintf(&sb, "<b>Overview:</b> %s\n", payload.ImageName)- }- if strings.TrimSpace(payload.FixedVersion) != "" {- _, _ = fmt.Fprintf(&sb, "<b>Fixable vulnerabilities:</b> %s\n", payload.FixedVersion)- }- if strings.TrimSpace(payload.Severity) != "" {- _, _ = fmt.Fprintf(&sb, "<b>Severity breakdown:</b> %s\n", payload.Severity)- }- if strings.TrimSpace(payload.PkgName) != "" {- _, _ = fmt.Fprintf(&sb, "<b>Sample CVEs:</b> %s\n", payload.PkgName)- }- return sb.String()-}-// SendVulnerabilityNotification notifies all enabled providers that have vulnerability_found event enabled.// Only daily summary payloads are sent; legacy per-CVE payloads are ignored.func (s *NotificationService) SendVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload) error {@@ -398,6 +529,30 @@ func (s *NotificationService) SendVulnerabilityNotification(ctx context.Context,return nil}+ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindVulnerabilityFound,+ VulnerabilityFound: ¬ificationdto.DispatchVulnerabilityFound{+ CVEID: payload.CVEID,+ CVELink: payload.CVELink,+ Severity: payload.Severity,+ ImageName: payload.ImageName,+ FixedVersion: payload.FixedVersion,+ PkgName: payload.PkgName,+ InstalledVersion: payload.InstalledVersion,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendVulnerabilityNotificationForTargetInternal(ctx, target, payload)+}++func (s *NotificationService) sendVulnerabilityNotificationForTargetInternal(ctx context.Context, target NotificationTarget, payload VulnerabilityNotificationPayload) error {settings, err := s.GetAllSettings(ctx)if err != nil {return fmt.Errorf("failed to get notification settings: %w", err)@@ -415,25 +570,25 @@ func (s *NotificationService) SendVulnerabilityNotification(ctx context.Context,var sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendDiscordVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendDiscordVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendEmailVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendEmailVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendTelegramVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendTelegramVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendSignalVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendSignalVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendSlackVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendSlackVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendNtfyVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendNtfyVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendPushoverVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendPushoverVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendGotifyVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendGotifyVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendMatrixVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendMatrixVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendGenericVulnerabilityNotification(ctx, payload, setting.Config)+ sendErr = s.sendGenericVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -462,7 +617,7 @@ func (s *NotificationService) SendVulnerabilityNotification(ctx context.Context,return nil}-func (s *NotificationService) sendDiscordNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendDiscordNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var discordConfig models.DiscordConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -485,24 +640,12 @@ func (s *NotificationService) sendDiscordNotification(ctx context.Context, image}}- // Build message content - Discord embeds via Shoutrrr are sent as formatted markdown- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("**🔔 Container Image Update Notification**\n\n"+- "**Image:** %s\n"+- "**Status:** %s\n"+- "**Update Type:** %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("**Current Digest:** `%s`\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("**Latest Digest:** `%s`\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatMarkdown,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendDiscord(ctx, discordConfig, message); err != nil {return fmt.Errorf("failed to send Discord notification: %w", err)@@ -511,7 +654,7 @@ func (s *NotificationService) sendDiscordNotification(ctx context.Context, imagereturn nil}-func (s *NotificationService) sendTelegramNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendTelegramNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var telegramConfig models.TelegramConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -537,26 +680,12 @@ func (s *NotificationService) sendTelegramNotification(ctx context.Context, imag}}- // Build message content using HTML formatting- // HTML is easier to escape than Markdown and better supported- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- // Use HTML formatting - it's more reliable than Markdown- message := fmt.Sprintf("🔔 <b>Container Image Update Notification</b>\n\n"+- "<b>Image:</b> %s\n"+- "<b>Status:</b> %s\n"+- "<b>Update Type:</b> %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("<b>Current Digest:</b> <code>%s</code>\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("<b>Latest Digest:</b> <code>%s</code>\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatHTML,+ environmentName,+ imageRef,+ updateInfo,+ )// Set parse mode to HTML if not already setif telegramConfig.ParseMode == "" {@@ -570,7 +699,7 @@ func (s *NotificationService) sendTelegramNotification(ctx context.Context, imagreturn nil}-func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendEmailNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var emailConfig models.EmailConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -604,12 +733,12 @@ func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRe}}- htmlBody, _, err := s.renderEmailTemplate(imageRef, updateInfo)+ htmlBody, _, err := s.renderEmailTemplate(environmentName, imageRef, updateInfo)if err != nil {return fmt.Errorf("failed to render email template: %w", err)}- subject := fmt.Sprintf("Container Update Available: %s", notifications.SanitizeForEmail(imageRef))+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("Container Update Available: %s", notifications.SanitizeForEmail(imageRef)))if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}@@ -617,13 +746,13 @@ func (s *NotificationService) sendEmailNotification(ctx context.Context, imageRereturn nil}-func (s *NotificationService) renderEmailTemplate(imageRef string, updateInfo *imageupdate.Response) (string, string, error) {+func (s *NotificationService) renderEmailTemplate(environmentName, imageRef string, updateInfo *imageupdate.Response) (string, string, error) {appURL := s.config.GetAppURL()logoURL := appURL + logoURLPathdata := map[string]any{"LogoURL": logoURL,"AppURL": appURL,- "Environment": "Local Docker",+ "Environment": environmentName,"ImageRef": imageRef,"HasUpdate": updateInfo.HasUpdate,"UpdateType": updateInfo.UpdateType,@@ -665,7 +794,7 @@ func (s *NotificationService) renderEmailTemplate(imageRef string, updateInfo *ireturn htmlBuf.String(), textBuf.String(), nil}-func (s *NotificationService) sendDiscordContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendDiscordContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var discordConfig models.DiscordConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -688,20 +817,14 @@ func (s *NotificationService) sendDiscordContainerUpdateNotification(ctx context}}- // Build message content- message := fmt.Sprintf("**✅ Container Successfully Updated**\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "**Container:** %s\n"+- "**Image:** %s\n"+- "**Status:** ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("**Previous Version:** `%s`\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("**Current Version:** `%s`\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatMarkdown,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendDiscord(ctx, discordConfig, message); err != nil {return fmt.Errorf("failed to send Discord notification: %w", err)@@ -710,7 +833,7 @@ func (s *NotificationService) sendDiscordContainerUpdateNotification(ctx contextreturn nil}-func (s *NotificationService) sendTelegramContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendTelegramContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var telegramConfig models.TelegramConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -736,20 +859,14 @@ func (s *NotificationService) sendTelegramContainerUpdateNotification(ctx contex}}- // Build message content using HTML formatting- message := fmt.Sprintf("✅ <b>Container Successfully Updated</b>\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "<b>Container:</b> %s\n"+- "<b>Image:</b> %s\n"+- "<b>Status:</b> ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("<b>Previous Version:</b> <code>%s</code>\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("<b>Current Version:</b> <code>%s</code>\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatHTML,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )// Set parse mode to HTML if not already setif telegramConfig.ParseMode == "" {@@ -763,7 +880,7 @@ func (s *NotificationService) sendTelegramContainerUpdateNotification(ctx contexreturn nil}-func (s *NotificationService) sendEmailContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendEmailContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var emailConfig models.EmailConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -797,12 +914,12 @@ func (s *NotificationService) sendEmailContainerUpdateNotification(ctx context.C}}- htmlBody, _, err := s.renderContainerUpdateEmailTemplate(containerName, imageRef, oldDigest, newDigest)+ htmlBody, _, err := s.renderContainerUpdateEmailTemplate(environmentName, containerName, imageRef, oldDigest, newDigest)if err != nil {return fmt.Errorf("failed to render email template: %w", err)}- subject := fmt.Sprintf("Container Updated: %s", notifications.SanitizeForEmail(containerName))+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("Container Updated: %s", notifications.SanitizeForEmail(containerName)))if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}@@ -810,13 +927,13 @@ func (s *NotificationService) sendEmailContainerUpdateNotification(ctx context.Creturn nil}-func (s *NotificationService) renderContainerUpdateEmailTemplate(containerName, imageRef, oldDigest, newDigest string) (string, string, error) {+func (s *NotificationService) renderContainerUpdateEmailTemplate(environmentName, containerName, imageRef, oldDigest, newDigest string) (string, string, error) {appURL := s.config.GetAppURL()logoURL := appURL + logoURLPathdata := map[string]any{"LogoURL": logoURL,"AppURL": appURL,- "Environment": "Local Docker",+ "Environment": environmentName,"ContainerName": containerName,"ImageRef": imageRef,"OldDigest": oldDigest,@@ -857,7 +974,7 @@ func (s *NotificationService) renderContainerUpdateEmailTemplate(containerName,return htmlBuf.String(), textBuf.String(), nil}-func (s *NotificationService) TestNotification(ctx context.Context, provider models.NotificationProvider, testType string) error {+func (s *NotificationService) TestNotification(ctx context.Context, environmentID string, provider models.NotificationProvider, testType string) error {setting, err := s.GetSettingsByProvider(ctx, provider)if err != nil {return fmt.Errorf("please save your %s settings before testing", provider)@@ -870,6 +987,11 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider modreturn fmt.Errorf("unsupported notification test type: %s", testType)}+ target, err := s.resolveNotificationTargetInternal(ctx, environmentID)+ if err != nil {+ return err+ }+// Test vulnerability notification (all providers)if testType == notificationTestTypeVulnerability {payload := VulnerabilityNotificationPayload{@@ -881,25 +1003,25 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider mod}switch provider {case models.NotificationProviderDiscord:- return s.sendDiscordVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendDiscordVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderEmail:- return s.sendEmailVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendEmailVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderTelegram:- return s.sendTelegramVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendTelegramVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderSignal:- return s.sendSignalVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendSignalVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderSlack:- return s.sendSlackVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendSlackVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderNtfy:- return s.sendNtfyVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendNtfyVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderPushover:- return s.sendPushoverVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendPushoverVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderGotify:- return s.sendGotifyVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendGotifyVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderMatrix:- return s.sendMatrixVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendMatrixVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)case models.NotificationProviderGeneric:- return s.sendGenericVulnerabilityNotification(ctx, payload, setting.Config)+ return s.sendGenericVulnerabilityNotification(ctx, target.EnvironmentName, payload, setting.Config)default:return fmt.Errorf("unknown provider: %s", provider)}@@ -909,25 +1031,25 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider modtestContainerName := "test-container"switch provider {case models.NotificationProviderDiscord:- return s.sendDiscordAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendDiscordAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderEmail:- return s.sendEmailAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendEmailAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderTelegram:- return s.sendTelegramAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendTelegramAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderSignal:- return s.sendSignalAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendSignalAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderSlack:- return s.sendSlackAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendSlackAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderNtfy:- return s.sendNtfyAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendNtfyAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderPushover:- return s.sendPushoverAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendPushoverAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderGotify:- return s.sendGotifyAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendGotifyAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderMatrix:- return s.sendMatrixAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendMatrixAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)case models.NotificationProviderGeneric:- return s.sendGenericAutoHealNotification(ctx, testContainerName, setting.Config)+ return s.sendGenericAutoHealNotification(ctx, target.EnvironmentName, testContainerName, setting.Config)default:return fmt.Errorf("unknown provider: %s", provider)}@@ -950,25 +1072,25 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider modswitch provider {case models.NotificationProviderDiscord:- return s.sendDiscordPruneNotification(ctx, result, setting.Config)+ return s.sendDiscordPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderEmail:- return s.sendEmailPruneNotification(ctx, result, setting.Config)+ return s.sendEmailPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderTelegram:- return s.sendTelegramPruneNotification(ctx, result, setting.Config)+ return s.sendTelegramPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderSignal:- return s.sendSignalPruneNotification(ctx, result, setting.Config)+ return s.sendSignalPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderSlack:- return s.sendSlackPruneNotification(ctx, result, setting.Config)+ return s.sendSlackPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderNtfy:- return s.sendNtfyPruneNotification(ctx, result, setting.Config)+ return s.sendNtfyPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderPushover:- return s.sendPushoverPruneNotification(ctx, result, setting.Config)+ return s.sendPushoverPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderGotify:- return s.sendGotifyPruneNotification(ctx, result, setting.Config)+ return s.sendGotifyPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderMatrix:- return s.sendMatrixPruneNotification(ctx, result, setting.Config)+ return s.sendMatrixPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderGeneric:- return s.sendGenericPruneNotification(ctx, result, setting.Config)+ return s.sendGenericPruneNotification(ctx, target.EnvironmentName, result, setting.Config)default:return fmt.Errorf("unknown provider: %s", provider)}@@ -1013,25 +1135,25 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider mod}switch provider {case models.NotificationProviderDiscord:- return s.sendBatchDiscordNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchDiscordNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderEmail:- return s.sendBatchEmailNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchEmailNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderTelegram:- return s.sendBatchTelegramNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchTelegramNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderSignal:- return s.sendBatchSignalNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchSignalNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderSlack:- return s.sendBatchSlackNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchSlackNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderNtfy:- return s.sendBatchNtfyNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchNtfyNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderPushover:- return s.sendBatchPushoverNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchPushoverNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderGotify:- return s.sendBatchGotifyNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchGotifyNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderMatrix:- return s.sendBatchMatrixNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchMatrixNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)case models.NotificationProviderGeneric:- return s.sendBatchGenericNotification(ctx, testUpdates, setting.Config)+ return s.sendBatchGenericNotification(ctx, target.EnvironmentName, testUpdates, setting.Config)default:return fmt.Errorf("unknown provider: %s", provider)}@@ -1044,34 +1166,34 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider modswitch provider {case models.NotificationProviderDiscord:- return s.sendDiscordNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendDiscordNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderEmail:if testType == notificationTestTypeSimple {- return s.sendTestEmail(ctx, setting.Config)+ return s.sendTestEmail(ctx, target.EnvironmentName, setting.Config)}- return s.sendEmailNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendEmailNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderTelegram:- return s.sendTelegramNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendTelegramNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderSignal:- return s.sendSignalNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendSignalNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderSlack:- return s.sendSlackNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendSlackNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderNtfy:- return s.sendNtfyNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendNtfyNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderPushover:- return s.sendPushoverNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendPushoverNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderGotify:- return s.sendGotifyNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendGotifyNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderMatrix:- return s.sendMatrixNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendMatrixNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)case models.NotificationProviderGeneric:- return s.sendGenericNotification(ctx, imageRef, testUpdate, setting.Config)+ return s.sendGenericNotification(ctx, target.EnvironmentName, imageRef, testUpdate, setting.Config)default:return fmt.Errorf("unknown provider: %s", provider)}}-func (s *NotificationService) sendTestEmail(ctx context.Context, config models.JSON) error {+func (s *NotificationService) sendTestEmail(ctx context.Context, environmentName string, config models.JSON) error {var emailConfig models.EmailConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1103,12 +1225,12 @@ func (s *NotificationService) sendTestEmail(ctx context.Context, config models.J}}- htmlBody, _, err := s.renderTestEmailTemplate()+ htmlBody, _, err := s.renderTestEmailTemplate(environmentName)if err != nil {return fmt.Errorf("failed to render test email template: %w", err)}- subject := "Test Email from Arcane"+ subject := notifications.BuildEmailSubject(environmentName, "Test Email from Arcane")if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}@@ -1116,12 +1238,13 @@ func (s *NotificationService) sendTestEmail(ctx context.Context, config models.Jreturn nil}-func (s *NotificationService) renderTestEmailTemplate() (string, string, error) {+func (s *NotificationService) renderTestEmailTemplate(environmentName string) (string, string, error) {appURL := s.config.GetAppURL()logoURL := appURL + logoURLPathdata := map[string]any{- "LogoURL": logoURL,- "AppURL": appURL,+ "LogoURL": logoURL,+ "AppURL": appURL,+ "Environment": environmentName,}htmlContent, err := resources.FS.ReadFile("email-templates/test_html.tmpl")@@ -1173,23 +1296,47 @@ func (s *NotificationService) logNotification(ctx context.Context, provider mode}func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error {- if len(updates) == 0 {+ updatesWithChanges := filterUpdatesWithChangesInternal(updates)+ if len(updatesWithChanges) == 0 {return nil}- updatesWithChanges := make(map[string]*imageupdate.Response)+ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindBatchImageUpdate,+ BatchImageUpdate: ¬ificationdto.DispatchBatchImageUpdate{+ Updates: updatesWithChanges,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendBatchImageUpdateNotificationForTargetInternal(ctx, target, updatesWithChanges)+}++func filterUpdatesWithChangesInternal(updates map[string]*imageupdate.Response) map[string]*imageupdate.Response {+ updatesWithChanges := make(map[string]*imageupdate.Response, len(updates))for imageRef, update := range updates {if update != nil && update.HasUpdate {updatesWithChanges[imageRef] = update}}+ return updatesWithChanges+}++func (s *NotificationService) sendBatchImageUpdateNotificationForTargetInternal(ctx context.Context, target NotificationTarget, updates map[string]*imageupdate.Response) error {+ updatesWithChanges := filterUpdatesWithChangesInternal(updates)if len(updatesWithChanges) == 0 {return nil}// Send to Apprise if enabled- if appriseErr := s.appriseService.SendBatchImageUpdateNotification(ctx, updatesWithChanges); appriseErr != nil {+ if appriseErr := s.appriseService.SendBatchImageUpdateNotification(ctx, target.EnvironmentName, updatesWithChanges); appriseErr != nil {slog.WarnContext(ctx, "Failed to send Apprise notification", "error", appriseErr)}@@ -1211,25 +1358,25 @@ func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Contevar sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendBatchDiscordNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchDiscordNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendBatchEmailNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchEmailNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendBatchTelegramNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchTelegramNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendBatchSignalNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchSignalNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendBatchSlackNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchSlackNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendBatchNtfyNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchNtfyNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendBatchPushoverNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchPushoverNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendBatchGotifyNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchGotifyNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendBatchMatrixNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchMatrixNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendBatchGenericNotification(ctx, updatesWithChanges, setting.Config)+ sendErr = s.sendBatchGenericNotification(ctx, target.EnvironmentName, updatesWithChanges, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -1263,7 +1410,7 @@ func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Contereturn nil}-func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var discordConfig models.DiscordConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1278,36 +1425,20 @@ func (s *NotificationService) sendBatchDiscordNotification(ctx context.Context,discordConfig.Token = decrypted}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "**%s**\n\n%s\n\n", title, description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatMarkdown,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "**%s**\n"+- "• **Type:** %s\n"+- "• **Current:** `%s`\n"+- "• **Latest:** `%s`\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendDiscord(ctx, discordConfig, message.String()); err != nil {+ if err := notifications.SendDiscord(ctx, discordConfig, message); err != nil {return fmt.Errorf("failed to send batch Discord notification: %w", err)}return nil}-func (s *NotificationService) sendBatchTelegramNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchTelegramNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var telegramConfig models.TelegramConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1322,41 +1453,25 @@ func (s *NotificationService) sendBatchTelegramNotification(ctx context.Context,telegramConfig.BotToken = decrypted}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "<b>%s</b>\n\n%s\n\n", title, description)-- for imageRef, update := range updates {- fmt.Fprintf(&message, "<b>%s</b>\n"+- "• <b>Type:</b> %s\n"+- "• <b>Current:</b> <code>%s</code>\n"+- "• <b>Latest:</b> <code>%s</code>\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatHTML,+ environmentName,+ updates,+ )// Set parse mode to HTML if not already setif telegramConfig.ParseMode == "" {telegramConfig.ParseMode = "HTML"}- if err := notifications.SendTelegram(ctx, telegramConfig, message.String()); err != nil {+ if err := notifications.SendTelegram(ctx, telegramConfig, message); err != nil {return fmt.Errorf("failed to send batch Telegram notification: %w", err)}return nil}-func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var emailConfig models.EmailConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1390,18 +1505,18 @@ func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, up}}- htmlBody, _, err := s.renderBatchEmailTemplate(updates)+ htmlBody, _, err := s.renderBatchEmailTemplate(environmentName, updates)if err != nil {return fmt.Errorf("failed to render email template: %w", err)}updateCount := len(updates)- subject := fmt.Sprintf("%d Image Update%s Available", updateCount, func() string {+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("%d Image Update%s Available", updateCount, func() string {if updateCount > 1 {return "s"}return ""- }())+ }()))if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}@@ -1409,7 +1524,7 @@ func (s *NotificationService) sendBatchEmailNotification(ctx context.Context, upreturn nil}-func (s *NotificationService) renderBatchEmailTemplate(updates map[string]*imageupdate.Response) (string, string, error) {+func (s *NotificationService) renderBatchEmailTemplate(environmentName string, updates map[string]*imageupdate.Response) (string, string, error) {// Build list of image namesimageList := make([]string, 0, len(updates))for imageRef := range updates {@@ -1421,6 +1536,7 @@ func (s *NotificationService) renderBatchEmailTemplate(updates map[string]*imagedata := map[string]any{"LogoURL": logoURL,"AppURL": appURL,+ "Environment": environmentName,"UpdateCount": len(updates),"CheckTime": time.Now().Format(time.RFC1123),"ImageList": imageList,@@ -1459,7 +1575,7 @@ func (s *NotificationService) renderBatchEmailTemplate(updates map[string]*imagereturn htmlBuf.String(), textBuf.String(), nil}-func (s *NotificationService) sendSignalNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendSignalNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var signalConfig models.SignalConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1508,24 +1624,12 @@ func (s *NotificationService) sendSignalNotification(ctx context.Context, imageR}}- // Build message content- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendSignal(ctx, signalConfig, message); err != nil {return fmt.Errorf("failed to send Signal notification: %w", err)@@ -1534,7 +1638,7 @@ func (s *NotificationService) sendSignalNotification(ctx context.Context, imageRreturn nil}-func (s *NotificationService) sendSignalContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendSignalContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var signalConfig models.SignalConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1583,20 +1687,14 @@ func (s *NotificationService) sendSignalContainerUpdateNotification(ctx context.}}- // Build message content- message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendSignal(ctx, signalConfig, message); err != nil {return fmt.Errorf("failed to send Signal notification: %w", err)@@ -1605,7 +1703,7 @@ func (s *NotificationService) sendSignalContainerUpdateNotification(ctx context.return nil}-func (s *NotificationService) sendBatchSignalNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchSignalNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var signalConfig models.SignalConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1637,36 +1735,20 @@ func (s *NotificationService) sendBatchSignalNotification(ctx context.Context, u}}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendSignal(ctx, signalConfig, message.String()); err != nil {+ if err := notifications.SendSignal(ctx, signalConfig, message); err != nil {return fmt.Errorf("failed to send batch Signal notification: %w", err)}return nil}-func (s *NotificationService) sendSlackNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendSlackNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var slackConfig models.SlackConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1689,24 +1771,12 @@ func (s *NotificationService) sendSlackNotification(ctx context.Context, imageRe}}- // Build message content- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 *Container Image Update Notification*\n\n"+- "*Image:* %s\n"+- "*Status:* %s\n"+- "*Update Type:* %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("*Current Digest:* `%s`\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("*Latest Digest:* `%s`\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatSlack,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendSlack(ctx, slackConfig, message); err != nil {return fmt.Errorf("failed to send Slack notification: %w", err)@@ -1715,7 +1785,7 @@ func (s *NotificationService) sendSlackNotification(ctx context.Context, imageRereturn nil}-func (s *NotificationService) sendSlackContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendSlackContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var slackConfig models.SlackConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1738,20 +1808,14 @@ func (s *NotificationService) sendSlackContainerUpdateNotification(ctx context.C}}- // Build message content- message := fmt.Sprintf("✅ *Container Successfully Updated*\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "*Container:* %s\n"+- "*Image:* %s\n"+- "*Status:* ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("*Previous Version:* `%s`\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("*Current Version:* `%s`\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatSlack,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendSlack(ctx, slackConfig, message); err != nil {return fmt.Errorf("failed to send Slack notification: %w", err)@@ -1760,7 +1824,7 @@ func (s *NotificationService) sendSlackContainerUpdateNotification(ctx context.Creturn nil}-func (s *NotificationService) sendBatchSlackNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchSlackNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var slackConfig models.SlackConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1775,36 +1839,20 @@ func (s *NotificationService) sendBatchSlackNotification(ctx context.Context, upslackConfig.Token = decrypted}- // Build batch message content- title := "*Container Image Updates Available*"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatSlack,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "*%s*\n"+- "• *Type:* %s\n"+- "• *Current:* `%s`\n"+- "• *Latest:* `%s`\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendSlack(ctx, slackConfig, message.String()); err != nil {+ if err := notifications.SendSlack(ctx, slackConfig, message); err != nil {return fmt.Errorf("failed to send batch Slack notification: %w", err)}return nil}-func (s *NotificationService) sendNtfyNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendNtfyNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var ntfyConfig models.NtfyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1827,24 +1875,12 @@ func (s *NotificationService) sendNtfyNotification(ctx context.Context, imageRef}}- // Build message content- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendNtfy(ctx, ntfyConfig, message); err != nil {return fmt.Errorf("failed to send Ntfy notification: %w", err)@@ -1853,7 +1889,7 @@ func (s *NotificationService) sendNtfyNotification(ctx context.Context, imageRefreturn nil}-func (s *NotificationService) sendNtfyContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendNtfyContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var ntfyConfig models.NtfyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1876,20 +1912,14 @@ func (s *NotificationService) sendNtfyContainerUpdateNotification(ctx context.Co}}- // Build message content- message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendNtfy(ctx, ntfyConfig, message); err != nil {return fmt.Errorf("failed to send Ntfy notification: %w", err)@@ -1898,7 +1928,7 @@ func (s *NotificationService) sendNtfyContainerUpdateNotification(ctx context.Coreturn nil}-func (s *NotificationService) sendBatchNtfyNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchNtfyNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var ntfyConfig models.NtfyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1915,36 +1945,20 @@ func (s *NotificationService) sendBatchNtfyNotification(ctx context.Context, upd}}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendNtfy(ctx, ntfyConfig, message.String()); err != nil {+ if err := notifications.SendNtfy(ctx, ntfyConfig, message); err != nil {return fmt.Errorf("failed to send batch Ntfy notification: %w", err)}return nil}-func (s *NotificationService) sendPushoverNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendPushoverNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var pushoverConfig models.PushoverConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -1969,23 +1983,12 @@ func (s *NotificationService) sendPushoverNotification(ctx context.Context, imag}}- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {return fmt.Errorf("failed to send Pushover notification: %w", err)@@ -1994,7 +1997,7 @@ func (s *NotificationService) sendPushoverNotification(ctx context.Context, imagreturn nil}-func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var pushoverConfig models.PushoverConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2019,19 +2022,14 @@ func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx contex}}- message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {return fmt.Errorf("failed to send Pushover notification: %w", err)@@ -2040,7 +2038,7 @@ func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx contexreturn nil}-func (s *NotificationService) sendBatchPushoverNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchPushoverNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var pushoverConfig models.PushoverConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2056,36 +2054,20 @@ func (s *NotificationService) sendBatchPushoverNotification(ctx context.Context,}}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)-- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendPushover(ctx, pushoverConfig, message.String()); err != nil {+ if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {return fmt.Errorf("failed to send batch Pushover notification: %w", err)}return nil}-func (s *NotificationService) sendGenericNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendGenericNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var genericConfig models.GenericConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2099,26 +2081,13 @@ func (s *NotificationService) sendGenericNotification(ctx context.Context, imagereturn fmt.Errorf("webhook URL not configured")}- // Build message content- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "Update Available"- }-- message := fmt.Sprintf("Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }-- // Use SendGenericWithTitle to include a titletitle := "Container Image Update"if err := notifications.SendGenericWithTitle(ctx, genericConfig, title, message); err != nil {return fmt.Errorf("failed to send Generic webhook notification: %w", err)@@ -2127,7 +2096,7 @@ func (s *NotificationService) sendGenericNotification(ctx context.Context, imagereturn nil}-func (s *NotificationService) sendGenericContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendGenericContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var genericConfig models.GenericConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2141,22 +2110,15 @@ func (s *NotificationService) sendGenericContainerUpdateNotification(ctx contextreturn fmt.Errorf("webhook URL not configured")}- // Build message content- message := fmt.Sprintf("Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )- // Use SendGenericWithTitle to include a titletitle := "Container Updated"if err := notifications.SendGenericWithTitle(ctx, genericConfig, title, message); err != nil {return fmt.Errorf("failed to send Generic webhook notification: %w", err)@@ -2165,12 +2127,13 @@ func (s *NotificationService) sendGenericContainerUpdateNotification(ctx contextreturn nil}-func (s *NotificationService) renderVulnerabilitySummaryEmailTemplate(payload VulnerabilityNotificationPayload) (string, string, error) {+func (s *NotificationService) renderVulnerabilitySummaryEmailTemplate(environmentName string, payload VulnerabilityNotificationPayload) (string, string, error) {appURL := s.config.GetAppURL()logoURL := appURL + logoURLPathdata := map[string]any{"LogoURL": logoURL,"AppURL": appURL,+ "Environment": environmentName,"SummaryLabel": payload.CVEID,"Overview": payload.ImageName,"FixableCount": payload.FixedVersion,@@ -2206,7 +2169,7 @@ func (s *NotificationService) renderVulnerabilitySummaryEmailTemplate(payload Vureturn htmlBuf.String(), textBuf.String(), nil}-func (s *NotificationService) sendEmailVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendEmailVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var emailConfig models.EmailConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2236,18 +2199,18 @@ func (s *NotificationService) sendEmailVulnerabilityNotification(ctx context.Conslog.Warn("Failed to decrypt email SMTP password, using raw value (may be unencrypted legacy value)", "error", err)}}- htmlBody, _, err := s.renderVulnerabilitySummaryEmailTemplate(payload)+ htmlBody, _, err := s.renderVulnerabilitySummaryEmailTemplate(environmentName, payload)if err != nil {return fmt.Errorf("failed to render summary email template: %w", err)}- subject := fmt.Sprintf("Daily Vulnerability Summary: %s", notifications.SanitizeForEmail(payload.CVEID))+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("Daily Vulnerability Summary: %s", notifications.SanitizeForEmail(payload.CVEID)))if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}return nil}-func (s *NotificationService) sendDiscordVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendDiscordVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var discordConfig models.DiscordConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2266,13 +2229,22 @@ func (s *NotificationService) sendDiscordVulnerabilityNotification(ctx context.Cslog.Warn("Failed to decrypt Discord token, using raw value (may be unencrypted legacy value)", "error", err)}}- if err := notifications.SendDiscord(ctx, discordConfig, vulnerabilitySummaryBodyMarkdownInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatMarkdown,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendDiscord(ctx, discordConfig, message); err != nil {return fmt.Errorf("failed to send Discord notification: %w", err)}return nil}-func (s *NotificationService) sendTelegramVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendTelegramVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var telegramConfig models.TelegramConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2297,13 +2269,22 @@ func (s *NotificationService) sendTelegramVulnerabilityNotification(ctx context.if telegramConfig.ParseMode == "" {telegramConfig.ParseMode = "HTML"}- if err := notifications.SendTelegram(ctx, telegramConfig, vulnerabilitySummaryBodyHTMLInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatHTML,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendTelegram(ctx, telegramConfig, message); err != nil {return fmt.Errorf("failed to send Telegram notification: %w", err)}return nil}-func (s *NotificationService) sendSignalVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendSignalVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var signalConfig models.SignalConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2325,13 +2306,22 @@ func (s *NotificationService) sendSignalVulnerabilityNotification(ctx context.CosignalConfig.Token = decrypted}}- if err := notifications.SendSignal(ctx, signalConfig, vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendSignal(ctx, signalConfig, message); err != nil {return fmt.Errorf("failed to send Signal notification: %w", err)}return nil}-func (s *NotificationService) sendSlackVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendSlackVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var slackConfig models.SlackConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2350,13 +2340,22 @@ func (s *NotificationService) sendSlackVulnerabilityNotification(ctx context.Conslog.Warn("Failed to decrypt Slack token, using raw value (may be unencrypted legacy value)", "error", err)}}- if err := notifications.SendSlack(ctx, slackConfig, vulnerabilitySummaryBodySlackInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatSlack,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendSlack(ctx, slackConfig, message); err != nil {return fmt.Errorf("failed to send Slack notification: %w", err)}return nil}-func (s *NotificationService) sendNtfyVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendNtfyVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var ntfyConfig models.NtfyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2373,13 +2372,22 @@ func (s *NotificationService) sendNtfyVulnerabilityNotification(ctx context.ContntfyConfig.Password = decrypted}}- if err := notifications.SendNtfy(ctx, ntfyConfig, vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendNtfy(ctx, ntfyConfig, message); err != nil {return fmt.Errorf("failed to send Ntfy notification: %w", err)}return nil}-func (s *NotificationService) sendPushoverVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendPushoverVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var pushoverConfig models.PushoverConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2396,13 +2404,25 @@ func (s *NotificationService) sendPushoverVulnerabilityNotification(ctx context.pushoverConfig.Token = decrypted}}- if err := notifications.SendPushover(ctx, pushoverConfig, vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if pushoverConfig.Title == "" {+ pushoverConfig.Title = notifications.BuildEmailSubject(environmentName, "Daily Vulnerability Summary")+ }+ if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {return fmt.Errorf("failed to send Pushover notification: %w", err)}return nil}-func (s *NotificationService) sendGotifyVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendGotifyVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var gotifyConfig models.GotifyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2416,13 +2436,25 @@ func (s *NotificationService) sendGotifyVulnerabilityNotification(ctx context.CogotifyConfig.Token = decrypted}}- if err := notifications.SendGotify(ctx, gotifyConfig, vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if gotifyConfig.Title == "" {+ gotifyConfig.Title = notifications.BuildEmailSubject(environmentName, "Daily Vulnerability Summary")+ }+ if err := notifications.SendGotify(ctx, gotifyConfig, message); err != nil {return fmt.Errorf("failed to send Gotify notification: %w", err)}return nil}-func (s *NotificationService) sendMatrixVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendMatrixVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var matrixConfig models.MatrixConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2436,13 +2468,22 @@ func (s *NotificationService) sendMatrixVulnerabilityNotification(ctx context.ComatrixConfig.Password = decrypted}}- if err := notifications.SendMatrix(ctx, matrixConfig, vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ if err := notifications.SendMatrix(ctx, matrixConfig, message); err != nil {return fmt.Errorf("failed to send Matrix notification: %w", err)}return nil}-func (s *NotificationService) sendGenericVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload, config models.JSON) error {+func (s *NotificationService) sendGenericVulnerabilityNotification(ctx context.Context, environmentName string, payload VulnerabilityNotificationPayload, config models.JSON) error {var genericConfig models.GenericConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2454,13 +2495,23 @@ func (s *NotificationService) sendGenericVulnerabilityNotification(ctx context.Cif genericConfig.WebhookURL == "" {return fmt.Errorf("webhook URL not configured")}- if err := notifications.SendGenericWithTitle(ctx, genericConfig, vulnerabilitySummaryTitleInternal(payload), vulnerabilitySummaryBodyPlainInternal(payload)); err != nil {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ payload.CVEID,+ payload.ImageName,+ payload.FixedVersion,+ payload.Severity,+ payload.PkgName,+ )+ title := notifications.BuildEmailSubject(environmentName, "Daily Vulnerability Summary")+ if err := notifications.SendGenericWithTitle(ctx, genericConfig, title, message); err != nil {return fmt.Errorf("failed to send Generic webhook notification: %w", err)}return nil}-func (s *NotificationService) sendBatchGenericNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchGenericNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var genericConfig models.GenericConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2474,36 +2525,21 @@ func (s *NotificationService) sendBatchGenericNotification(ctx context.Context,return fmt.Errorf("webhook URL not configured")}- // Build batch message contenttitle := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n", description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendGenericWithTitle(ctx, genericConfig, title, message.String()); err != nil {+ if err := notifications.SendGenericWithTitle(ctx, genericConfig, title, message); err != nil {return fmt.Errorf("failed to send batch Generic webhook notification: %w", err)}return nil}-func (s *NotificationService) sendGotifyNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendGotifyNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var gotifyConfig models.GotifyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2521,23 +2557,12 @@ func (s *NotificationService) sendGotifyNotification(ctx context.Context, imageR}}- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendGotify(ctx, gotifyConfig, message); err != nil {return fmt.Errorf("failed to send Gotify notification: %w", err)@@ -2546,7 +2571,7 @@ func (s *NotificationService) sendGotifyNotification(ctx context.Context, imageRreturn nil}-func (s *NotificationService) sendGotifyContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendGotifyContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var gotifyConfig models.GotifyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2564,19 +2589,14 @@ func (s *NotificationService) sendGotifyContainerUpdateNotification(ctx context.}}- message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendGotify(ctx, gotifyConfig, message); err != nil {return fmt.Errorf("failed to send Gotify notification: %w", err)@@ -2585,7 +2605,7 @@ func (s *NotificationService) sendGotifyContainerUpdateNotification(ctx context.return nil}-func (s *NotificationService) sendBatchGotifyNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchGotifyNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var gotifyConfig models.GotifyConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2601,36 +2621,20 @@ func (s *NotificationService) sendBatchGotifyNotification(ctx context.Context, u}}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)-- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendGotify(ctx, gotifyConfig, message.String()); err != nil {+ if err := notifications.SendGotify(ctx, gotifyConfig, message); err != nil {return fmt.Errorf("failed to send batch Gotify notification: %w", err)}return nil}-func (s *NotificationService) sendMatrixNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendMatrixNotification(ctx context.Context, environmentName, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {var matrixConfig models.MatrixConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2646,23 +2650,12 @@ func (s *NotificationService) sendMatrixNotification(ctx context.Context, imageR}}- updateStatus := "No Update"- if updateInfo.HasUpdate {- updateStatus = "⚠️ Update Available"- }-- message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+- "Image: %s\n"+- "Status: %s\n"+- "Update Type: %s\n",- imageRef, updateStatus, updateInfo.UpdateType)-- if updateInfo.CurrentDigest != "" {- message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)- }- if updateInfo.LatestDigest != "" {- message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)- }+ message := notifications.BuildImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ imageRef,+ updateInfo,+ )if err := notifications.SendMatrix(ctx, matrixConfig, message); err != nil {return fmt.Errorf("failed to send Matrix notification: %w", err)@@ -2671,7 +2664,7 @@ func (s *NotificationService) sendMatrixNotification(ctx context.Context, imageRreturn nil}-func (s *NotificationService) sendMatrixContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {+func (s *NotificationService) sendMatrixContainerUpdateNotification(ctx context.Context, environmentName, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {var matrixConfig models.MatrixConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2687,19 +2680,14 @@ func (s *NotificationService) sendMatrixContainerUpdateNotification(ctx context.}}- message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+- "Your container has been updated with the latest image version.\n\n"+- "Container: %s\n"+- "Image: %s\n"+- "Status: ✅ Updated Successfully\n",- containerName, imageRef)-- if oldDigest != "" {- message += fmt.Sprintf("Previous Version: %s\n", oldDigest)- }- if newDigest != "" {- message += fmt.Sprintf("Current Version: %s\n", newDigest)- }+ message := notifications.BuildContainerUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ containerName,+ imageRef,+ oldDigest,+ newDigest,+ )if err := notifications.SendMatrix(ctx, matrixConfig, message); err != nil {return fmt.Errorf("failed to send Matrix notification: %w", err)@@ -2708,7 +2696,7 @@ func (s *NotificationService) sendMatrixContainerUpdateNotification(ctx context.return nil}-func (s *NotificationService) sendBatchMatrixNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {+func (s *NotificationService) sendBatchMatrixNotification(ctx context.Context, environmentName string, updates map[string]*imageupdate.Response, config models.JSON) error {var matrixConfig models.MatrixConfigconfigBytes, err := json.Marshal(config)if err != nil {@@ -2724,29 +2712,13 @@ func (s *NotificationService) sendBatchMatrixNotification(ctx context.Context, u}}- // Build batch message content- title := "Container Image Updates Available"- description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))- if len(updates) == 1 {- description = "1 container image has an update available."- }-- var message strings.Builder- fmt.Fprintf(&message, "%s\n\n%s\n\n", title, description)+ message := notifications.BuildBatchImageUpdateNotificationMessage(+ notifications.MessageFormatPlain,+ environmentName,+ updates,+ )- for imageRef, update := range updates {- fmt.Fprintf(&message, "%s\n"+- "• Type: %s\n"+- "• Current: %s\n"+- "• Latest: %s\n\n",- imageRef,- update.UpdateType,- update.CurrentDigest,- update.LatestDigest,- )- }-- if err := notifications.SendMatrix(ctx, matrixConfig, message.String()); err != nil {+ if err := notifications.SendMatrix(ctx, matrixConfig, message); err != nil {return fmt.Errorf("failed to send batch Matrix notification: %w", err)}@@ -2858,6 +2830,27 @@ func (s *NotificationService) SendPruneReportNotification(ctx context.Context, rreturn nil}+ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindPruneReport,+ PruneReport: ¬ificationdto.DispatchPruneReport{+ Result: *result,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendPruneReportNotificationForTargetInternal(ctx, target, result)+}++func (s *NotificationService) sendPruneReportNotificationForTargetInternal(ctx context.Context, target NotificationTarget, result *system.PruneAllResult) error {+ hasChanges := pruneResultHasChangesInternal(result)+ hasErrors := result != nil && len(result.Errors) > 0+settings, err := s.GetAllSettings(ctx)if err != nil {return fmt.Errorf("failed to get notification settings: %w", err)@@ -2876,25 +2869,25 @@ func (s *NotificationService) SendPruneReportNotification(ctx context.Context, rvar sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendDiscordPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendDiscordPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendEmailPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendEmailPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendTelegramPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendTelegramPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendSignalPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendSignalPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendSlackPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendSlackPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendNtfyPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendNtfyPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendPushoverPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendPushoverPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendGotifyPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendGotifyPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendMatrixPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendMatrixPruneNotification(ctx, target.EnvironmentName, result, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendGenericPruneNotification(ctx, result, setting.Config)+ sendErr = s.sendGenericPruneNotification(ctx, target.EnvironmentName, result, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -2953,7 +2946,7 @@ func (s *NotificationService) formatBytesInternal(bytes uint64) string {return fmt.Sprintf("%.1f %cB", float64(bytes)/float64(div), "KMGTPE"[exp])}-func (s *NotificationService) sendDiscordPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendDiscordPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var discordConfig models.DiscordConfigif err := s.unmarshalConfigInternal(config, &discordConfig); err != nil {return err@@ -2965,18 +2958,7 @@ func (s *NotificationService) sendDiscordPruneNotification(ctx context.Context,s.decryptDiscordTokenInternal(&discordConfig)- message := fmt.Sprintf("**🧹 System Prune Report**\n\n"+- "**Total Space Reclaimed:** %s\n\n"+- "**Breakdown:**\n"+- "- 📦 **Containers:** %s\n"+- "- 🖼️ **Images:** %s\n"+- "- 💾 **Volumes:** %s\n"+- "- 🏗️ **Build Cache:** %s\n",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatMarkdown, environmentName, result)if err := notifications.SendDiscord(ctx, discordConfig, message); err != nil {return fmt.Errorf("failed to send Discord notification: %w", err)@@ -2985,7 +2967,7 @@ func (s *NotificationService) sendDiscordPruneNotification(ctx context.Context,return nil}-func (s *NotificationService) sendTelegramPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendTelegramPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var telegramConfig models.TelegramConfigif err := s.unmarshalConfigInternal(config, &telegramConfig); err != nil {return err@@ -2997,18 +2979,7 @@ func (s *NotificationService) sendTelegramPruneNotification(ctx context.Context,s.decryptTelegramTokenInternal(&telegramConfig)- message := fmt.Sprintf("🧹 <b>System Prune Report</b>\n\n"+- "<b>Total Space Reclaimed:</b> %s\n\n"+- "<b>Breakdown:</b>\n"+- "- 📦 <b>Containers:</b> %s\n"+- "- 🖼️ <b>Images:</b> %s\n"+- "- 💾 <b>Volumes:</b> %s\n"+- "- 🏗️ <b>Build Cache:</b> %s\n",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatHTML, environmentName, result)if telegramConfig.ParseMode == "" {telegramConfig.ParseMode = "HTML"@@ -3021,7 +2992,7 @@ func (s *NotificationService) sendTelegramPruneNotification(ctx context.Context,return nil}-func (s *NotificationService) sendEmailPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendEmailPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var emailConfig models.EmailConfigif err := s.unmarshalConfigInternal(config, &emailConfig); err != nil {return err@@ -3033,12 +3004,12 @@ func (s *NotificationService) sendEmailPruneNotification(ctx context.Context, res.decryptEmailPasswordInternal(&emailConfig)- htmlBody, _, err := s.renderPruneReportEmailTemplate(result)+ htmlBody, _, err := s.renderPruneReportEmailTemplate(environmentName, result)if err != nil {return fmt.Errorf("failed to render email template: %w", err)}- subject := fmt.Sprintf("System Prune Report: %s Reclaimed", s.formatBytesInternal(result.SpaceReclaimed))+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("System Prune Report: %s Reclaimed", s.formatBytesInternal(result.SpaceReclaimed)))if err := notifications.SendEmail(ctx, emailConfig, subject, htmlBody); err != nil {return fmt.Errorf("failed to send email: %w", err)}@@ -3046,12 +3017,13 @@ func (s *NotificationService) sendEmailPruneNotification(ctx context.Context, rereturn nil}-func (s *NotificationService) renderPruneReportEmailTemplate(result *system.PruneAllResult) (string, string, error) {+func (s *NotificationService) renderPruneReportEmailTemplate(environmentName string, result *system.PruneAllResult) (string, string, error) {appURL := s.config.GetAppURL()logoURL := appURL + logoURLPathdata := map[string]any{"LogoURL": logoURL,"AppURL": appURL,+ "Environment": environmentName,"TotalSpaceReclaimed": s.formatBytesInternal(result.SpaceReclaimed),"ContainerSpaceReclaimed": s.formatBytesInternal(result.ContainerSpaceReclaimed),"ImageSpaceReclaimed": s.formatBytesInternal(result.ImageSpaceReclaimed),@@ -3063,165 +3035,112 @@ func (s *NotificationService) renderPruneReportEmailTemplate(result *system.Prunreturn s.renderTemplatesInternal("prune-report", data)}-func (s *NotificationService) sendSignalPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendSignalPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var signalConfig models.SignalConfigif err := s.unmarshalConfigInternal(config, &signalConfig); err != nil {return err}- message := fmt.Sprintf("🧹 System Prune Report\n\n"+- "Total Space Reclaimed: %s\n\n"+- "Breakdown:\n"+- "- Containers: %s\n"+- "- Images: %s\n"+- "- Volumes: %s\n"+- "- Build Cache: %s\n",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)return notifications.SendSignal(ctx, signalConfig, message)}-func (s *NotificationService) sendSlackPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendSlackPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var slackConfig models.SlackConfigif err := s.unmarshalConfigInternal(config, &slackConfig); err != nil {return err}- message := fmt.Sprintf("*🧹 System Prune Report*\n\n"+- "*Total Space Reclaimed:* %s\n\n"+- "*Breakdown:*\n"+- "- 📦 *Containers:* %s\n"+- "- 🖼️ *Images:* %s\n"+- "- 💾 *Volumes:* %s\n"+- "- 🏗️ *Build Cache:* %s\n",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatSlack, environmentName, result)return notifications.SendSlack(ctx, slackConfig, message)}-func (s *NotificationService) sendNtfyPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendNtfyPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var ntfyConfig models.NtfyConfigif err := s.unmarshalConfigInternal(config, &ntfyConfig); err != nil {return err}- message := fmt.Sprintf("Total Space Reclaimed: %s\n\n"+- "Breakdown:\n"+- "Containers: %s\n"+- "Images: %s\n"+- "Volumes: %s\n"+- "Build Cache: %s",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)return notifications.SendNtfy(ctx, ntfyConfig, message)}-func (s *NotificationService) sendPushoverPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendPushoverPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var pushoverConfig models.PushoverConfigif err := s.unmarshalConfigInternal(config, &pushoverConfig); err != nil {return err}- message := fmt.Sprintf("Total Space Reclaimed: %s\n\n"+- "Breakdown:\n"+- "Containers: %s\n"+- "Images: %s\n"+- "Volumes: %s\n"+- "Build Cache: %s",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)if pushoverConfig.Title == "" {- pushoverConfig.Title = "System Prune Report"+ pushoverConfig.Title = notifications.BuildEmailSubject(environmentName, "System Prune Report")}return notifications.SendPushover(ctx, pushoverConfig, message)}-func (s *NotificationService) sendGotifyPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendGotifyPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var gotifyConfig models.GotifyConfigif err := s.unmarshalConfigInternal(config, &gotifyConfig); err != nil {return err}- message := fmt.Sprintf("Total Space Reclaimed: %s\n"+- "Breakdown:\n"+- "Containers: %s\n"+- "Images: %s\n"+- "Volumes: %s\n"+- "Build Cache: %s",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)if gotifyConfig.Title == "" {- gotifyConfig.Title = "System Prune Report"+ gotifyConfig.Title = notifications.BuildEmailSubject(environmentName, "System Prune Report")}return notifications.SendGotify(ctx, gotifyConfig, message)}-func (s *NotificationService) sendMatrixPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendMatrixPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var matrixConfig models.MatrixConfigif err := s.unmarshalConfigInternal(config, &matrixConfig); err != nil {return err}- message := fmt.Sprintf("Total Space Reclaimed: %s\n"+- "Breakdown:\n"+- "Containers: %s\n"+- "Images: %s\n"+- "Volumes: %s\n"+- "Build Cache: %s",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)return notifications.SendMatrix(ctx, matrixConfig, message)}-func (s *NotificationService) sendGenericPruneNotification(ctx context.Context, result *system.PruneAllResult, config models.JSON) error {+func (s *NotificationService) sendGenericPruneNotification(ctx context.Context, environmentName string, result *system.PruneAllResult, config models.JSON) error {var genericConfig models.GenericConfigif err := s.unmarshalConfigInternal(config, &genericConfig); err != nil {return err}- message := fmt.Sprintf("System Prune Report\n"+- "Total Space Reclaimed: %s\n"+- "Containers: %s\n"+- "Images: %s\n"+- "Volumes: %s\n"+- "Build Cache: %s",- s.formatBytesInternal(result.SpaceReclaimed),- s.formatBytesInternal(result.ContainerSpaceReclaimed),- s.formatBytesInternal(result.ImageSpaceReclaimed),- s.formatBytesInternal(result.VolumeSpaceReclaimed),- s.formatBytesInternal(result.BuildCacheSpaceReclaimed))-- return notifications.SendGenericWithTitle(ctx, genericConfig, "System Prune Report", message)+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatPlain, environmentName, result)+ title := notifications.BuildEmailSubject(environmentName, "System Prune Report")+ return notifications.SendGenericWithTitle(ctx, genericConfig, title, message)}// SendAutoHealNotification sends a notification when a container is auto-healed.func (s *NotificationService) SendAutoHealNotification(ctx context.Context, containerName, containerID string) error {+ if s.config != nil && s.config.AgentMode {+ return s.dispatchNotificationToManagerInternal(ctx, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindAutoHeal,+ AutoHeal: ¬ificationdto.DispatchAutoHeal{+ ContainerName: containerName,+ ContainerID: containerID,+ },+ })+ }++ target, err := s.resolveNotificationTargetInternal(ctx, "")+ if err != nil {+ return err+ }++ return s.sendAutoHealNotificationForTargetInternal(ctx, target, containerName, containerID)+}++func (s *NotificationService) sendAutoHealNotificationForTargetInternal(ctx context.Context, target NotificationTarget, containerName, containerID string) error {settings, err := s.GetAllSettings(ctx)if err != nil {return fmt.Errorf("failed to get notification settings: %w", err)@@ -3240,25 +3159,25 @@ func (s *NotificationService) SendAutoHealNotification(ctx context.Context, contvar sendErr errorswitch setting.Provider {case models.NotificationProviderDiscord:- sendErr = s.sendDiscordAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendDiscordAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderEmail:- sendErr = s.sendEmailAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendEmailAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderTelegram:- sendErr = s.sendTelegramAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendTelegramAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderSignal:- sendErr = s.sendSignalAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendSignalAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderSlack:- sendErr = s.sendSlackAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendSlackAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderNtfy:- sendErr = s.sendNtfyAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendNtfyAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderPushover:- sendErr = s.sendPushoverAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendPushoverAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderGotify:- sendErr = s.sendGotifyAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendGotifyAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderMatrix:- sendErr = s.sendMatrixAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendMatrixAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)case models.NotificationProviderGeneric:- sendErr = s.sendGenericAutoHealNotification(ctx, containerName, setting.Config)+ sendErr = s.sendGenericAutoHealNotification(ctx, target.EnvironmentName, containerName, setting.Config)default:slog.WarnContext(ctx, "Unknown notification provider", "provider", setting.Provider)continue@@ -3286,7 +3205,7 @@ func (s *NotificationService) SendAutoHealNotification(ctx context.Context, contreturn nil}-func (s *NotificationService) sendDiscordAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendDiscordAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var discordConfig models.DiscordConfigif err := s.unmarshalConfigInternal(config, &discordConfig); err != nil {return err@@ -3295,11 +3214,11 @@ func (s *NotificationService) sendDiscordAutoHealNotification(ctx context.Contexreturn fmt.Errorf("discord webhook ID or token not configured")}s.decryptDiscordTokenInternal(&discordConfig)- message := fmt.Sprintf("**Container '%s' was automatically restarted because it was unhealthy**", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatMarkdown, environmentName, containerName)return notifications.SendDiscord(ctx, discordConfig, message)}-func (s *NotificationService) sendEmailAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendEmailAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var emailConfig models.EmailConfigif err := s.unmarshalConfigInternal(config, &emailConfig); err != nil {return err@@ -3308,12 +3227,16 @@ func (s *NotificationService) sendEmailAutoHealNotification(ctx context.Context,return err}s.decryptEmailPasswordInternal(&emailConfig)- subject := fmt.Sprintf("Auto Heal: Container '%s' Restarted", containerName)- body := fmt.Sprintf("<p>Container <strong>%s</strong> was automatically restarted because it was unhealthy.</p>", containerName)+ subject := notifications.BuildEmailSubject(environmentName, fmt.Sprintf("Auto Heal: Container '%s' Restarted", containerName))+ body := fmt.Sprintf(+ "<p><strong>Environment:</strong> %s</p><p><strong>Container:</strong> %s</p><p>Automatically restarted because it was unhealthy.</p>",+ environmentName,+ containerName,+ )return notifications.SendEmail(ctx, emailConfig, subject, body)}-func (s *NotificationService) sendTelegramAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendTelegramAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var telegramConfig models.TelegramConfigif err := s.unmarshalConfigInternal(config, &telegramConfig); err != nil {return err@@ -3325,77 +3248,78 @@ func (s *NotificationService) sendTelegramAutoHealNotification(ctx context.Conteif telegramConfig.ParseMode == "" {telegramConfig.ParseMode = "HTML"}- message := fmt.Sprintf("<b>Auto Heal:</b> Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatHTML, environmentName, containerName)return notifications.SendTelegram(ctx, telegramConfig, message)}-func (s *NotificationService) sendSignalAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendSignalAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var signalConfig models.SignalConfigif err := s.unmarshalConfigInternal(config, &signalConfig); err != nil {return err}- message := fmt.Sprintf("Auto Heal: Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)return notifications.SendSignal(ctx, signalConfig, message)}-func (s *NotificationService) sendSlackAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendSlackAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var slackConfig models.SlackConfigif err := s.unmarshalConfigInternal(config, &slackConfig); err != nil {return err}- message := fmt.Sprintf("*Auto Heal:* Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatSlack, environmentName, containerName)return notifications.SendSlack(ctx, slackConfig, message)}-func (s *NotificationService) sendNtfyAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendNtfyAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var ntfyConfig models.NtfyConfigif err := s.unmarshalConfigInternal(config, &ntfyConfig); err != nil {return err}- message := fmt.Sprintf("Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)return notifications.SendNtfy(ctx, ntfyConfig, message)}-func (s *NotificationService) sendPushoverAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendPushoverAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var pushoverConfig models.PushoverConfigif err := s.unmarshalConfigInternal(config, &pushoverConfig); err != nil {return err}if pushoverConfig.Title == "" {- pushoverConfig.Title = "Auto Heal"+ pushoverConfig.Title = notifications.BuildEmailSubject(environmentName, "Auto Heal")}- message := fmt.Sprintf("Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)return notifications.SendPushover(ctx, pushoverConfig, message)}-func (s *NotificationService) sendGotifyAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendGotifyAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var gotifyConfig models.GotifyConfigif err := s.unmarshalConfigInternal(config, &gotifyConfig); err != nil {return err}if gotifyConfig.Title == "" {- gotifyConfig.Title = "Auto Heal"+ gotifyConfig.Title = notifications.BuildEmailSubject(environmentName, "Auto Heal")}- message := fmt.Sprintf("Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)return notifications.SendGotify(ctx, gotifyConfig, message)}-func (s *NotificationService) sendMatrixAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendMatrixAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var matrixConfig models.MatrixConfigif err := s.unmarshalConfigInternal(config, &matrixConfig); err != nil {return err}- message := fmt.Sprintf("Container '%s' was automatically restarted because it was unhealthy", containerName)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)return notifications.SendMatrix(ctx, matrixConfig, message)}-func (s *NotificationService) sendGenericAutoHealNotification(ctx context.Context, containerName string, config models.JSON) error {+func (s *NotificationService) sendGenericAutoHealNotification(ctx context.Context, environmentName, containerName string, config models.JSON) error {var genericConfig models.GenericConfigif err := s.unmarshalConfigInternal(config, &genericConfig); err != nil {return err}- message := fmt.Sprintf("Container '%s' was automatically restarted because it was unhealthy", containerName)- return notifications.SendGenericWithTitle(ctx, genericConfig, "Auto Heal", message)+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatPlain, environmentName, containerName)+ title := notifications.BuildEmailSubject(environmentName, "Auto Heal")+ return notifications.SendGenericWithTitle(ctx, genericConfig, title, message)}// Helper methods to reduce code duplicationdiff --git a/backend/internal/services/notification_service_test.go b/backend/internal/services/notification_service_test.goindex c2e696c5f..c0c640f01 100644--- a/backend/internal/services/notification_service_test.go+++ b/backend/internal/services/notification_service_test.go@@ -1,9 +1,17 @@package servicesimport (+ "bytes""context""encoding/json"+ "errors"+ "log/slog"+ "net/http"+ "net/http/httptest"+ "strings"+ "sync/atomic""testing"+ "time"glsqlite "github.com/glebarez/sqlite""github.com/stretchr/testify/require"@@ -13,13 +21,17 @@ import ("github.com/getarcaneapp/arcane/backend/internal/database""github.com/getarcaneapp/arcane/backend/internal/models""github.com/getarcaneapp/arcane/backend/internal/utils/crypto"+ "github.com/getarcaneapp/arcane/backend/pkg/utils/notifications"+ "github.com/getarcaneapp/arcane/types/imageupdate"+ notificationdto "github.com/getarcaneapp/arcane/types/notification"+ "github.com/getarcaneapp/arcane/types/system")func setupNotificationTestDB(t *testing.T) *database.DB {t.Helper()db, err := gorm.Open(glsqlite.Open(":memory:"), &gorm.Config{})require.NoError(t, err)- require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}))+ require.NoError(t, db.AutoMigrate(&models.NotificationSettings{}, &models.SettingVariable{}, &models.NotificationLog{}, &models.Environment{}, &models.AppriseSettings{}))// Initialize crypto for tests (requires 32+ byte key)testCfg := &config.Config{@@ -31,11 +43,46 @@ func setupNotificationTestDB(t *testing.T) *database.DB {return &database.DB{DB: db}}+func setupNotificationTestServiceInternal(t *testing.T) (*database.DB, *EnvironmentService, *NotificationService) {+ t.Helper()++ db := setupNotificationTestDB(t)+ envSvc := NewEnvironmentService(db, nil, nil, nil, nil)++ cfg := &config.Config{+ AppUrl: "http://localhost:3552",+ }++ return db, envSvc, NewNotificationService(db, cfg, envSvc)+}++func newNotificationTestUpdateInfoInternal() *imageupdate.Response {+ return &imageupdate.Response{+ HasUpdate: true,+ UpdateType: "digest",+ CurrentDigest: "sha256:current",+ LatestDigest: "sha256:latest",+ CheckTime: time.Date(2026, time.January, 9, 15, 4, 5, 0, time.UTC),+ }+}++func captureNotificationServiceLogsInternal(t *testing.T) *bytes.Buffer {+ t.Helper()++ var buf bytes.Buffer+ previousLogger := slog.Default()+ logger := slog.New(slog.NewTextHandler(&buf, &slog.HandlerOptions{Level: slog.LevelInfo}))+ slog.SetDefault(logger)+ t.Cleanup(func() {+ slog.SetDefault(previousLogger)+ })++ return &buf+}+func TestNotificationService_MigrateDiscordWebhookUrlToFields(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)// Create legacy Discord config with webhookUrllegacyConfig := map[string]any{@@ -92,9 +139,7 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields(t *testing.T) {func TestNotificationService_MigrateDiscordWebhookUrlToFields_SkipsIfAlreadyMigrated(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)// Create already-migrated config with webhookId and tokenencryptedToken, err := crypto.Encrypt("already-migrated-token")@@ -139,9 +184,7 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields_SkipsIfAlreadyMigrfunc TestNotificationService_MigrateDiscordWebhookUrlToFields_NoDiscordConfig(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)// No Discord config exists - migration should not errorerr := svc.MigrateDiscordWebhookUrlToFields(ctx)@@ -155,9 +198,7 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields_NoDiscordConfig(tfunc TestNotificationService_MigrateDiscordWebhookUrlToFields_InvalidWebhookUrl(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)testCases := []struct {name string@@ -222,9 +263,7 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields_InvalidWebhookUrl(func TestNotificationService_MigrateDiscordWebhookUrlToFields_EmptyConfig(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)// Create Discord setting with empty configsetting := models.NotificationSettings{@@ -246,9 +285,7 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields_EmptyConfig(t *tesfunc TestNotificationService_MigrateDiscordWebhookUrlToFields_PreservesAllFields(t *testing.T) {ctx := context.Background()- db := setupNotificationTestDB(t)- cfg := &config.Config{}- svc := NewNotificationService(db, cfg)+ db, _, svc := setupNotificationTestServiceInternal(t)// Create legacy config with all optional fieldslegacyConfig := map[string]any{@@ -300,6 +337,358 @@ func TestNotificationService_MigrateDiscordWebhookUrlToFields_PreservesAllFieldsrequire.True(t, discordConfig.Events[models.NotificationEventContainerUpdate])}+func TestNotificationService_ResolveNotificationTargetInternal_UsesEnvironmentRecordAndFallback(t *testing.T) {+ ctx := context.Background()+ db, _, svc := setupNotificationTestServiceInternal(t)++ target, err := svc.resolveNotificationTargetInternal(ctx, "")+ require.NoError(t, err)+ require.Equal(t, "0", target.EnvironmentID)+ require.Equal(t, "Local Docker", target.EnvironmentName)++ now := time.Now()+ require.NoError(t, db.WithContext(ctx).Create(&models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: now, UpdatedAt: &now},+ Name: "Remote Alpha",+ ApiUrl: "http://remote.example",+ Enabled: true,+ Status: string(models.EnvironmentStatusOnline),+ }).Error)++ target, err = svc.resolveNotificationTargetInternal(ctx, "env-remote")+ require.NoError(t, err)+ require.Equal(t, "env-remote", target.EnvironmentID)+ require.Equal(t, "Remote Alpha", target.EnvironmentName)+}++func TestNotificationService_ResolveNotificationTargetForAccessTokenInternal_UsesStoredEnvironmentName(t *testing.T) {+ ctx := context.Background()+ db, _, svc := setupNotificationTestServiceInternal(t)++ token := "remote-token"+ now := time.Now()+ require.NoError(t, db.WithContext(ctx).Create(&models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: now, UpdatedAt: &now},+ Name: "Remote Edge",+ ApiUrl: "http://remote.example",+ Enabled: true,+ Status: string(models.EnvironmentStatusOnline),+ AccessToken: &token,+ }).Error)++ target, err := svc.resolveNotificationTargetForAccessTokenInternal(ctx, token)+ require.NoError(t, err)+ require.Equal(t, "env-remote", target.EnvironmentID)+ require.Equal(t, "Remote Edge", target.EnvironmentName)+}++func TestNotificationService_DispatchNotification_InvalidAccessTokenReturnsUnauthorizedSentinel(t *testing.T) {+ ctx := context.Background()+ _, _, svc := setupNotificationTestServiceInternal(t)++ err := svc.DispatchNotification(ctx, "missing-token", notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindImageUpdate,+ ImageUpdate: ¬ificationdto.DispatchImageUpdate{+ ImageRef: "nginx:latest",+ UpdateInfo: *newNotificationTestUpdateInfoInternal(),+ },+ })++ require.Error(t, err)+ require.ErrorIs(t, err, ErrUnauthorizedNotificationDispatch)+}++func TestNotificationService_DispatchNotification_UnsupportedKindReturnsSentinel(t *testing.T) {+ ctx := context.Background()+ db, _, svc := setupNotificationTestServiceInternal(t)++ token := "remote-token"+ now := time.Now()+ require.NoError(t, db.WithContext(ctx).Create(&models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: now, UpdatedAt: &now},+ Name: "Remote Edge",+ ApiUrl: "http://remote.example",+ Enabled: true,+ Status: string(models.EnvironmentStatusOnline),+ AccessToken: &token,+ }).Error)++ err := svc.DispatchNotification(ctx, token, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKind("bogus_kind"),+ })++ require.Error(t, err)+ require.ErrorIs(t, err, ErrUnsupportedDispatchKind)+ var unsupportedErr error = ErrUnsupportedDispatchKind+ require.True(t, errors.Is(err, unsupportedErr))+ require.Contains(t, err.Error(), "bogus_kind")+}++func TestNotificationService_DispatchNotification_LogsManagerDispatchForAgent(t *testing.T) {+ ctx := context.Background()+ db, _, svc := setupNotificationTestServiceInternal(t)+ logBuffer := captureNotificationServiceLogsInternal(t)++ token := "remote-token"+ now := time.Now()+ require.NoError(t, db.WithContext(ctx).Create(&models.Environment{+ BaseModel: models.BaseModel{ID: "env-remote", CreatedAt: now, UpdatedAt: &now},+ Name: "Remote Edge",+ ApiUrl: "http://remote.example",+ Enabled: true,+ Status: string(models.EnvironmentStatusOnline),+ AccessToken: &token,+ }).Error)++ err := svc.DispatchNotification(ctx, token, notificationdto.DispatchRequest{+ Kind: notificationdto.DispatchKindImageUpdate,+ ImageUpdate: ¬ificationdto.DispatchImageUpdate{+ ImageRef: "nginx:latest",+ UpdateInfo: *newNotificationTestUpdateInfoInternal(),+ },+ })++ require.NoError(t, err)+ logs := logBuffer.String()+ require.Contains(t, logs, "Manager dispatching notification on behalf of agent")+ require.Contains(t, logs, "environment_id=env-remote")+ require.Contains(t, logs, "environment_name=\"Remote Edge\"")+ require.Contains(t, logs, "kind=image_update")+}++func TestNotificationService_SendImageUpdateNotification_AgentModeDispatchesToManager(t *testing.T) {+ ctx := context.Background()+ db := setupNotificationTestDB(t)+ envSvc := NewEnvironmentService(db, nil, nil, nil, nil)++ var calls atomic.Int32+ var dispatched notificationdto.DispatchRequest+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ require.Equal(t, http.MethodPost, r.Method)+ require.Equal(t, "/api/notifications/dispatch", r.URL.Path)+ require.Equal(t, "agent-token", r.Header.Get("X-API-Key"))+ require.NoError(t, json.NewDecoder(r.Body).Decode(&dispatched))+ calls.Add(1)+ w.WriteHeader(http.StatusOK)+ }))+ defer server.Close()++ svc := NewNotificationService(db, &config.Config{+ AppUrl: "http://localhost:3552",+ AgentMode: true,+ AgentToken: "agent-token",+ ManagerApiUrl: server.URL,+ }, envSvc)++ err := svc.SendImageUpdateNotification(ctx, "nginx:latest", newNotificationTestUpdateInfoInternal(), models.NotificationEventImageUpdate)+ require.NoError(t, err)+ require.EqualValues(t, 1, calls.Load())+ require.Equal(t, notificationdto.DispatchKindImageUpdate, dispatched.Kind)+ require.NotNil(t, dispatched.ImageUpdate)+ require.Equal(t, "nginx:latest", dispatched.ImageUpdate.ImageRef)+}++func TestNotificationService_SendImageUpdateNotification_AgentModeRequiresUpdateInfo(t *testing.T) {+ ctx := context.Background()+ db := setupNotificationTestDB(t)+ envSvc := NewEnvironmentService(db, nil, nil, nil, nil)++ svc := NewNotificationService(db, &config.Config{+ AppUrl: "http://localhost:3552",+ AgentMode: true,+ }, envSvc)++ err := svc.SendImageUpdateNotification(ctx, "nginx:latest", nil, models.NotificationEventImageUpdate)+ require.Error(t, err)+ require.Contains(t, err.Error(), "updateInfo is required")+}++func TestNotificationService_SendBatchImageUpdateNotification_AgentModeSkipsNoOpDispatchInternal(t *testing.T) {+ ctx := context.Background()+ db := setupNotificationTestDB(t)+ envSvc := NewEnvironmentService(db, nil, nil, nil, nil)++ var calls atomic.Int32+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ calls.Add(1)+ w.WriteHeader(http.StatusOK)+ }))+ defer server.Close()++ svc := NewNotificationService(db, &config.Config{+ AppUrl: "http://localhost:3552",+ AgentMode: true,+ AgentToken: "agent-token",+ ManagerApiUrl: server.URL,+ }, envSvc)++ t.Run("empty updates", func(t *testing.T) {+ err := svc.SendBatchImageUpdateNotification(ctx, map[string]*imageupdate.Response{})+ require.NoError(t, err)+ require.EqualValues(t, 0, calls.Load())+ })++ t.Run("no changed updates", func(t *testing.T) {+ err := svc.SendBatchImageUpdateNotification(ctx, map[string]*imageupdate.Response{+ "nginx:latest": {+ HasUpdate: false,+ CurrentDigest: "sha256:current",+ LatestDigest: "sha256:latest",+ },+ "redis:latest": nil,+ })+ require.NoError(t, err)+ require.EqualValues(t, 0, calls.Load())+ })+}++func TestNotificationService_RenderEmailTemplate_IncludesEnvironment(t *testing.T) {+ _, _, svc := setupNotificationTestServiceInternal(t)++ htmlBody, textBody, err := svc.renderEmailTemplate("Homelab Prod", "nginx:latest", newNotificationTestUpdateInfoInternal())+ require.NoError(t, err)+ require.Contains(t, htmlBody, "Homelab Prod")+ require.Contains(t, textBody, "Homelab Prod")++ subject := notifications.BuildEmailSubject("Homelab Prod", "Container Update Available: nginx:latest")+ require.Equal(t, "[Homelab Prod] Container Update Available: nginx:latest", subject)+}++func TestNotificationService_RenderContainerUpdateEmailTemplate_IncludesEnvironment(t *testing.T) {+ _, _, svc := setupNotificationTestServiceInternal(t)++ htmlBody, textBody, err := svc.renderContainerUpdateEmailTemplate("Lab Remote", "nginx", "nginx:latest", "sha256:old", "sha256:new")+ require.NoError(t, err)+ require.Contains(t, htmlBody, "Lab Remote")+ require.Contains(t, textBody, "Lab Remote")++ subject := notifications.BuildEmailSubject("Lab Remote", "Container Updated: nginx")+ require.Equal(t, "[Lab Remote] Container Updated: nginx", subject)+}++func TestNotificationService_RenderBatchEmailTemplate_IncludesEnvironment(t *testing.T) {+ _, _, svc := setupNotificationTestServiceInternal(t)++ updates := map[string]*imageupdate.Response{+ "nginx:latest": newNotificationTestUpdateInfoInternal(),+ "redis:latest": {+ HasUpdate: true,+ UpdateType: "minor",+ CurrentDigest: "sha256:redis-current",+ LatestDigest: "sha256:redis-latest",+ CheckTime: time.Date(2026, time.January, 9, 15, 4, 5, 0, time.UTC),+ },+ }++ htmlBody, textBody, err := svc.renderBatchEmailTemplate("Edge Cluster A", updates)+ require.NoError(t, err)+ require.Contains(t, htmlBody, "Edge Cluster A")+ require.Contains(t, textBody, "Edge Cluster A")++ subject := notifications.BuildEmailSubject("Edge Cluster A", "2 Container Image Updates Available")+ require.Equal(t, "[Edge Cluster A] 2 Container Image Updates Available", subject)+}++func TestNotificationService_RenderVulnerabilitySummaryEmailTemplate_IncludesEnvironment(t *testing.T) {+ _, _, svc := setupNotificationTestServiceInternal(t)++ htmlBody, textBody, err := svc.renderVulnerabilitySummaryEmailTemplate("Remote Alpha", VulnerabilityNotificationPayload{+ CVEID: "Daily Summary - 2026-01-09",+ ImageName: "5 image(s) scanned, 2 with fixable vulnerabilities",+ FixedVersion: "7 fixable vulnerability record(s)",+ Severity: "Critical:1 High:3 Medium:2 Low:1 Unknown:0",+ PkgName: "CVE-2025-1234",+ })+ require.NoError(t, err)+ require.Contains(t, htmlBody, "Remote Alpha")+ require.Contains(t, textBody, "Remote Alpha")+}++func TestNotificationService_RenderPruneReportEmailTemplate_IncludesEnvironment(t *testing.T) {+ _, _, svc := setupNotificationTestServiceInternal(t)++ htmlBody, textBody, err := svc.renderPruneReportEmailTemplate("Cluster West", &system.PruneAllResult{+ SpaceReclaimed: 3825205248,+ ContainerSpaceReclaimed: 503316480,+ ImageSpaceReclaimed: 2449473536,+ VolumeSpaceReclaimed: 641728512,+ BuildCacheSpaceReclaimed: 230162432,+ })+ require.NoError(t, err)+ require.Contains(t, htmlBody, "Cluster West")+ require.Contains(t, textBody, "Cluster West")+}++func TestBuildImageUpdateNotificationMessageInternal_IncludesEnvironment(t *testing.T) {+ updateInfo := newNotificationTestUpdateInfoInternal()++ message := notifications.BuildImageUpdateNotificationMessage(notifications.MessageFormatMarkdown, "Remote Alpha", "nginx:latest", updateInfo)+ require.Contains(t, message, "**Environment:** Remote Alpha")+ require.Equal(t, 1, strings.Count(message, "Environment"))++ plainMessage := notifications.BuildImageUpdateNotificationMessage(notifications.MessageFormatPlain, "Remote Alpha", "nginx:latest", updateInfo)+ require.Contains(t, plainMessage, "Environment: Remote Alpha")+}++func TestBuildContainerUpdateNotificationMessageInternal_IncludesEnvironment(t *testing.T) {+ message := notifications.BuildContainerUpdateNotificationMessage(notifications.MessageFormatMarkdown, "Local Lab", "nginx", "nginx:latest", "sha256:old", "sha256:new")++ require.Contains(t, message, "**Environment:** Local Lab")+ require.Equal(t, 1, strings.Count(message, "Environment"))+}++func TestBuildBatchImageUpdateNotificationMessageInternal_EnvironmentAppearsOnce(t *testing.T) {+ updates := map[string]*imageupdate.Response{+ "nginx:latest": newNotificationTestUpdateInfoInternal(),+ "redis:latest": {+ HasUpdate: true,+ UpdateType: "minor",+ CurrentDigest: "sha256:redis-current",+ LatestDigest: "sha256:redis-latest",+ CheckTime: time.Date(2026, time.January, 9, 15, 4, 5, 0, time.UTC),+ },+ }++ message := notifications.BuildBatchImageUpdateNotificationMessage(notifications.MessageFormatMarkdown, "Cluster One", updates)+ require.Contains(t, message, "**Environment:** Cluster One")+ require.Equal(t, 1, strings.Count(message, "Environment"))+}++func TestBuildVulnerabilitySummaryNotificationMessageInternal_IncludesEnvironment(t *testing.T) {+ message := notifications.BuildVulnerabilitySummaryNotificationMessage(+ notifications.MessageFormatMarkdown,+ "Remote Alpha",+ "Daily Summary - 2026-01-09",+ "5 image(s) scanned",+ "7 fixable vulnerability record(s)",+ "Critical:1 High:3",+ "CVE-2025-1234",+ )++ require.Contains(t, message, "**Environment:** Remote Alpha")+ require.Equal(t, 1, strings.Count(message, "Environment"))+}++func TestBuildPruneReportNotificationMessageInternal_IncludesEnvironment(t *testing.T) {+ message := notifications.BuildPruneReportNotificationMessage(notifications.MessageFormatMarkdown, "Cluster One", &system.PruneAllResult{+ SpaceReclaimed: 3825205248,+ ContainerSpaceReclaimed: 503316480,+ ImageSpaceReclaimed: 2449473536,+ VolumeSpaceReclaimed: 641728512,+ BuildCacheSpaceReclaimed: 230162432,+ })++ require.Contains(t, message, "**Environment:** Cluster One")+ require.Equal(t, 1, strings.Count(message, "Environment"))+}++func TestBuildAutoHealNotificationMessageInternal_IncludesEnvironment(t *testing.T) {+ message := notifications.BuildAutoHealNotificationMessage(notifications.MessageFormatMarkdown, "Cluster One", "nginx")++ require.Contains(t, message, "**Environment:** Cluster One")+ require.Equal(t, 1, strings.Count(message, "Environment"))+}+func TestSupportedNotificationTestTypes_IncludesAutoHeal(t *testing.T) {expected := []string{notificationTestTypeSimple,diff --git a/backend/internal/utils/notifications/discord_sender.go b/backend/pkg/utils/notifications/discord_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/discord_sender.gorename to backend/pkg/utils/notifications/discord_sender.godiff --git a/backend/internal/utils/notifications/discord_sender_test.go b/backend/pkg/utils/notifications/discord_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/discord_sender_test.gorename to backend/pkg/utils/notifications/discord_sender_test.godiff --git a/backend/internal/utils/notifications/email_sender.go b/backend/pkg/utils/notifications/email_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/email_sender.gorename to backend/pkg/utils/notifications/email_sender.godiff --git a/backend/internal/utils/notifications/email_sender_test.go b/backend/pkg/utils/notifications/email_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/email_sender_test.gorename to backend/pkg/utils/notifications/email_sender_test.godiff --git a/backend/internal/utils/notifications/generic_sender.go b/backend/pkg/utils/notifications/generic_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/generic_sender.gorename to backend/pkg/utils/notifications/generic_sender.godiff --git a/backend/internal/utils/notifications/generic_sender_test.go b/backend/pkg/utils/notifications/generic_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/generic_sender_test.gorename to backend/pkg/utils/notifications/generic_sender_test.godiff --git a/backend/internal/utils/notifications/gotify_sender.go b/backend/pkg/utils/notifications/gotify_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/gotify_sender.gorename to backend/pkg/utils/notifications/gotify_sender.godiff --git a/backend/internal/utils/notifications/gotify_sender_test.go b/backend/pkg/utils/notifications/gotify_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/gotify_sender_test.gorename to backend/pkg/utils/notifications/gotify_sender_test.godiff --git a/backend/internal/utils/notifications/matrix_sender.go b/backend/pkg/utils/notifications/matrix_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/matrix_sender.gorename to backend/pkg/utils/notifications/matrix_sender.godiff --git a/backend/internal/utils/notifications/matrix_sender_test.go b/backend/pkg/utils/notifications/matrix_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/matrix_sender_test.gorename to backend/pkg/utils/notifications/matrix_sender_test.godiff --git a/backend/pkg/utils/notifications/messages.go b/backend/pkg/utils/notifications/messages.gonew file mode 100644index 000000000..2ff386dab--- /dev/null+++ b/backend/pkg/utils/notifications/messages.go@@ -0,0 +1,228 @@+package notifications++import (+ "fmt"+ "sort"+ "strings"++ "github.com/getarcaneapp/arcane/types/imageupdate"+ "github.com/getarcaneapp/arcane/types/system"+)++type MessageFormat string++const (+ MessageFormatPlain MessageFormat = "plain"+ MessageFormatMarkdown MessageFormat = "markdown"+ MessageFormatSlack MessageFormat = "slack"+ MessageFormatHTML MessageFormat = "html"+)++func formatNotificationTitleInternal(format MessageFormat, title string) string {+ switch format {+ case MessageFormatPlain:+ return title+ case MessageFormatMarkdown:+ return fmt.Sprintf("**%s**", title)+ case MessageFormatSlack:+ return fmt.Sprintf("*%s*", title)+ case MessageFormatHTML:+ return fmt.Sprintf("<b>%s</b>", title)+ default:+ return title+ }+}++func formatNotificationLabelInternal(format MessageFormat, label string) string {+ switch format {+ case MessageFormatPlain:+ return label + ":"+ case MessageFormatMarkdown:+ return fmt.Sprintf("**%s:**", label)+ case MessageFormatSlack:+ return fmt.Sprintf("*%s:*", label)+ case MessageFormatHTML:+ return fmt.Sprintf("<b>%s:</b>", label)+ default:+ return label + ":"+ }+}++func formatNotificationCodeInternal(format MessageFormat, value string) string {+ switch format {+ case MessageFormatPlain:+ return value+ case MessageFormatHTML:+ return fmt.Sprintf("<code>%s</code>", value)+ case MessageFormatMarkdown, MessageFormatSlack:+ return fmt.Sprintf("`%s`", value)+ default:+ return value+ }+}++func BuildImageUpdateNotificationMessage(format MessageFormat, environmentName, imageRef string, updateInfo *imageupdate.Response) string {+ updateStatus := "No Update"+ if updateInfo != nil && updateInfo.HasUpdate {+ updateStatus = "Update Available"+ }+ if format != MessageFormatPlain && updateStatus == "Update Available" {+ updateStatus = "⚠️ Update Available"+ }++ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n", formatNotificationTitleInternal(format, "🔔 Container Image Update Notification"))+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Environment"), environmentName)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Image"), imageRef)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Status"), updateStatus)+ if updateInfo != nil {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Update Type"), updateInfo.UpdateType)+ if updateInfo.CurrentDigest != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Current Digest"), formatNotificationCodeInternal(format, updateInfo.CurrentDigest))+ }+ if updateInfo.LatestDigest != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Latest Digest"), formatNotificationCodeInternal(format, updateInfo.LatestDigest))+ }+ }++ return message.String()+}++func BuildContainerUpdateNotificationMessage(format MessageFormat, environmentName, containerName, imageRef, oldDigest, newDigest string) string {+ status := "Updated Successfully"+ if format != MessageFormatPlain {+ status = "✅ Updated Successfully"+ }++ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n", formatNotificationTitleInternal(format, "✅ Container Successfully Updated"))+ fmt.Fprintf(&message, "Your container has been updated with the latest image version.\n\n")+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Environment"), environmentName)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Container"), containerName)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Image"), imageRef)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Status"), status)+ if oldDigest != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Previous Version"), formatNotificationCodeInternal(format, oldDigest))+ }+ if newDigest != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Current Version"), formatNotificationCodeInternal(format, newDigest))+ }++ return message.String()+}++func BuildBatchImageUpdateNotificationMessage(format MessageFormat, environmentName string, updates map[string]*imageupdate.Response) string {+ title := "Container Image Updates Available"+ description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))+ if len(updates) == 1 {+ description = "1 container image has an update available."+ }++ imageRefs := make([]string, 0, len(updates))+ for imageRef := range updates {+ imageRefs = append(imageRefs, imageRef)+ }+ sort.Strings(imageRefs)++ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n%s\n", formatNotificationTitleInternal(format, title), description)+ fmt.Fprintf(&message, "%s %s\n\n", formatNotificationLabelInternal(format, "Environment"), environmentName)++ for _, imageRef := range imageRefs {+ update := updates[imageRef]+ switch format {+ case MessageFormatPlain:+ fmt.Fprintf(&message, "%s\n", imageRef)+ fmt.Fprintf(&message, "• Type: %s\n", update.UpdateType)+ fmt.Fprintf(&message, "• Current: %s\n", update.CurrentDigest)+ fmt.Fprintf(&message, "• Latest: %s\n\n", update.LatestDigest)+ case MessageFormatMarkdown:+ fmt.Fprintf(&message, "**%s**\n", imageRef)+ fmt.Fprintf(&message, "• **Type:** %s\n", update.UpdateType)+ fmt.Fprintf(&message, "• **Current:** %s\n", formatNotificationCodeInternal(format, update.CurrentDigest))+ fmt.Fprintf(&message, "• **Latest:** %s\n\n", formatNotificationCodeInternal(format, update.LatestDigest))+ case MessageFormatSlack:+ fmt.Fprintf(&message, "*%s*\n", imageRef)+ fmt.Fprintf(&message, "• *Type:* %s\n", update.UpdateType)+ fmt.Fprintf(&message, "• *Current:* %s\n", formatNotificationCodeInternal(format, update.CurrentDigest))+ fmt.Fprintf(&message, "• *Latest:* %s\n\n", formatNotificationCodeInternal(format, update.LatestDigest))+ case MessageFormatHTML:+ fmt.Fprintf(&message, "<b>%s</b>\n", imageRef)+ fmt.Fprintf(&message, "• <b>Type:</b> %s\n", update.UpdateType)+ fmt.Fprintf(&message, "• <b>Current:</b> %s\n", formatNotificationCodeInternal(format, update.CurrentDigest))+ fmt.Fprintf(&message, "• <b>Latest:</b> %s\n\n", formatNotificationCodeInternal(format, update.LatestDigest))+ }+ }++ return message.String()+}++func BuildVulnerabilitySummaryNotificationMessage(format MessageFormat, environmentName, summaryLabel, overview, fixableCount, severityBreakdown, sampleCVEs string) string {+ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n", formatNotificationTitleInternal(format, "📊 Daily Vulnerability Summary"))++ if strings.TrimSpace(summaryLabel) != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Summary"), summaryLabel)+ }+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Environment"), environmentName)+ if strings.TrimSpace(overview) != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Overview"), overview)+ }+ if strings.TrimSpace(fixableCount) != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Fixable Vulnerabilities"), fixableCount)+ }+ if strings.TrimSpace(severityBreakdown) != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Severity Breakdown"), severityBreakdown)+ }+ if strings.TrimSpace(sampleCVEs) != "" {+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Sample CVEs"), sampleCVEs)+ }++ return message.String()+}++func BuildPruneReportNotificationMessage(format MessageFormat, environmentName string, result *system.PruneAllResult) string {+ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n", formatNotificationTitleInternal(format, "🧹 System Prune Report"))+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Environment"), environmentName)+ fmt.Fprintf(&message, "%s %s\n\n", formatNotificationLabelInternal(format, "Total Space Reclaimed"), formatBytesInternal(result.SpaceReclaimed))+ fmt.Fprintf(&message, "%s\n", formatNotificationLabelInternal(format, "Breakdown"))+ fmt.Fprintf(&message, "- Containers: %s\n", formatBytesInternal(result.ContainerSpaceReclaimed))+ fmt.Fprintf(&message, "- Images: %s\n", formatBytesInternal(result.ImageSpaceReclaimed))+ fmt.Fprintf(&message, "- Volumes: %s\n", formatBytesInternal(result.VolumeSpaceReclaimed))+ fmt.Fprintf(&message, "- Build Cache: %s\n", formatBytesInternal(result.BuildCacheSpaceReclaimed))+ return message.String()+}++func BuildAutoHealNotificationMessage(format MessageFormat, environmentName, containerName string) string {+ var message strings.Builder+ fmt.Fprintf(&message, "%s\n\n", formatNotificationTitleInternal(format, "Auto Heal"))+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Environment"), environmentName)+ fmt.Fprintf(&message, "%s %s\n", formatNotificationLabelInternal(format, "Container"), containerName)+ fmt.Fprintf(&message, "%s Automatically restarted because it was unhealthy.\n", formatNotificationLabelInternal(format, "Status"))+ return message.String()+}++func formatBytesInternal(bytes uint64) string {+ const unit = 1024+ if bytes < unit {+ return fmt.Sprintf("%d B", bytes)+ }++ div, exp := int64(unit), 0+ for n := bytes / unit; n >= unit; n /= unit {+ div *= unit+ exp+++ }++ return fmt.Sprintf("%.1f %cB", float64(bytes)/float64(div), "KMGTPE"[exp])+}++func BuildEmailSubject(environmentName, subject string) string {+ trimmedEnvironmentName := strings.TrimSpace(environmentName)+ if trimmedEnvironmentName == "" {+ return subject+ }++ return fmt.Sprintf("[%s] %s", SanitizeForEmail(trimmedEnvironmentName), subject)+}diff --git a/backend/internal/utils/notifications/ntfy_sender.go b/backend/pkg/utils/notifications/ntfy_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/ntfy_sender.gorename to backend/pkg/utils/notifications/ntfy_sender.godiff --git a/backend/internal/utils/notifications/ntfy_sender_test.go b/backend/pkg/utils/notifications/ntfy_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/ntfy_sender_test.gorename to backend/pkg/utils/notifications/ntfy_sender_test.godiff --git a/backend/internal/utils/notifications/pushover_sender.go b/backend/pkg/utils/notifications/pushover_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/pushover_sender.gorename to backend/pkg/utils/notifications/pushover_sender.godiff --git a/backend/internal/utils/notifications/pushover_sender_test.go b/backend/pkg/utils/notifications/pushover_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/pushover_sender_test.gorename to backend/pkg/utils/notifications/pushover_sender_test.godiff --git a/backend/internal/utils/notifications/signal_sender.go b/backend/pkg/utils/notifications/signal_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/signal_sender.gorename to backend/pkg/utils/notifications/signal_sender.godiff --git a/backend/internal/utils/notifications/signal_sender_test.go b/backend/pkg/utils/notifications/signal_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/signal_sender_test.gorename to backend/pkg/utils/notifications/signal_sender_test.godiff --git a/backend/internal/utils/notifications/slack_sender.go b/backend/pkg/utils/notifications/slack_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/slack_sender.gorename to backend/pkg/utils/notifications/slack_sender.godiff --git a/backend/internal/utils/notifications/slack_sender_test.go b/backend/pkg/utils/notifications/slack_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/slack_sender_test.gorename to backend/pkg/utils/notifications/slack_sender_test.godiff --git a/backend/internal/utils/notifications/telegram_sender.go b/backend/pkg/utils/notifications/telegram_sender.gosimilarity index 100%rename from backend/internal/utils/notifications/telegram_sender.gorename to backend/pkg/utils/notifications/telegram_sender.godiff --git a/backend/internal/utils/notifications/telegram_sender_test.go b/backend/pkg/utils/notifications/telegram_sender_test.gosimilarity index 100%rename from backend/internal/utils/notifications/telegram_sender_test.gorename to backend/pkg/utils/notifications/telegram_sender_test.godiff --git a/backend/internal/utils/notifications/utils.go b/backend/pkg/utils/notifications/utils.gosimilarity index 100%rename from backend/internal/utils/notifications/utils.gorename to backend/pkg/utils/notifications/utils.godiff --git a/backend/resources/email-templates/batch-image-updates_html.tmpl b/backend/resources/email-templates/batch-image-updates_html.tmplindex ef6200ceb..6f03e5d1f 100644--- a/backend/resources/email-templates/batch-image-updates_html.tmpl+++ b/backend/resources/email-templates/batch-image-updates_html.tmpl@@ -1,6 +1,7 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">Image Updates Available</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:16px;line-height:24px;color:#cbd5e1;margin:0 0 16px 0;margin-top:0;margin-right:0;margin-bottom:16px;margin-left:0">{{.UpdateCount}} container images have updates available.</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:160px;vertical-align:top;padding-right:12px">-<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Updates Available:</p></td><td data-id="__react-email-column"><p style="font-size:24px;line-height:24px;font-weight:700;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateCount}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:160px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Checked At:</p></td><td data-id="__react-email-column">-<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CheckTime}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px;background-color:rgba(15, 23, 42, 0.3);border:1px solid rgba(148, 163, 184, 0.1);padding:16px;border-radius:8px"><tbody><tr><td><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:0 0 12px 0;margin-top:0;margin-right:0;margin-bottom:12px;margin-left:0">Images with Updates:</p>{{range .ImageList}}<p style="font-size:13px;line-height:20px;color:#cbd5e1;margin:4px 0;font-family:monospace">• {{.}}</p>{{end}}</td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td>-<p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Log in to Arcane to view details and update your containers.</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:160px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Updates Available:</p></td><td data-id="__react-email-column">+<p style="font-size:24px;line-height:24px;font-weight:700;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateCount}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:160px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Checked At:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CheckTime}}</p></td></tr></tbody></table></td></tr></tbody>+</table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px;background-color:rgba(15, 23, 42, 0.3);border:1px solid rgba(148, 163, 184, 0.1);padding:16px;border-radius:8px"><tbody><tr><td><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:0 0 12px 0;margin-top:0;margin-right:0;margin-bottom:12px;margin-left:0">Images with Updates:</p>{{range .ImageList}}<p style="font-size:13px;line-height:20px;color:#cbd5e1;margin:4px 0;font-family:monospace">• {{.}}</p>{{end}}</td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Log in to Arcane to view details and update your containers.</p></td></tr></tbody></table></div>+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/batch-image-updates_text.tmpl b/backend/resources/email-templates/batch-image-updates_text.tmplindex 45866cfaf..2cd8b3e08 100644--- a/backend/resources/email-templates/batch-image-updates_text.tmpl+++ b/backend/resources/email-templates/batch-image-updates_text.tmpl@@ -2,6 +2,12 @@{{.UpdateCount}} container images have updates available.+Environment:++{{.Environment}}++----------------------------------------+Updates Available:{{.UpdateCount}}diff --git a/backend/resources/email-templates/container-update_html.tmpl b/backend/resources/email-templates/container-update_html.tmplindex ce06abe60..b3f335590 100644--- a/backend/resources/email-templates/container-update_html.tmpl+++ b/backend/resources/email-templates/container-update_html.tmpl@@ -1,9 +1,10 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">Container Successfully Updated</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:16px;line-height:24px;color:#cbd5e1;margin:0 0 16px 0;margin-top:0;margin-right:0;margin-bottom:16px;margin-left:0">Your container has been successfully updated with the latest image version.</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px">-<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Container:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ContainerName}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Image:</p></td><td data-id="__react-email-column">-<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageRef}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Status:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">✓ Updated Successfully</p></td></tr></tbody></table>-<hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Previous Version:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.OldDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Current Version:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.NewDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">-<td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Updated At:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateTime}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">This is an automated notification from Arcane. Your container has been restarted with the new image version.</p></td></tr></tbody></table></div>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Container:</p></td><td data-id="__react-email-column">+<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ContainerName}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Image:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageRef}}</p></td></tr></tbody></table>+<hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Status:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">✓ Updated Successfully</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Previous Version:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.OldDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">+<td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Current Version:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.NewDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px">+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Updated At:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateTime}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">This is an automated notification from Arcane. Your container has been restarted with the new image version.</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody>+<tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/container-update_text.tmpl b/backend/resources/email-templates/container-update_text.tmplindex c636a3133..0e3ed5810 100644--- a/backend/resources/email-templates/container-update_text.tmpl+++ b/backend/resources/email-templates/container-update_text.tmpl@@ -2,6 +2,12 @@Your container has been successfully updated with the latest image version.+Environment:++{{.Environment}}++----------------------------------------+Container:{{.ContainerName}}diff --git a/backend/resources/email-templates/image-update_html.tmpl b/backend/resources/email-templates/image-update_html.tmplindex a87e0fee7..2ae1ca85b 100644--- a/backend/resources/email-templates/image-update_html.tmpl+++ b/backend/resources/email-templates/image-update_html.tmpl@@ -1,9 +1,10 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">Container Image Update</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:16px;line-height:24px;color:#cbd5e1;margin:0 0 16px 0;margin-top:0;margin-right:0;margin-bottom:16px;margin-left:0">A new update has been detected for your container image.</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px">-<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Image:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageRef}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Status:</p></td><td data-id="__react-email-column">-<p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">✓ Update Available</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Update Type:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateType}}</p></td></tr></tbody></table>-<hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Current Digest:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CurrentDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Latest Digest:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.LatestDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">-<td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Checked At:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CheckTime}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">This is an automated notification from Arcane.<!-- --> Please review and update your container when ready.</p></td></tr></tbody></table></div>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Image:</p></td><td data-id="__react-email-column">+<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageRef}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Status:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">✓ Update Available</p></td></tr></tbody></table>+<hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Update Type:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.UpdateType}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Current Digest:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CurrentDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">+<td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Latest Digest:</p></td><td data-id="__react-email-column"><p style="font-size:13px;line-height:24px;color:#e2e8f0;font-family:'Courier New', Courier, monospace;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.LatestDigest}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px">+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Checked At:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.CheckTime}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">This is an automated notification from Arcane.<!-- --> Please review and update your container when ready.</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr>+<td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/image-update_text.tmpl b/backend/resources/email-templates/image-update_text.tmplindex da985a3d0..43804c03b 100644--- a/backend/resources/email-templates/image-update_text.tmpl+++ b/backend/resources/email-templates/image-update_text.tmpl@@ -2,6 +2,12 @@A new update has been detected for your container image.+Environment:++{{.Environment}}++----------------------------------------+Image:{{.ImageRef}}diff --git a/backend/resources/email-templates/prune-report_html.tmpl b/backend/resources/email-templates/prune-report_html.tmplindex 029a9ccce..e4aef18a3 100644--- a/backend/resources/email-templates/prune-report_html.tmpl+++ b/backend/resources/email-templates/prune-report_html.tmpl@@ -1,8 +1,9 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">System Prune Report</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;text-align:center;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><p style="font-size:12px;line-height:18px;letter-spacing:0.08em;text-transform:uppercase;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Total Reclaimed</p><p style="font-size:30px;line-height:36px;font-weight:700;color:#34d399;margin:8px 0 0 0;margin-top:8px;margin-right:0;margin-bottom:0;margin-left:0">{{.TotalSpaceReclaimed}}</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:18px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Containers:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ContainerSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">-<td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Images:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px">-<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Volumes:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.VolumeSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Build Cache:</p></td>-<td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.BuildCacheSpaceReclaimed}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px"><tbody><tr><td><p style="font-size:12px;line-height:18px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Generated by Arcane at <!-- -->{{.Time}}</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">+<td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Containers:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ContainerSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px">+<p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Images:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.ImageSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Volumes:</p></td>+<td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.VolumeSpaceReclaimed}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:180px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Build Cache:</p></td><td data-id="__react-email-column">+<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;font-family:monospace;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.BuildCacheSpaceReclaimed}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px"><tbody><tr><td><p style="font-size:12px;line-height:18px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Generated by Arcane at <!-- -->{{.Time}}</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/prune-report_text.tmpl b/backend/resources/email-templates/prune-report_text.tmplindex 1cca1f97d..bb50bb522 100644--- a/backend/resources/email-templates/prune-report_text.tmpl+++ b/backend/resources/email-templates/prune-report_text.tmpl@@ -4,6 +4,12 @@ Total Reclaimed{{.TotalSpaceReclaimed}}+Environment:++{{.Environment}}++----------------------------------------+Containers:{{.ContainerSpaceReclaimed}}diff --git a/backend/resources/email-templates/test_html.tmpl b/backend/resources/email-templates/test_html.tmplindex 1a3dacd13..63bdd5a22 100644--- a/backend/resources/email-templates/test_html.tmpl+++ b/backend/resources/email-templates/test_html.tmpl@@ -1,3 +1,4 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">Test Email</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table>-<p style="font-size:16px;line-height:24px;color:#cbd5e1;margin-top:16px;margin-bottom:0">Your email setup is working correctly!</p></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}+<p style="font-size:16px;line-height:24px;color:#cbd5e1;margin-top:16px;margin-bottom:0">Your email setup is working correctly!</p><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:140px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td><td data-id="__react-email-column">+<p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/test_text.tmpl b/backend/resources/email-templates/test_text.tmplindex 3e2978acb..d3ab46209 100644--- a/backend/resources/email-templates/test_text.tmpl+++ b/backend/resources/email-templates/test_text.tmpl@@ -2,4 +2,8 @@Your email setup is working correctly!+Environment:++{{.Environment}}+Open Arcane Dashboard → {{.AppURL}}{{end}}diff --git a/backend/resources/email-templates/vulnerability-summary_html.tmpl b/backend/resources/email-templates/vulnerability-summary_html.tmplindex c195c7723..9e4887e67 100644--- a/backend/resources/email-templates/vulnerability-summary_html.tmpl+++ b/backend/resources/email-templates/vulnerability-summary_html.tmpl@@ -1,7 +1,8 @@{{define "root"}}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html dir="ltr" lang="en"><head><link rel="preload" as="image" href="{{.LogoURL}}"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><meta name="x-apple-disable-message-reformatting"/></head><body style="background-color:#0f172a"><!--$--><!--html--><!--head--><!--body--><table border="0" width="100%" cellPadding="0" cellSpacing="0" role="presentation" align="center"><tbody><tr><td style="padding:40px 20px;background-color:#0f172a;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="max-width:37.5em;width:600px;margin:0 auto"><tbody><tr style="width:100%"><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-bottom:32px"><tbody><tr><td><img alt="Arcane" height="auto" src="{{.LogoURL}}" style="display:inline-block;outline:none;border:none;text-decoration:none;width:180px;height:auto" width="180"/></td></tr></tbody></table><div style="background-color:rgba(30, 41, 59, 0.6);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(148, 163, 184, 0.1);padding:32px;border-radius:16px;box-shadow:0 8px 32px 0 rgba(0, 0, 0, 0.37)"><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column"><h1 style="font-size:24px;font-weight:bold;margin:0;color:#f1f5f9">Daily Vulnerability Summary</h1></td><td align="right" data-id="__react-email-column"></td></tr></tbody></table>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:16px"><tbody><tr><td><p style="font-size:14px;line-height:22px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">{{.SummaryLabel}}</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Overview:</p></td>-<td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Overview}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Fixable vulnerabilities:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">-{{.FixableCount}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Severity breakdown:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.SeverityBreakdown}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>-<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Sample CVEs:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.SampleCVEs}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">-Open Arcane to review full vulnerability details and remediation actions.</p></td></tr></tbody></table></div><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:16px"><tbody><tr><td><p style="font-size:14px;line-height:22px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">{{.SummaryLabel}}</p></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:20px;background-color:rgba(15, 23, 42, 0.5);border:1px solid rgba(148, 163, 184, 0.1);padding:20px;border-radius:12px"><tbody><tr><td><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Environment:</p></td>+<td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Environment}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Overview:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.Overview}}</p></td></tr>+</tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Fixable vulnerabilities:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;font-weight:600;color:#34d399;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.FixableCount}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/>+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%"><td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Severity breakdown:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.SeverityBreakdown}}</p></td></tr></tbody></table><hr style="width:100%;border:none;border-top:1px solid #eaeaea;border-color:rgba(148, 163, 184, 0.2);margin:4px 0"/><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-bottom:0"><tbody style="width:100%"><tr style="width:100%">+<td data-id="__react-email-column" style="width:170px;vertical-align:top;padding-right:12px"><p style="font-size:14px;line-height:24px;font-weight:600;color:#94a3b8;margin:8px 0;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">Sample CVEs:</p></td><td data-id="__react-email-column"><p style="font-size:14px;line-height:24px;color:#e2e8f0;margin:8px 0;word-break:break-word;margin-top:8px;margin-right:0;margin-bottom:8px;margin-left:0">{{.SampleCVEs}}</p></td></tr></tbody></table></td></tr></tbody></table><table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="margin-top:24px"><tbody><tr><td><p style="font-size:13px;line-height:20px;color:#94a3b8;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0">Open Arcane to review full vulnerability details and remediation actions.</p></td></tr></tbody></table></div>+<table align="center" width="100%" border="0" cellPadding="0" cellSpacing="0" role="presentation" style="text-align:center;margin-top:32px;padding-top:24px"><tbody><tr><td><p style="font-size:14px;line-height:20px;margin:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0"><a href="{{.AppURL}}" style="color:#a78bfa;text-decoration-line:none;text-decoration:none;font-weight:500" target="_blank">Open Arcane Dashboard →</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><!--/$--></body></html>{{end}}diff --git a/backend/resources/email-templates/vulnerability-summary_text.tmpl b/backend/resources/email-templates/vulnerability-summary_text.tmplindex e1bf16765..6ed09fb4b 100644--- a/backend/resources/email-templates/vulnerability-summary_text.tmpl+++ b/backend/resources/email-templates/vulnerability-summary_text.tmpl@@ -2,6 +2,12 @@{{.SummaryLabel}}+Environment:++{{.Environment}}++----------------------------------------+Overview:{{.Overview}}diff --git a/email-templates/emails/batch-image-updates.tsx b/email-templates/emails/batch-image-updates.tsxindex bca2dcfad..f4db64f6d 100644--- a/email-templates/emails/batch-image-updates.tsx+++ b/email-templates/emails/batch-image-updates.tsx@@ -6,6 +6,7 @@ import { sharedPreviewProps, sharedTemplateProps } from '../props';interface BatchImageUpdatesEmailProps {logoURL: string;appURL: string;+ environment: string;updateCount: number;checkTime: string;imageList?: string[];@@ -14,6 +15,7 @@ interface BatchImageUpdatesEmailProps {export const BatchImageUpdatesEmail = ({logoURL,appURL,+ environment,updateCount,checkTime,imageList = [],@@ -38,6 +40,17 @@ export const BatchImageUpdatesEmail = ({</Section><Section style={infoSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>++ <Hr style={dividerStyle} />+<Row style={infoRowStyle}><Column style={labelColumnStyle}><Text style={labelStyle}>Updates Available:</Text>diff --git a/email-templates/emails/container-update.tsx b/email-templates/emails/container-update.tsxindex 546f04aa8..9a6775159 100644--- a/email-templates/emails/container-update.tsx+++ b/email-templates/emails/container-update.tsx@@ -6,6 +6,7 @@ import { sharedPreviewProps, sharedTemplateProps } from '../props';interface ContainerUpdateEmailProps {logoURL: string;appURL: string;+ environment: string;containerName: string;imageRef: string;oldDigest: string;@@ -16,6 +17,7 @@ interface ContainerUpdateEmailProps {export const ContainerUpdateEmail = ({logoURL,appURL,+ environment,containerName,imageRef,oldDigest,@@ -38,6 +40,17 @@ export const ContainerUpdateEmail = ({</Section><Section style={infoSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>++ <Hr style={dividerStyle} />+<Row style={infoRowStyle}><Column style={labelColumnStyle}><Text style={labelStyle}>Container:</Text>diff --git a/email-templates/emails/image-update.tsx b/email-templates/emails/image-update.tsxindex 1f48faf6e..eb703a837 100644--- a/email-templates/emails/image-update.tsx+++ b/email-templates/emails/image-update.tsx@@ -6,6 +6,7 @@ import { sharedPreviewProps, sharedTemplateProps } from '../props';interface ImageUpdateEmailProps {logoURL: string;appURL: string;+ environment: string;imageRef: string;hasUpdate: boolean;updateType: string;@@ -17,6 +18,7 @@ interface ImageUpdateEmailProps {export const ImageUpdateEmail = ({logoURL,appURL,+ environment,imageRef,hasUpdate,updateType,@@ -44,6 +46,17 @@ export const ImageUpdateEmail = ({</Section><Section style={infoSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>++ <Hr style={dividerStyle} />+<Row style={infoRowStyle}><Column style={labelColumnStyle}><Text style={labelStyle}>Image:</Text>diff --git a/email-templates/emails/prune-report.tsx b/email-templates/emails/prune-report.tsxindex 1ce76d5b1..62c084a2b 100644--- a/email-templates/emails/prune-report.tsx+++ b/email-templates/emails/prune-report.tsx@@ -6,6 +6,7 @@ import { sharedPreviewProps, sharedTemplateProps } from '../props';interface PruneReportEmailProps {logoURL: string;appURL: string;+ environment: string;totalSpaceReclaimed: string;containerSpaceReclaimed: string;imageSpaceReclaimed: string;@@ -17,6 +18,7 @@ interface PruneReportEmailProps {export const PruneReportEmail = ({logoURL,appURL,+ environment,totalSpaceReclaimed,containerSpaceReclaimed,imageSpaceReclaimed,@@ -34,6 +36,17 @@ export const PruneReportEmail = ({</Section><Section style={breakdownSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>++ <Hr style={dividerStyle} />+<Row style={infoRowStyle}><Column style={labelColumnStyle}><Text style={labelStyle}>Containers:</Text>diff --git a/email-templates/emails/test.tsx b/email-templates/emails/test.tsxindex f8fe510c0..ef7efd732 100644--- a/email-templates/emails/test.tsx+++ b/email-templates/emails/test.tsx@@ -1,28 +1,72 @@-import { Text } from '@react-email/components';-import { BaseTemplate } from '../components/base-template';-import CardHeader from '../components/card-header';-import { sharedPreviewProps, sharedTemplateProps } from '../props';+import { Column, Row, Section, Text } from "@react-email/components";+import { BaseTemplate } from "../components/base-template";+import CardHeader from "../components/card-header";+import { sharedPreviewProps, sharedTemplateProps } from "../props";interface TestEmailProps {logoURL: string;appURL: string;+ environment: string;}-export const TestEmail = ({ logoURL, appURL }: TestEmailProps) => (+export const TestEmail = ({ logoURL, appURL, environment }: TestEmailProps) => (<BaseTemplate logoURL={logoURL} appURL={appURL}><CardHeader title="Test Email" /><Text style={textStyle}>Your email setup is working correctly!</Text>++ <Section style={infoSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>+ </Section></BaseTemplate>);export default TestEmail;const textStyle = {- fontSize: '16px',- lineHeight: '24px',- color: '#cbd5e1',- marginTop: '16px',- marginBottom: '0',+ fontSize: "16px",+ lineHeight: "24px",+ color: "#cbd5e1",+ marginTop: "16px",+ marginBottom: "0",+};++const infoSectionStyle = {+ marginTop: "20px",+ backgroundColor: "rgba(15, 23, 42, 0.5)",+ border: "1px solid rgba(148, 163, 184, 0.1)",+ padding: "20px",+ borderRadius: "12px",+};++const infoRowStyle = {+ marginBottom: "0",+};++const labelColumnStyle = {+ width: "140px",+ verticalAlign: "top" as const,+ paddingRight: "12px",+};++const labelStyle = {+ fontSize: "14px",+ fontWeight: "600" as const,+ color: "#94a3b8",+ margin: "8px 0",+};++const valueStyle = {+ fontSize: "14px",+ color: "#e2e8f0",+ margin: "8px 0",+ wordBreak: "break-word" as const,};TestEmail.TemplateProps = {diff --git a/email-templates/emails/vulnerability-summary.tsx b/email-templates/emails/vulnerability-summary.tsxindex f7b701e25..afcced62d 100644--- a/email-templates/emails/vulnerability-summary.tsx+++ b/email-templates/emails/vulnerability-summary.tsx@@ -6,6 +6,7 @@ import { sharedPreviewProps, sharedTemplateProps } from '../props';interface VulnerabilitySummaryEmailProps {logoURL: string;appURL: string;+ environment: string;summaryLabel: string;overview: string;fixableCount: string;@@ -16,6 +17,7 @@ interface VulnerabilitySummaryEmailProps {export const VulnerabilitySummaryEmail = ({logoURL,appURL,+ environment,summaryLabel,overview,fixableCount,@@ -31,6 +33,17 @@ export const VulnerabilitySummaryEmail = ({</Section><Section style={infoSectionStyle}>+ <Row style={infoRowStyle}>+ <Column style={labelColumnStyle}>+ <Text style={labelStyle}>Environment:</Text>+ </Column>+ <Column>+ <Text style={valueStyle}>{environment}</Text>+ </Column>+ </Row>++ <Hr style={dividerStyle} />+<Row style={infoRowStyle}><Column style={labelColumnStyle}><Text style={labelStyle}>Overview:</Text>diff --git a/email-templates/props.ts b/email-templates/props.tsindex c50e6349d..e1a51fe6b 100644--- a/email-templates/props.ts+++ b/email-templates/props.ts@@ -1,9 +1,11 @@export const sharedPreviewProps = {logoURL: 'https://raw.githubusercontent.com/ofkm/arcane/main/backend/resources/images/logo-full.svg',appURL: 'http://localhost:3552',+ environment: 'Homelab Production',};export const sharedTemplateProps = {logoURL: '{{.LogoURL}}',appURL: '{{.AppURL}}',+ environment: '{{.Environment}}',};diff --git a/frontend/src/routes/(app)/settings/notifications/+page.svelte b/frontend/src/routes/(app)/settings/notifications/+page.svelteindex d769860d1..c12f820b9 100644--- a/frontend/src/routes/(app)/settings/notifications/+page.svelte+++ b/frontend/src/routes/(app)/settings/notifications/+page.svelte@@ -475,13 +475,6 @@>{#snippet mainContent()}<fieldset disabled={isReadOnly} class="relative w-full min-w-0">- {#if isReadOnly}- <Alert.Root variant="default" class="mb-4 sm:mb-6">- <Alert.Title>{m.notifications_read_only_title()}</Alert.Title>- <Alert.Description>{m.notifications_read_only_description()}</Alert.Description>- </Alert.Root>- {/if}-<Tabs.Root bind:value={notificationsTab}><Tabs.List class="inline-flex w-auto"><Tabs.Trigger value="built-in">{m.notifications_tab_built_in()}</Tabs.Trigger>diff --git a/types/notification/notification.go b/types/notification/notification.goindex e234c512a..fc5079050 100644--- a/types/notification/notification.go+++ b/types/notification/notification.go@@ -1,6 +1,10 @@package notification-import "github.com/getarcaneapp/arcane/types/base"+import (+ "github.com/getarcaneapp/arcane/types/base"+ "github.com/getarcaneapp/arcane/types/imageupdate"+ "github.com/getarcaneapp/arcane/types/system"+)// Provider is the type for notification provider identifiers.type Provider string@@ -121,3 +125,59 @@ type AppriseResponse struct {// Required: falseContainerUpdateTag string `json:"containerUpdateTag"`}++type DispatchKind string++const (+ DispatchKindImageUpdate DispatchKind = "image_update"+ DispatchKindBatchImageUpdate DispatchKind = "batch_image_update"+ DispatchKindContainerUpdate DispatchKind = "container_update"+ DispatchKindVulnerabilityFound DispatchKind = "vulnerability_found"+ DispatchKindPruneReport DispatchKind = "prune_report"+ DispatchKindAutoHeal DispatchKind = "auto_heal"+)++type DispatchImageUpdate struct {+ ImageRef string `json:"imageRef"`+ UpdateInfo imageupdate.Response `json:"updateInfo"`+}++type DispatchBatchImageUpdate struct {+ Updates map[string]*imageupdate.Response `json:"updates"`+}++type DispatchContainerUpdate struct {+ ContainerName string `json:"containerName"`+ ImageRef string `json:"imageRef"`+ OldDigest string `json:"oldDigest,omitempty"`+ NewDigest string `json:"newDigest,omitempty"`+}++type DispatchVulnerabilityFound struct {+ CVEID string `json:"cveId"`+ CVELink string `json:"cveLink"`+ Severity string `json:"severity"`+ ImageName string `json:"imageName"`+ FixedVersion string `json:"fixedVersion,omitempty"`+ PkgName string `json:"pkgName,omitempty"`+ InstalledVersion string `json:"installedVersion,omitempty"`+}++type DispatchPruneReport struct {+ Result system.PruneAllResult `json:"result"`+}++type DispatchAutoHeal struct {+ ContainerName string `json:"containerName"`+ ContainerID string `json:"containerId"`+}++type DispatchRequest struct {+ Kind DispatchKind `json:"kind"`+ ImageUpdate *DispatchImageUpdate `json:"imageUpdate,omitempty"`+ BatchImageUpdate *DispatchBatchImageUpdate `json:"batchImageUpdate,omitempty"`+ ContainerUpdate *DispatchContainerUpdate `json:"containerUpdate,omitempty"`+ VulnerabilityFound *DispatchVulnerabilityFound `json:"vulnerabilityFound,omitempty"`+ PruneReport *DispatchPruneReport `json:"pruneReport,omitempty"`+ AutoHeal *DispatchAutoHeal `json:"autoHeal,omitempty"`+}