You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
851 B

6 years ago
package misc
import (
"encoding/base64"
6 years ago
"github.com/microcosm-cc/bluemonday"
6 years ago
"go.uber.org/zap"
)
// Conf is the global var for config
var Conf *Config
// Log is the global var for log
var Log *zap.Logger
// Base64 is the base64 handler
var Base64 = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
6 years ago
// Sanitizer makes outside string clean
var Sanitizer *bluemonday.Policy
func init() {
p := bluemonday.UGCPolicy()
p.AllowAttrs("class").Globally()
p.AllowAttrs("id").Globally()
p.AllowElements("input")
p.AllowAttrs("checked").OnElements("input")
p.AllowAttrs("disabled").OnElements("input")
p.AllowAttrs("type").OnElements("input")
p.AllowAttrs("style").OnElements("span")
p.AllowAttrs("style").OnElements("td")
p.AllowAttrs("style").OnElements("th")
p.AllowDataURIImages()
Sanitizer = p
}