mirror of
https://github.com/R0m1k3/FlowReader.git
synced 2026-10-11 17:28:05 +02:00
feat(epic-3): implémentation du Dashboard, mode lecture et notifications temps réel
This commit is contained in:
1 parent
1d31de95ec
commit
dc26f22f51
20 files changed
+1237
-107
No files matched your search
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user