feat(epic-3): implémentation du Dashboard, mode lecture et notifications temps réel

This commit is contained in:
Michael committed 2026-02-04 15:12:54 +01:00
1 parent 1d31de95ec
commit dc26f22f51
20 files changed
+1237 -107

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
// Package utils provides common utility functions.
package utils
import (
"github.com/microcosm-cc/bluemonday"
)
// ContentSanitizer handles HTML sanitization for articles.
type ContentSanitizer struct {
policy *bluemonday.Policy
}
// NewContentSanitizer creates a new sanitizer with a "UGCPolicy" (safe for user-generated content).
func NewContentSanitizer() *ContentSanitizer {
// Using UGCPolicy allows common tags (b, i, p, img, etc.) but strips dangerous ones.
return &ContentSanitizer{
policy: bluemonday.UGCPolicy(),
}
}
// Sanitize cleans the HTML content.
func (s *ContentSanitizer) Sanitize(html string) string {
if html == "" {
return ""
}
return s.policy.Sanitize(html)
}